aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rust-analyzer/src/config.rs')
-rw-r--r--crates/rust-analyzer/src/config.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 33fb5e9c2..44fd7c286 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -7,7 +7,7 @@
7//! configure the server itself, feature flags are passed into analysis, and 7//! configure the server itself, feature flags are passed into analysis, and
8//! tweak things like automatic insertion of `()` in completions. 8//! tweak things like automatic insertion of `()` in completions.
9 9
10use std::{ffi::OsString, path::PathBuf}; 10use std::{collections::HashSet, ffi::OsString, path::PathBuf};
11 11
12use flycheck::FlycheckConfig; 12use flycheck::FlycheckConfig;
13use ide::{AssistConfig, CompletionConfig, HoverConfig, InlayHintsConfig}; 13use ide::{AssistConfig, CompletionConfig, HoverConfig, InlayHintsConfig};
@@ -45,6 +45,14 @@ pub struct Config {
45 pub with_sysroot: bool, 45 pub with_sysroot: bool,
46 pub linked_projects: Vec<LinkedProject>, 46 pub linked_projects: Vec<LinkedProject>,
47 pub root_path: AbsPathBuf, 47 pub root_path: AbsPathBuf,
48
49 pub analysis: AnalysisConfig,
50}
51
52/// Configuration parameters for the analysis run.
53#[derive(Debug, Default, Clone)]
54pub struct AnalysisConfig {
55 pub disabled_diagnostics: HashSet<String>,
48} 56}
49 57
50#[derive(Debug, Clone, Eq, PartialEq)] 58#[derive(Debug, Clone, Eq, PartialEq)]
@@ -176,6 +184,8 @@ impl Config {
176 hover: HoverConfig::default(), 184 hover: HoverConfig::default(),
177 linked_projects: Vec::new(), 185 linked_projects: Vec::new(),
178 root_path, 186 root_path,
187
188 analysis: AnalysisConfig::default(),
179 } 189 }
180 } 190 }
181 191
@@ -293,6 +303,8 @@ impl Config {
293 goto_type_def: data.hoverActions_enable && data.hoverActions_gotoTypeDef, 303 goto_type_def: data.hoverActions_enable && data.hoverActions_gotoTypeDef,
294 }; 304 };
295 305
306 self.analysis = AnalysisConfig { disabled_diagnostics: data.analysis_disabledDiagnostics };
307
296 log::info!("Config::update() = {:#?}", self); 308 log::info!("Config::update() = {:#?}", self);
297 } 309 }
298 310
@@ -357,6 +369,14 @@ impl Config {
357 self.client_caps.status_notification = get_bool("statusNotification"); 369 self.client_caps.status_notification = get_bool("statusNotification");
358 } 370 }
359 } 371 }
372
373 pub fn disabled_diagnostics(&self) -> Option<HashSet<String>> {
374 if self.analysis.disabled_diagnostics.is_empty() {
375 None
376 } else {
377 Some(self.analysis.disabled_diagnostics.clone())
378 }
379 }
360} 380}
361 381
362#[derive(Deserialize)] 382#[derive(Deserialize)]
@@ -444,5 +464,7 @@ config_data! {
444 rustfmt_overrideCommand: Option<Vec<String>> = None, 464 rustfmt_overrideCommand: Option<Vec<String>> = None,
445 465
446 withSysroot: bool = true, 466 withSysroot: bool = true,
467
468 analysis_disabledDiagnostics: HashSet<String> = HashSet::new(),
447 } 469 }
448} 470}