From 6857989f6f5c399857cddd54598eb2c8cb427e26 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 9 Dec 2020 17:29:34 +0100 Subject: Fix "no value set for FileTextQuery(FileId(..))" --- crates/vfs/src/lib.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'crates/vfs') diff --git a/crates/vfs/src/lib.rs b/crates/vfs/src/lib.rs index cdf6f1fd0..a2c6a3400 100644 --- a/crates/vfs/src/lib.rs +++ b/crates/vfs/src/lib.rs @@ -99,18 +99,19 @@ impl Vfs { (file_id, path) }) } - pub fn set_file_contents(&mut self, path: VfsPath, contents: Option>) { + pub fn set_file_contents(&mut self, path: VfsPath, contents: Option>) -> bool { let file_id = self.alloc_file_id(path); let change_kind = match (&self.get(file_id), &contents) { - (None, None) => return, + (None, None) => return false, (None, Some(_)) => ChangeKind::Create, (Some(_), None) => ChangeKind::Delete, - (Some(old), Some(new)) if old == new => return, + (Some(old), Some(new)) if old == new => return false, (Some(_), Some(_)) => ChangeKind::Modify, }; *self.get_mut(file_id) = contents; - self.changes.push(ChangedFile { file_id, change_kind }) + self.changes.push(ChangedFile { file_id, change_kind }); + true } pub fn has_changes(&self) -> bool { !self.changes.is_empty() -- cgit v1.2.3