Skip to content

Commit

Permalink
Add a configuration option to disable diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
plexus committed Feb 14, 2021
1 parent d96a68d commit 96a9b5f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changes to Calva.

## [Unreleased]

- [Add a configuration option to disable diagnostics](https://github.com/BetterThanTomorrow/calva/pull/981)

## [2.0.171] - 2021-02-10
- Update clojure-lsp to version 2021.02.09-18.28.06 (Fix: [Auto completion does not work in clojure-lsp only mode (no repl connection)](https://github.com/BetterThanTomorrow/calva/issues/996#issuecomment-776148282))
- Update clojure-lsp to version 2021.02.10-03.01.19 (Fix: [Project clj-kondo config file not being considered](https://github.com/BetterThanTomorrow/calva/issues/1026))
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,11 @@
"type": "boolean",
"markdownDescription": "Don't surface REPL UI elements when avoidable. (For when using another REPL extension together with Calva's static features.)",
"default": false
},
"calva.displayDiagnostics": {
"type": "boolean",
"markdownDescription": "Show linter warnings and other diagnostics",
"default": true
}
}
},
Expand Down
3 changes: 3 additions & 0 deletions src/lsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ function createClient(jarPath: string): LanguageClient {
},
middleware: {
handleDiagnostics(uri, diagnostics, next) {
if (!state.config().displayDiagnostics) {
return;
}
if (uri.path.endsWith(config.REPL_FILE_EXT)) {
return;
}
Expand Down
3 changes: 2 additions & 1 deletion src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function config() {
autoOpenJackInTerminal: configOptions.get("autoOpenJackInTerminal") as boolean,
referencesCodeLensEnabled: configOptions.get('referencesCodeLens.enabled') as boolean,
hideReplUi: configOptions.get('hideReplUi') as boolean,
displayDiagnostics: configOptions.get('displayDiagnostics') as boolean,
};
}

Expand Down Expand Up @@ -243,7 +244,7 @@ async function findProjectRootUri(projectFileNames, doc, workspaceFolder): Promi
catch { }
}
}
catch (e) {
catch (e) {
console.error(`Problems in search for project root directory: ${e}`);
}
prev = searchUri;
Expand Down

0 comments on commit 96a9b5f

Please sign in to comment.