@@ -77,28 +77,6 @@ config_data! {
7777 cachePriming_numThreads: NumThreads = NumThreads :: Physical ,
7878
7979
80- /// List of rust-analyzer diagnostics to disable.
81- diagnostics_disabled: FxHashSet <String > = FxHashSet :: default ( ) ,
82- /// Whether to show native rust-analyzer diagnostics.
83- diagnostics_enable: bool = true ,
84- /// Whether to show experimental rust-analyzer diagnostics that might
85- /// have more false positives than usual.
86- diagnostics_experimental_enable: bool = false ,
87- /// Map of prefixes to be substituted when parsing diagnostic file paths.
88- /// This should be the reverse mapping of what is passed to `rustc` as `--remap-path-prefix`.
89- diagnostics_remapPrefix: FxHashMap <String , String > = FxHashMap :: default ( ) ,
90- /// Whether to run additional style lints.
91- diagnostics_styleLints_enable: bool = false ,
92- /// List of warnings that should be displayed with hint severity.
93- ///
94- /// The warnings will be indicated by faded text or three dots in code
95- /// and will not show up in the `Problems Panel`.
96- diagnostics_warningsAsHint: Vec <String > = vec![ ] ,
97- /// List of warnings that should be displayed with info severity.
98- ///
99- /// The warnings will be indicated by a blue squiggly underline in code
100- /// and a blue icon in the `Problems Panel`.
101- diagnostics_warningsAsInfo: Vec <String > = vec![ ] ,
10280
10381 /// These directories will be ignored by rust-analyzer. They are
10482 /// relative to the workspace root, and globs are not supported. You may
@@ -231,6 +209,29 @@ config_data! {
231209 /// Term search fuel in "units of work" for assists (Defaults to 1800).
232210 assist_termSearch_fuel: usize = 1800 ,
233211
212+ /// List of rust-analyzer diagnostics to disable.
213+ diagnostics_disabled: FxHashSet <String > = FxHashSet :: default ( ) ,
214+ /// Whether to show native rust-analyzer diagnostics.
215+ diagnostics_enable: bool = true ,
216+ /// Whether to show experimental rust-analyzer diagnostics that might
217+ /// have more false positives than usual.
218+ diagnostics_experimental_enable: bool = false ,
219+ /// Map of prefixes to be substituted when parsing diagnostic file paths.
220+ /// This should be the reverse mapping of what is passed to `rustc` as `--remap-path-prefix`.
221+ diagnostics_remapPrefix: FxHashMap <String , String > = FxHashMap :: default ( ) ,
222+ /// Whether to run additional style lints.
223+ diagnostics_styleLints_enable: bool = false ,
224+ /// List of warnings that should be displayed with hint severity.
225+ ///
226+ /// The warnings will be indicated by faded text or three dots in code
227+ /// and will not show up in the `Problems Panel`.
228+ diagnostics_warningsAsHint: Vec <String > = vec![ ] ,
229+ /// List of warnings that should be displayed with info severity.
230+ ///
231+ /// The warnings will be indicated by a blue squiggly underline in code
232+ /// and a blue icon in the `Problems Panel`.
233+ diagnostics_warningsAsInfo: Vec <String > = vec![ ] ,
234+
234235 /// 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.
235236 imports_granularity_enforce: bool = false ,
236237 /// How imports should be grouped into use statements.
@@ -1447,11 +1448,11 @@ impl Config {
14471448
14481449 pub fn diagnostics ( & self , source_root : Option < SourceRootId > ) -> DiagnosticsConfig {
14491450 DiagnosticsConfig {
1450- enabled : * self . diagnostics_enable ( ) ,
1451+ enabled : * self . diagnostics_enable ( source_root ) ,
14511452 proc_attr_macros_enabled : self . expand_proc_attr_macros ( ) ,
14521453 proc_macros_enabled : * self . procMacro_enable ( ) ,
1453- disable_experimental : !self . diagnostics_experimental_enable ( ) ,
1454- disabled : self . diagnostics_disabled ( ) . clone ( ) ,
1454+ disable_experimental : !self . diagnostics_experimental_enable ( source_root ) ,
1455+ disabled : self . diagnostics_disabled ( source_root ) . clone ( ) ,
14551456 expr_fill_default : match self . assist_expressionFillDefault ( source_root) {
14561457 ExprFillDefaultDef :: Todo => ExprFillDefaultMode :: Todo ,
14571458 ExprFillDefaultDef :: Default => ExprFillDefaultMode :: Default ,
@@ -1461,7 +1462,7 @@ impl Config {
14611462 prefer_no_std : self . imports_preferNoStd ( source_root) . to_owned ( ) ,
14621463 prefer_prelude : self . imports_preferPrelude ( source_root) . to_owned ( ) ,
14631464 prefer_absolute : self . imports_prefixExternPrelude ( source_root) . to_owned ( ) ,
1464- style_lints : self . diagnostics_styleLints_enable ( ) . to_owned ( ) ,
1465+ style_lints : self . diagnostics_styleLints_enable ( source_root ) . to_owned ( ) ,
14651466 term_search_fuel : self . assist_termSearch_fuel ( source_root) . to_owned ( ) as u64 ,
14661467 term_search_borrowck : self . assist_termSearch_borrowcheck ( source_root) . to_owned ( ) ,
14671468 }
@@ -1719,15 +1720,15 @@ impl Config {
17191720 self . cachePriming_enable ( ) . to_owned ( )
17201721 }
17211722
1722- pub fn publish_diagnostics ( & self ) -> bool {
1723- self . diagnostics_enable ( ) . to_owned ( )
1723+ pub fn publish_diagnostics ( & self , source_root : Option < SourceRootId > ) -> bool {
1724+ self . diagnostics_enable ( source_root ) . to_owned ( )
17241725 }
17251726
17261727 pub fn diagnostics_map ( & self , source_root : Option < SourceRootId > ) -> DiagnosticsMapConfig {
17271728 DiagnosticsMapConfig {
1728- remap_prefix : self . diagnostics_remapPrefix ( ) . clone ( ) ,
1729- warnings_as_info : self . diagnostics_warningsAsInfo ( ) . clone ( ) ,
1730- warnings_as_hint : self . diagnostics_warningsAsHint ( ) . clone ( ) ,
1729+ remap_prefix : self . diagnostics_remapPrefix ( source_root ) . clone ( ) ,
1730+ warnings_as_info : self . diagnostics_warningsAsInfo ( source_root ) . clone ( ) ,
1731+ warnings_as_hint : self . diagnostics_warningsAsHint ( source_root ) . clone ( ) ,
17311732 check_ignore : self . check_ignore ( source_root) . clone ( ) ,
17321733 }
17331734 }
0 commit comments