Be more lenient when dealing with rust-analyzer's flycheck commands (#36782)

Flycheck commands are global and makes sense to fall back to looking up
project's rust-analyzer even if the commands are run on a non-rust
buffer. If multiple rust-analyzers are found in the project, avoid
ambiguous commands and bail (as before).

Closes #ISSUE

Release Notes:

- Made it possible to run rust-analyzer's flycheck actions from anywhere
in the project
This commit is contained in:
Kirill Bulatov 2025-08-23 01:55:50 +03:00 committed by GitHub
parent 153724aad3
commit d24cad30f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 114 additions and 64 deletions

View file

@ -438,7 +438,7 @@ impl ProjectDiagnosticsEditor {
for buffer_path in diagnostics_sources.iter().cloned() {
if cx
.update(|cx| {
fetch_tasks.push(run_flycheck(project.clone(), buffer_path, cx));
fetch_tasks.push(run_flycheck(project.clone(), Some(buffer_path), cx));
})
.is_err()
{
@ -462,7 +462,7 @@ impl ProjectDiagnosticsEditor {
.iter()
.cloned()
{
cancel_gasks.push(cancel_flycheck(self.project.clone(), buffer_path, cx));
cancel_gasks.push(cancel_flycheck(self.project.clone(), Some(buffer_path), cx));
}
self.cargo_diagnostics_fetch.cancel_task = Some(cx.background_spawn(async move {