@@ -77,28 +77,6 @@ config_data! {
77
77
cachePriming_numThreads: NumThreads = NumThreads :: Physical ,
78
78
79
79
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![ ] ,
102
80
103
81
/// These directories will be ignored by rust-analyzer. They are
104
82
/// relative to the workspace root, and globs are not supported. You may
@@ -231,6 +209,29 @@ config_data! {
231
209
/// Term search fuel in "units of work" for assists (Defaults to 1800).
232
210
assist_termSearch_fuel: usize = 1800 ,
233
211
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
+
234
235
/// 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.
235
236
imports_granularity_enforce: bool = false ,
236
237
/// How imports should be grouped into use statements.
@@ -1447,11 +1448,11 @@ impl Config {
1447
1448
1448
1449
pub fn diagnostics ( & self , source_root : Option < SourceRootId > ) -> DiagnosticsConfig {
1449
1450
DiagnosticsConfig {
1450
- enabled : * self . diagnostics_enable ( ) ,
1451
+ enabled : * self . diagnostics_enable ( source_root ) ,
1451
1452
proc_attr_macros_enabled : self . expand_proc_attr_macros ( ) ,
1452
1453
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 ( ) ,
1455
1456
expr_fill_default : match self . assist_expressionFillDefault ( source_root) {
1456
1457
ExprFillDefaultDef :: Todo => ExprFillDefaultMode :: Todo ,
1457
1458
ExprFillDefaultDef :: Default => ExprFillDefaultMode :: Default ,
@@ -1461,7 +1462,7 @@ impl Config {
1461
1462
prefer_no_std : self . imports_preferNoStd ( source_root) . to_owned ( ) ,
1462
1463
prefer_prelude : self . imports_preferPrelude ( source_root) . to_owned ( ) ,
1463
1464
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 ( ) ,
1465
1466
term_search_fuel : self . assist_termSearch_fuel ( source_root) . to_owned ( ) as u64 ,
1466
1467
term_search_borrowck : self . assist_termSearch_borrowcheck ( source_root) . to_owned ( ) ,
1467
1468
}
@@ -1719,15 +1720,15 @@ impl Config {
1719
1720
self . cachePriming_enable ( ) . to_owned ( )
1720
1721
}
1721
1722
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 ( )
1724
1725
}
1725
1726
1726
1727
pub fn diagnostics_map ( & self , source_root : Option < SourceRootId > ) -> DiagnosticsMapConfig {
1727
1728
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 ( ) ,
1731
1732
check_ignore : self . check_ignore ( source_root) . clone ( ) ,
1732
1733
}
1733
1734
}
0 commit comments