Skip to content

Commit 512295c

Browse files
committed
Fix the failing test for irrelevant vfs changes
1 parent 8177b17 commit 512295c

File tree

1 file changed

+18
-17
lines changed
  • crates/rust-analyzer/src/config

1 file changed

+18
-17
lines changed

crates/rust-analyzer/src/config/tree.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -280,39 +280,40 @@ impl ConfigDb {
280280
}
281281
}
282282

283+
for (file_id, parent) in parent_changes {
284+
self.ensure_node(file_id);
285+
let parent_node_id = match parent {
286+
ConfigParent::Parent(parent_file_id) => {
287+
self.ensure_node(parent_file_id);
288+
parent_file_id
289+
}
290+
ConfigParent::UserDefault if file_id == self.xdg_config_file_id => continue,
291+
ConfigParent::UserDefault => self.xdg_config_file_id,
292+
};
293+
self.set_parent(file_id, Some(parent_node_id))
294+
}
295+
283296
for change in ra_toml_changes {
297+
if !self.known_file_ids.contains(&change.file_id) {
298+
// Irrelevant Vfs change. Ideally you would not pass these in at all, but it's not
299+
// a problem to filter them out here.
300+
continue;
301+
}
284302
// turn and face the strain
285303
match change.change_kind {
286304
vfs::ChangeKind::Create | vfs::ChangeKind::Modify => {
287305
let input = parse_toml(change.file_id, vfs, &mut scratch_errors, &mut errors)
288306
.map(PointerCmp);
289307
tracing::trace!("updating toml for {:?} to {:?}", change.file_id, input);
290308

291-
self.ensure_node(change.file_id);
292309
self.set_config_input(change.file_id, input);
293310
}
294311
vfs::ChangeKind::Delete => {
295-
self.ensure_node(change.file_id);
296312
self.set_config_input(change.file_id, None);
297313
}
298314
}
299315
}
300316

301-
for (file_id, parent) in parent_changes {
302-
self.ensure_node(file_id);
303-
let parent_node_id = match parent {
304-
ConfigParent::Parent(parent_file_id) => {
305-
self.ensure_node(parent_file_id);
306-
parent_file_id
307-
}
308-
ConfigParent::UserDefault if file_id == self.xdg_config_file_id => continue,
309-
ConfigParent::UserDefault => self.xdg_config_file_id,
310-
};
311-
// order of children within the parent node does not matter
312-
tracing::trace!("appending child {file_id:?} to {parent_node_id:?}");
313-
self.set_parent(file_id, Some(parent_node_id))
314-
}
315-
316317
errors
317318
}
318319

0 commit comments

Comments
 (0)