Skip to content

Commit

Permalink
Add setting to exclude files from diagnostic publishing.
Browse files Browse the repository at this point in the history
- java.diagnostic.filter setting
- Suggest project reload when the setting changes and add support for
  arrays in hasConfigKeyChanged(..)

Signed-off-by: Roland Grunberg <[email protected]>
  • Loading branch information
rgrunber committed Jul 26, 2024
1 parent e3602eb commit bf05afb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ 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.33.0
* `java.diagnostic.filter`: Specifies a list of file patterns for which matching documents should not have their diagnostics reported (eg. '**/Foo.java').

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
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,15 @@
"markdownDescription": "Specifies whether to recheck all open Java files for diagnostics when editing a Java file.",
"scope": "window"
},
"java.diagnostic.filter": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Specifies a list of file patterns for which matching documents should not have their diagnostics reported (eg. '**/Foo.java').",
"scope": "window"
},
"java.editor.reloadChangedSources": {
"type": "string",
"enum": [
Expand Down
9 changes: 7 additions & 2 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,16 @@ function hasJavaConfigChanged(oldConfig: WorkspaceConfiguration, newConfig: Work
|| hasConfigKeyChanged('jdt.ls.vmargs', oldConfig, newConfig)
|| hasConfigKeyChanged('server.launchMode', oldConfig, newConfig)
|| hasConfigKeyChanged('sharedIndexes.location', oldConfig, newConfig)
|| hasConfigKeyChanged('transport', oldConfig, newConfig);
|| hasConfigKeyChanged('transport', oldConfig, newConfig)
|| hasConfigKeyChanged('diagnostic.filter', oldConfig, newConfig);
}

function hasConfigKeyChanged(key, oldConfig, newConfig) {
return oldConfig.get(key) !== newConfig.get(key);
const oldValue = oldConfig.get(key);
const newValue = newConfig.get(key);
return Array.isArray(oldValue) && Array.isArray(newValue)
? JSON.stringify(oldValue) !== JSON.stringify(newValue)
: oldValue !== newValue;
}

export function getJavaEncoding(): string {
Expand Down

0 comments on commit bf05afb

Please sign in to comment.