mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-31 23:38:45 +00:00
Make diagnostics_* local
This commit is contained in:
parent
3a4efb4141
commit
eef79b4e47
2 changed files with 33 additions and 32 deletions
|
@ -77,28 +77,6 @@ config_data! {
|
||||||
cachePriming_numThreads: NumThreads = NumThreads::Physical,
|
cachePriming_numThreads: NumThreads = NumThreads::Physical,
|
||||||
|
|
||||||
|
|
||||||
/// List of rust-analyzer diagnostics to disable.
|
|
||||||
diagnostics_disabled: FxHashSet<String> = FxHashSet::default(),
|
|
||||||
/// Whether to show native rust-analyzer diagnostics.
|
|
||||||
diagnostics_enable: bool = true,
|
|
||||||
/// Whether to show experimental rust-analyzer diagnostics that might
|
|
||||||
/// have more false positives than usual.
|
|
||||||
diagnostics_experimental_enable: bool = false,
|
|
||||||
/// Map of prefixes to be substituted when parsing diagnostic file paths.
|
|
||||||
/// This should be the reverse mapping of what is passed to `rustc` as `--remap-path-prefix`.
|
|
||||||
diagnostics_remapPrefix: FxHashMap<String, String> = FxHashMap::default(),
|
|
||||||
/// Whether to run additional style lints.
|
|
||||||
diagnostics_styleLints_enable: bool = false,
|
|
||||||
/// List of warnings that should be displayed with hint severity.
|
|
||||||
///
|
|
||||||
/// The warnings will be indicated by faded text or three dots in code
|
|
||||||
/// and will not show up in the `Problems Panel`.
|
|
||||||
diagnostics_warningsAsHint: Vec<String> = vec![],
|
|
||||||
/// List of warnings that should be displayed with info severity.
|
|
||||||
///
|
|
||||||
/// The warnings will be indicated by a blue squiggly underline in code
|
|
||||||
/// and a blue icon in the `Problems Panel`.
|
|
||||||
diagnostics_warningsAsInfo: Vec<String> = vec![],
|
|
||||||
|
|
||||||
/// These directories will be ignored by rust-analyzer. They are
|
/// These directories will be ignored by rust-analyzer. They are
|
||||||
/// relative to the workspace root, and globs are not supported. You may
|
/// relative to the workspace root, and globs are not supported. You may
|
||||||
|
@ -231,6 +209,29 @@ config_data! {
|
||||||
/// Term search fuel in "units of work" for assists (Defaults to 1800).
|
/// Term search fuel in "units of work" for assists (Defaults to 1800).
|
||||||
assist_termSearch_fuel: usize = 1800,
|
assist_termSearch_fuel: usize = 1800,
|
||||||
|
|
||||||
|
/// List of rust-analyzer diagnostics to disable.
|
||||||
|
diagnostics_disabled: FxHashSet<String> = FxHashSet::default(),
|
||||||
|
/// Whether to show native rust-analyzer diagnostics.
|
||||||
|
diagnostics_enable: bool = true,
|
||||||
|
/// Whether to show experimental rust-analyzer diagnostics that might
|
||||||
|
/// have more false positives than usual.
|
||||||
|
diagnostics_experimental_enable: bool = false,
|
||||||
|
/// Map of prefixes to be substituted when parsing diagnostic file paths.
|
||||||
|
/// This should be the reverse mapping of what is passed to `rustc` as `--remap-path-prefix`.
|
||||||
|
diagnostics_remapPrefix: FxHashMap<String, String> = FxHashMap::default(),
|
||||||
|
/// Whether to run additional style lints.
|
||||||
|
diagnostics_styleLints_enable: bool = false,
|
||||||
|
/// List of warnings that should be displayed with hint severity.
|
||||||
|
///
|
||||||
|
/// The warnings will be indicated by faded text or three dots in code
|
||||||
|
/// and will not show up in the `Problems Panel`.
|
||||||
|
diagnostics_warningsAsHint: Vec<String> = vec![],
|
||||||
|
/// List of warnings that should be displayed with info severity.
|
||||||
|
///
|
||||||
|
/// The warnings will be indicated by a blue squiggly underline in code
|
||||||
|
/// and a blue icon in the `Problems Panel`.
|
||||||
|
diagnostics_warningsAsInfo: Vec<String> = vec![],
|
||||||
|
|
||||||
/// Whether to enforce the import granularity setting for all files. If set to false rust-analyzer will try to keep import styles consistent per file.
|
/// Whether to enforce the import granularity setting for all files. If set to false rust-analyzer will try to keep import styles consistent per file.
|
||||||
imports_granularity_enforce: bool = false,
|
imports_granularity_enforce: bool = false,
|
||||||
/// How imports should be grouped into use statements.
|
/// How imports should be grouped into use statements.
|
||||||
|
@ -1447,11 +1448,11 @@ impl Config {
|
||||||
|
|
||||||
pub fn diagnostics(&self, source_root: Option<SourceRootId>) -> DiagnosticsConfig {
|
pub fn diagnostics(&self, source_root: Option<SourceRootId>) -> DiagnosticsConfig {
|
||||||
DiagnosticsConfig {
|
DiagnosticsConfig {
|
||||||
enabled: *self.diagnostics_enable(),
|
enabled: *self.diagnostics_enable(source_root),
|
||||||
proc_attr_macros_enabled: self.expand_proc_attr_macros(),
|
proc_attr_macros_enabled: self.expand_proc_attr_macros(),
|
||||||
proc_macros_enabled: *self.procMacro_enable(),
|
proc_macros_enabled: *self.procMacro_enable(),
|
||||||
disable_experimental: !self.diagnostics_experimental_enable(),
|
disable_experimental: !self.diagnostics_experimental_enable(source_root),
|
||||||
disabled: self.diagnostics_disabled().clone(),
|
disabled: self.diagnostics_disabled(source_root).clone(),
|
||||||
expr_fill_default: match self.assist_expressionFillDefault(source_root) {
|
expr_fill_default: match self.assist_expressionFillDefault(source_root) {
|
||||||
ExprFillDefaultDef::Todo => ExprFillDefaultMode::Todo,
|
ExprFillDefaultDef::Todo => ExprFillDefaultMode::Todo,
|
||||||
ExprFillDefaultDef::Default => ExprFillDefaultMode::Default,
|
ExprFillDefaultDef::Default => ExprFillDefaultMode::Default,
|
||||||
|
@ -1461,7 +1462,7 @@ impl Config {
|
||||||
prefer_no_std: self.imports_preferNoStd(source_root).to_owned(),
|
prefer_no_std: self.imports_preferNoStd(source_root).to_owned(),
|
||||||
prefer_prelude: self.imports_preferPrelude(source_root).to_owned(),
|
prefer_prelude: self.imports_preferPrelude(source_root).to_owned(),
|
||||||
prefer_absolute: self.imports_prefixExternPrelude(source_root).to_owned(),
|
prefer_absolute: self.imports_prefixExternPrelude(source_root).to_owned(),
|
||||||
style_lints: self.diagnostics_styleLints_enable().to_owned(),
|
style_lints: self.diagnostics_styleLints_enable(source_root).to_owned(),
|
||||||
term_search_fuel: self.assist_termSearch_fuel(source_root).to_owned() as u64,
|
term_search_fuel: self.assist_termSearch_fuel(source_root).to_owned() as u64,
|
||||||
term_search_borrowck: self.assist_termSearch_borrowcheck(source_root).to_owned(),
|
term_search_borrowck: self.assist_termSearch_borrowcheck(source_root).to_owned(),
|
||||||
}
|
}
|
||||||
|
@ -1719,15 +1720,15 @@ impl Config {
|
||||||
self.cachePriming_enable().to_owned()
|
self.cachePriming_enable().to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn publish_diagnostics(&self) -> bool {
|
pub fn publish_diagnostics(&self, source_root: Option<SourceRootId>) -> bool {
|
||||||
self.diagnostics_enable().to_owned()
|
self.diagnostics_enable(source_root).to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn diagnostics_map(&self, source_root: Option<SourceRootId>) -> DiagnosticsMapConfig {
|
pub fn diagnostics_map(&self, source_root: Option<SourceRootId>) -> DiagnosticsMapConfig {
|
||||||
DiagnosticsMapConfig {
|
DiagnosticsMapConfig {
|
||||||
remap_prefix: self.diagnostics_remapPrefix().clone(),
|
remap_prefix: self.diagnostics_remapPrefix(source_root).clone(),
|
||||||
warnings_as_info: self.diagnostics_warningsAsInfo().clone(),
|
warnings_as_info: self.diagnostics_warningsAsInfo(source_root).clone(),
|
||||||
warnings_as_hint: self.diagnostics_warningsAsHint().clone(),
|
warnings_as_hint: self.diagnostics_warningsAsHint(source_root).clone(),
|
||||||
check_ignore: self.check_ignore(source_root).clone(),
|
check_ignore: self.check_ignore(source_root).clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,7 +434,7 @@ impl GlobalState {
|
||||||
|
|
||||||
let project_or_mem_docs_changed =
|
let project_or_mem_docs_changed =
|
||||||
became_quiescent || state_changed || memdocs_added_or_removed;
|
became_quiescent || state_changed || memdocs_added_or_removed;
|
||||||
if project_or_mem_docs_changed && self.config.publish_diagnostics() {
|
if project_or_mem_docs_changed && self.config.publish_diagnostics(None) {
|
||||||
self.update_diagnostics();
|
self.update_diagnostics();
|
||||||
}
|
}
|
||||||
if project_or_mem_docs_changed && self.config.test_explorer() {
|
if project_or_mem_docs_changed && self.config.test_explorer() {
|
||||||
|
|
Loading…
Reference in a new issue