Skip to content

Commit 3345cd6

Browse files
committed
fix: Fix vscode workspaces not working properly
1 parent 8dd8c28 commit 3345cd6

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

crates/rust-analyzer/src/reload.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,17 @@ impl GlobalState {
215215
let mut i = 0;
216216
while i < workspaces.len() {
217217
if let Ok(w) = &workspaces[i] {
218-
if let Some(dupe) = workspaces[i + 1..]
218+
let dupes: Vec<_> = workspaces
219219
.iter()
220-
.filter_map(|it| it.as_ref().ok())
221-
.position(|ws| ws.eq_ignore_build_data(w))
222-
{
223-
_ = workspaces.remove(dupe);
224-
}
220+
.enumerate()
221+
.skip(i + 1)
222+
.filter_map(|(i, it)| {
223+
it.as_ref().ok().filter(|ws| ws.eq_ignore_build_data(w)).map(|_| i)
224+
})
225+
.collect();
226+
dupes.into_iter().rev().for_each(|d| {
227+
_ = workspaces.remove(d);
228+
});
225229
}
226230
i += 1;
227231
}

0 commit comments

Comments
 (0)