Skip to content

Commit bf05afb

Browse files
committed
Add setting to exclude files from diagnostic publishing.
- 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]>
1 parent e3602eb commit bf05afb

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ The following settings are supported:
249249
* `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`.
250250
* `java.completion.collapseCompletionItems`: Enable/disable the collapse of overloaded methods in completion items. Overrides `java.completion.guessMethodArguments`. Defaults to `false`.
251251

252+
New in 1.33.0
253+
* `java.diagnostic.filter`: Specifies a list of file patterns for which matching documents should not have their diagnostics reported (eg. '**/Foo.java').
254+
252255
Semantic Highlighting
253256
===============
254257
[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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,15 @@
14741474
"markdownDescription": "Specifies whether to recheck all open Java files for diagnostics when editing a Java file.",
14751475
"scope": "window"
14761476
},
1477+
"java.diagnostic.filter": {
1478+
"type": "array",
1479+
"items": {
1480+
"type": "string"
1481+
},
1482+
"default": [],
1483+
"description": "Specifies a list of file patterns for which matching documents should not have their diagnostics reported (eg. '**/Foo.java').",
1484+
"scope": "window"
1485+
},
14771486
"java.editor.reloadChangedSources": {
14781487
"type": "string",
14791488
"enum": [

src/settings.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,16 @@ function hasJavaConfigChanged(oldConfig: WorkspaceConfiguration, newConfig: Work
136136
|| hasConfigKeyChanged('jdt.ls.vmargs', oldConfig, newConfig)
137137
|| hasConfigKeyChanged('server.launchMode', oldConfig, newConfig)
138138
|| hasConfigKeyChanged('sharedIndexes.location', oldConfig, newConfig)
139-
|| hasConfigKeyChanged('transport', oldConfig, newConfig);
139+
|| hasConfigKeyChanged('transport', oldConfig, newConfig)
140+
|| hasConfigKeyChanged('diagnostic.filter', oldConfig, newConfig);
140141
}
141142

142143
function hasConfigKeyChanged(key, oldConfig, newConfig) {
143-
return oldConfig.get(key) !== newConfig.get(key);
144+
const oldValue = oldConfig.get(key);
145+
const newValue = newConfig.get(key);
146+
return Array.isArray(oldValue) && Array.isArray(newValue)
147+
? JSON.stringify(oldValue) !== JSON.stringify(newValue)
148+
: oldValue !== newValue;
144149
}
145150

146151
export function getJavaEncoding(): string {

0 commit comments

Comments
 (0)