Merge #5682
5682: Add an option to disable diagnostics r=matklad a=popzxc As far as I know, currently it's not possible to disable a selected type of diagnostics provided by `rust-analyzer`. This causes an inconvenient situation with a false-positive warnings: you either have to disable all the diagnostics, or you have to ignore these warnings. There are some open issues related to this problem, e.g.: https://github.com/rust-analyzer/rust-analyzer/issues/5412, https://github.com/rust-analyzer/rust-analyzer/issues/5502 This PR attempts to make it possible to selectively disable some diagnostics on per-project basis. Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
This commit is contained in:
@@ -775,7 +775,11 @@ fn handle_fixes(
|
||||
None => {}
|
||||
};
|
||||
|
||||
let diagnostics = snap.analysis.diagnostics(file_id, snap.config.experimental_diagnostics)?;
|
||||
let diagnostics = snap.analysis.diagnostics(
|
||||
file_id,
|
||||
snap.config.experimental_diagnostics,
|
||||
snap.config.disabled_diagnostics(),
|
||||
)?;
|
||||
|
||||
for fix in diagnostics
|
||||
.into_iter()
|
||||
@@ -1049,7 +1053,11 @@ pub(crate) fn publish_diagnostics(
|
||||
let line_index = snap.analysis.file_line_index(file_id)?;
|
||||
let diagnostics: Vec<Diagnostic> = snap
|
||||
.analysis
|
||||
.diagnostics(file_id, snap.config.experimental_diagnostics)?
|
||||
.diagnostics(
|
||||
file_id,
|
||||
snap.config.experimental_diagnostics,
|
||||
snap.config.disabled_diagnostics(),
|
||||
)?
|
||||
.into_iter()
|
||||
.map(|d| Diagnostic {
|
||||
range: to_proto::range(&line_index, d.range),
|
||||
|
||||
Reference in New Issue
Block a user