Unnamed repository; edit this file 'description' to name the repository.
Merge pull request #19935 from ChayimFriedman2/exp-diag-show-quickfix
fix: Always include quickfixes for diagnostics, even when diagnostics are disabled
Lukas Wirth 11 months ago
parent 1436449 · parent 869714a · commit cad9cc9
-rw-r--r--crates/rust-analyzer/src/config.rs10
-rw-r--r--crates/rust-analyzer/src/handlers/request.rs4
2 files changed, 12 insertions, 2 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 96be6726cc..5cbea9c2b3 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -1597,6 +1597,16 @@ impl Config {
term_search_borrowck: self.assist_termSearch_borrowcheck(source_root).to_owned(),
}
}
+
+ pub fn diagnostic_fixes(&self, source_root: Option<SourceRootId>) -> DiagnosticsConfig {
+ // We always want to show quickfixes for diagnostics, even when diagnostics/experimental diagnostics are disabled.
+ DiagnosticsConfig {
+ enabled: true,
+ disable_experimental: false,
+ ..self.diagnostics(source_root)
+ }
+ }
+
pub fn expand_proc_attr_macros(&self) -> bool {
self.procMacro_enable().to_owned() && self.procMacro_attributes_enable().to_owned()
}
diff --git a/crates/rust-analyzer/src/handlers/request.rs b/crates/rust-analyzer/src/handlers/request.rs
index 69983a6762..6d46ce68ed 100644
--- a/crates/rust-analyzer/src/handlers/request.rs
+++ b/crates/rust-analyzer/src/handlers/request.rs
@@ -1439,7 +1439,7 @@ pub(crate) fn handle_code_action(
};
let assists = snap.analysis.assists_with_fixes(
&assists_config,
- &snap.config.diagnostics(Some(source_root)),
+ &snap.config.diagnostic_fixes(Some(source_root)),
resolve,
frange,
)?;
@@ -1530,7 +1530,7 @@ pub(crate) fn handle_code_action_resolve(
let assists = snap.analysis.assists_with_fixes(
&assists_config,
- &snap.config.diagnostics(Some(source_root)),
+ &snap.config.diagnostic_fixes(Some(source_root)),
AssistResolveStrategy::Single(assist_resolve),
frange,
)?;