Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/load-cargo/src/lib.rs')
-rw-r--r--crates/load-cargo/src/lib.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/load-cargo/src/lib.rs b/crates/load-cargo/src/lib.rs
index 556ed73a04..e6ddfd580c 100644
--- a/crates/load-cargo/src/lib.rs
+++ b/crates/load-cargo/src/lib.rs
@@ -322,7 +322,7 @@ fn load_crate_graph(
break;
}
}
- vfs::loader::Message::Loaded { files } => {
+ vfs::loader::Message::Loaded { files } | vfs::loader::Message::Changed { files } => {
for (path, contents) in files {
vfs.set_file_contents(path.into(), contents);
}
@@ -331,9 +331,8 @@ fn load_crate_graph(
}
let changes = vfs.take_changes();
for file in changes {
- if file.exists() {
- let contents = vfs.file_contents(file.file_id);
- if let Ok(text) = std::str::from_utf8(contents) {
+ if let vfs::Change::Create(v) | vfs::Change::Modify(v) = file.change {
+ if let Ok(text) = std::str::from_utf8(&v) {
analysis_change.change_file(file.file_id, Some(text.into()))
}
}