Skip to content

Commit cad9cc9

Browse files
authored
Merge pull request #19935 from ChayimFriedman2/exp-diag-show-quickfix
fix: Always include quickfixes for diagnostics, even when diagnostics are disabled
2 parents 1436449 + 869714a commit cad9cc9

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,16 @@ impl Config {
15971597
term_search_borrowck: self.assist_termSearch_borrowcheck(source_root).to_owned(),
15981598
}
15991599
}
1600+
1601+
pub fn diagnostic_fixes(&self, source_root: Option<SourceRootId>) -> DiagnosticsConfig {
1602+
// We always want to show quickfixes for diagnostics, even when diagnostics/experimental diagnostics are disabled.
1603+
DiagnosticsConfig {
1604+
enabled: true,
1605+
disable_experimental: false,
1606+
..self.diagnostics(source_root)
1607+
}
1608+
}
1609+
16001610
pub fn expand_proc_attr_macros(&self) -> bool {
16011611
self.procMacro_enable().to_owned() && self.procMacro_attributes_enable().to_owned()
16021612
}

crates/rust-analyzer/src/handlers/request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@ pub(crate) fn handle_code_action(
14391439
};
14401440
let assists = snap.analysis.assists_with_fixes(
14411441
&assists_config,
1442-
&snap.config.diagnostics(Some(source_root)),
1442+
&snap.config.diagnostic_fixes(Some(source_root)),
14431443
resolve,
14441444
frange,
14451445
)?;
@@ -1530,7 +1530,7 @@ pub(crate) fn handle_code_action_resolve(
15301530

15311531
let assists = snap.analysis.assists_with_fixes(
15321532
&assists_config,
1533-
&snap.config.diagnostics(Some(source_root)),
1533+
&snap.config.diagnostic_fixes(Some(source_root)),
15341534
AssistResolveStrategy::Single(assist_resolve),
15351535
frange,
15361536
)?;

0 commit comments

Comments
 (0)