mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2026-03-15 20:07:55 +00:00
Merge pull request #21475 from lukasoyen/fix-flycheck-indexing
fix: lookup flycheck by ID instead of vector index
This commit is contained in:
commit
1cd5183e31
@ -387,14 +387,21 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool {
|
||||
} => false,
|
||||
});
|
||||
if let Some(idx) = package_workspace_idx {
|
||||
let workspace_deps =
|
||||
world.all_workspace_dependencies_for_package(&package);
|
||||
world.flycheck[idx].restart_for_package(
|
||||
package,
|
||||
target,
|
||||
workspace_deps,
|
||||
saved_file.clone(),
|
||||
);
|
||||
// flycheck handles are indexed by their ID (which is the workspace index),
|
||||
// but not all workspaces have flycheck enabled (e.g., JSON projects without
|
||||
// a flycheck template). Find the flycheck handle by its ID.
|
||||
if let Some(flycheck) =
|
||||
world.flycheck.iter().find(|fc| fc.id() == idx)
|
||||
{
|
||||
let workspace_deps =
|
||||
world.all_workspace_dependencies_for_package(&package);
|
||||
flycheck.restart_for_package(
|
||||
package,
|
||||
target,
|
||||
workspace_deps,
|
||||
saved_file.clone(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user