summaryrefslogtreecommitdiff
path: root/cli/lsp/diagnostics.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2021-10-12 00:02:33 +0200
committerGitHub <noreply@github.com>2021-10-12 00:02:33 +0200
commitf332d72f1653ec03b64a80d8d4949dce5564cc99 (patch)
tree500e6d5d523f1cf66898985d5b7134c32cc270d8 /cli/lsp/diagnostics.rs
parent5bad8e17734ef8cc1f19df292d553cc1327638f3 (diff)
fix(lsp): lint diagnostics respect config file (#12338)
This commit fixes problem with LSP where diagnostics coming from "deno lint" don't respect configuration file. LSP was changed to store "Option<ConfigFile>", "Option<LintConfig>" and "Option<FmtConfig>" on "Inner"; as well as storing "Option<LintConfig>" and "Option<FmtConfig>" on "StateSnapshot". Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
Diffstat (limited to 'cli/lsp/diagnostics.rs')
-rw-r--r--cli/lsp/diagnostics.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/cli/lsp/diagnostics.rs b/cli/lsp/diagnostics.rs
index c106c9865..4bae048c0 100644
--- a/cli/lsp/diagnostics.rs
+++ b/cli/lsp/diagnostics.rs
@@ -314,6 +314,7 @@ async fn generate_lint_diagnostics(
) -> Result<DiagnosticVec, AnyError> {
let documents = snapshot.documents.clone();
let workspace_settings = snapshot.config.settings.workspace.clone();
+ let maybe_lint_config = snapshot.maybe_lint_config.clone();
tokio::task::spawn(async move {
let mut diagnostics_vec = Vec::new();
if workspace_settings.lint {
@@ -333,7 +334,10 @@ async fn generate_lint_diagnostics(
.flatten();
let diagnostics = match module {
Some(Ok(module)) => {
- if let Ok(references) = analysis::get_lint_references(module) {
+ if let Ok(references) = analysis::get_lint_references(
+ module,
+ maybe_lint_config.as_ref(),
+ ) {
references
.into_iter()
.map(|r| r.to_diagnostic())