diff options
Diffstat (limited to 'crates/vfs/src')
-rw-r--r-- | crates/vfs/src/lib.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/vfs/src/lib.rs b/crates/vfs/src/lib.rs index a3be579a7..9cf2afd33 100644 --- a/crates/vfs/src/lib.rs +++ b/crates/vfs/src/lib.rs | |||
@@ -103,18 +103,19 @@ impl Vfs { | |||
103 | (file_id, path) | 103 | (file_id, path) |
104 | }) | 104 | }) |
105 | } | 105 | } |
106 | pub fn set_file_contents(&mut self, path: VfsPath, contents: Option<Vec<u8>>) { | 106 | pub fn set_file_contents(&mut self, path: VfsPath, contents: Option<Vec<u8>>) -> bool { |
107 | let file_id = self.alloc_file_id(path); | 107 | let file_id = self.alloc_file_id(path); |
108 | let change_kind = match (&self.get(file_id), &contents) { | 108 | let change_kind = match (&self.get(file_id), &contents) { |
109 | (None, None) => return, | 109 | (None, None) => return false, |
110 | (None, Some(_)) => ChangeKind::Create, | 110 | (None, Some(_)) => ChangeKind::Create, |
111 | (Some(_), None) => ChangeKind::Delete, | 111 | (Some(_), None) => ChangeKind::Delete, |
112 | (Some(old), Some(new)) if old == new => return, | 112 | (Some(old), Some(new)) if old == new => return false, |
113 | (Some(_), Some(_)) => ChangeKind::Modify, | 113 | (Some(_), Some(_)) => ChangeKind::Modify, |
114 | }; | 114 | }; |
115 | 115 | ||
116 | *self.get_mut(file_id) = contents; | 116 | *self.get_mut(file_id) = contents; |
117 | self.changes.push(ChangedFile { file_id, change_kind }) | 117 | self.changes.push(ChangedFile { file_id, change_kind }); |
118 | true | ||
118 | } | 119 | } |
119 | pub fn has_changes(&self) -> bool { | 120 | pub fn has_changes(&self) -> bool { |
120 | !self.changes.is_empty() | 121 | !self.changes.is_empty() |