Skip to content

Commit

Permalink
Merge pull request #18742 from Veykril/push-yswvkzmsvqql
Browse files Browse the repository at this point in the history
fix: Fix flycheck workspace when requested but package was found
  • Loading branch information
Veykril authored Dec 22, 2024
2 parents 68acbb2 + 4a86434 commit fa4a40b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/rust-analyzer/src/handlers/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
if let Some(file_id) = file_id {
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 mut updated = false;
let task = move || -> std::result::Result<(), ide::Cancelled> {
Expand Down Expand Up @@ -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());

// 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() {
if id == flycheck.id() {
updated = true;
match package.filter(|_| !world.config.flycheck_workspace(source_root_id)) {
Some(package) => flycheck
.restart_for_package(package, target.clone().map(TupleExt::head)),
None => flycheck.restart_workspace(saved_file.clone()),
if may_flycheck_workspace {
flycheck.restart_workspace(saved_file.clone())
} else if let Some(package) = package {
flycheck
.restart_for_package(package, target.clone().map(TupleExt::head))
}
continue;
continue 'flychecks;
}
}
}
Expand Down

0 comments on commit fa4a40b

Please sign in to comment.