mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 13:18:47 +00:00
Merge pull request #18742 from Veykril/push-yswvkzmsvqql
fix: Fix flycheck workspace when requested but package was found
This commit is contained in:
commit
fa4a40bbe8
1 changed files with 7 additions and 7 deletions
|
@ -293,7 +293,6 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool {
|
||||||
let file_id = state.vfs.read().0.file_id(&vfs_path);
|
let file_id = state.vfs.read().0.file_id(&vfs_path);
|
||||||
if let Some(file_id) = file_id {
|
if let Some(file_id) = file_id {
|
||||||
let world = state.snapshot();
|
let world = state.snapshot();
|
||||||
let source_root_id = world.analysis.source_root_id(file_id).ok();
|
|
||||||
let may_flycheck_workspace = state.config.flycheck_workspace(None);
|
let may_flycheck_workspace = state.config.flycheck_workspace(None);
|
||||||
let mut updated = false;
|
let mut updated = false;
|
||||||
let task = move || -> std::result::Result<(), ide::Cancelled> {
|
let task = move || -> std::result::Result<(), ide::Cancelled> {
|
||||||
|
@ -376,16 +375,17 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool {
|
||||||
let saved_file = vfs_path.as_path().map(|p| p.to_owned());
|
let saved_file = vfs_path.as_path().map(|p| p.to_owned());
|
||||||
|
|
||||||
// Find and trigger corresponding flychecks
|
// Find and trigger corresponding flychecks
|
||||||
for flycheck in world.flycheck.iter() {
|
'flychecks: for flycheck in world.flycheck.iter() {
|
||||||
for (id, package) in workspace_ids.clone() {
|
for (id, package) in workspace_ids.clone() {
|
||||||
if id == flycheck.id() {
|
if id == flycheck.id() {
|
||||||
updated = true;
|
updated = true;
|
||||||
match package.filter(|_| !world.config.flycheck_workspace(source_root_id)) {
|
if may_flycheck_workspace {
|
||||||
Some(package) => flycheck
|
flycheck.restart_workspace(saved_file.clone())
|
||||||
.restart_for_package(package, target.clone().map(TupleExt::head)),
|
} else if let Some(package) = package {
|
||||||
None => flycheck.restart_workspace(saved_file.clone()),
|
flycheck
|
||||||
|
.restart_for_package(package, target.clone().map(TupleExt::head))
|
||||||
}
|
}
|
||||||
continue;
|
continue 'flychecks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue