Skip to content

Commit 907a5ba

Browse files
committed
Add setting java.codeGeneration.addFinalForNewDeclaration.
- Generates the 'final' modifier for certain new variable/field declarations - Defaults to 'none' (disabled) Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
1 parent b4c0d47 commit 907a5ba

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,13 @@ The following settings are supported:
244244
* `java.configuration.detectJdksAtStart`: Automatically detect JDKs installed on local machine at startup. If you have specified the same JDK version in `java.configuration.runtimes`, the extension will use that version first. Defaults to `true`.
245245
* `java.completion.collapseCompletionItems`: Enable/disable the collapse of overloaded methods in completion items. Overrides `java.completion.guessMethodArguments`. Defaults to `false`.
246246

247+
New in 1.30.0
248+
* `java.codeGeneration.addFinalForNewDeclaration`: Whether to generate the 'final' modifer for code actions that create new declarations. Defaults to `none`.
249+
- `none`: Do not generate final modifier
250+
- `fields`: Generate 'final' modifier only for new field declarations
251+
- `variables`: Generate 'final' modifier only for new variable declarations
252+
- `all`: Generate 'final' modifier for all new declarations
253+
247254
Semantic Highlighting
248255
===============
249256
[Semantic Highlighting](https://github.com/redhat-developer/vscode-java/wiki/Semantic-Highlighting) fixes numerous syntax highlighting issues with the default Java Textmate grammar. However, you might experience a few minor issues, particularly a delay when it kicks in, as it needs to be computed by the Java Language server, when opening a new file or when typing. Semantic highlighting can be disabled for all languages using the `editor.semanticHighlighting.enabled` setting, or for Java only using [language-specific editor settings](https://code.visualstudio.com/docs/getstarted/settings#_languagespecific-editor-settings).

package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,24 @@
11571157
"scope": "window",
11581158
"order": 30
11591159
},
1160+
"java.codeGeneration.addFinalForNewDeclaration": {
1161+
"type": "string",
1162+
"enum": [
1163+
"none",
1164+
"fields",
1165+
"variables",
1166+
"all"
1167+
],
1168+
"enumDescriptions": [
1169+
"Do not generate final modifier.",
1170+
"Generate 'final' modifier only for new field declarations.",
1171+
"Generate 'final' modifier only for new variable declarations.",
1172+
"Generate 'final' modifier for all new declarations."
1173+
],
1174+
"description": "Whether to generate the 'final' modifer for code actions that create new declarations.",
1175+
"default": "none",
1176+
"scope": "window"
1177+
},
11601178
"java.codeGeneration.hashCodeEquals.useJava7Objects": {
11611179
"type": "boolean",
11621180
"description": "Use Objects.hash and Objects.equals when generating the hashCode and equals methods. This setting only applies to Java 7 and higher.",

0 commit comments

Comments
 (0)