Skip to content

Commit

Permalink
Add setting java.codeGeneration.addFinalForNewDeclaration.
Browse files Browse the repository at this point in the history
- Generates the 'final' modifier for certain new variable/field
  declarations
- Defaults to 'none' (disabled)

Signed-off-by: Roland Grunberg <[email protected]>
  • Loading branch information
rgrunber committed Apr 22, 2024
1 parent b4c0d47 commit 907a5ba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@ The following settings are supported:
* `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`.
* `java.completion.collapseCompletionItems`: Enable/disable the collapse of overloaded methods in completion items. Overrides `java.completion.guessMethodArguments`. Defaults to `false`.

New in 1.30.0
* `java.codeGeneration.addFinalForNewDeclaration`: Whether to generate the 'final' modifer for code actions that create new declarations. Defaults to `none`.
- `none`: Do not generate final modifier
- `fields`: Generate 'final' modifier only for new field declarations
- `variables`: Generate 'final' modifier only for new variable declarations
- `all`: Generate 'final' modifier for all new declarations

Semantic Highlighting
===============
[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).
Expand Down
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,24 @@
"scope": "window",
"order": 30
},
"java.codeGeneration.addFinalForNewDeclaration": {
"type": "string",
"enum": [
"none",
"fields",
"variables",
"all"
],
"enumDescriptions": [
"Do not generate final modifier.",
"Generate 'final' modifier only for new field declarations.",
"Generate 'final' modifier only for new variable declarations.",
"Generate 'final' modifier for all new declarations."
],
"description": "Whether to generate the 'final' modifer for code actions that create new declarations.",
"default": "none",
"scope": "window"
},
"java.codeGeneration.hashCodeEquals.useJava7Objects": {
"type": "boolean",
"description": "Use Objects.hash and Objects.equals when generating the hashCode and equals methods. This setting only applies to Java 7 and higher.",
Expand Down

0 comments on commit 907a5ba

Please sign in to comment.