aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/server/src/server_world.rs47
1 files changed, 24 insertions, 23 deletions
diff --git a/crates/server/src/server_world.rs b/crates/server/src/server_world.rs
index ffa0e74b8..6853efc00 100644
--- a/crates/server/src/server_world.rs
+++ b/crates/server/src/server_world.rs
@@ -39,30 +39,31 @@ impl ServerWorldState {
39 mem_map: HashMap::new(), 39 mem_map: HashMap::new(),
40 } 40 }
41 } 41 }
42
43 pub fn apply_fs_changes(&mut self, events: Vec<FileEvent>) { 42 pub fn apply_fs_changes(&mut self, events: Vec<FileEvent>) {
44 let pm = &mut self.path_map; 43 {
45 let mm = &mut self.mem_map; 44 let pm = &mut self.path_map;
46 let changes = events.into_iter() 45 let mm = &mut self.mem_map;
47 .map(|event| { 46 let changes = events.into_iter()
48 let text = match event.kind { 47 .map(|event| {
49 FileEventKind::Add(text) => Some(text), 48 let text = match event.kind {
50 }; 49 FileEventKind::Add(text) => Some(text),
51 (event.path, text) 50 };
52 }) 51 (event.path, text)
53 .map(|(path, text)| { 52 })
54 (pm.get_or_insert(path, Root::Workspace), text) 53 .map(|(path, text)| {
55 }) 54 (pm.get_or_insert(path, Root::Workspace), text)
56 .filter_map(|(id, text)| { 55 })
57 if mm.contains_key(&id) { 56 .filter_map(|(id, text)| {
58 mm.insert(id, text); 57 if mm.contains_key(&id) {
59 None 58 mm.insert(id, text);
60 } else { 59 None
61 Some((id, text)) 60 } else {
62 } 61 Some((id, text))
63 }); 62 }
64 63 });
65 self.analysis_host.change_files(changes); 64 self.analysis_host.change_files(changes);
65 }
66 self.analysis_host.set_file_resolver(Arc::new(self.path_map.clone()));
66 } 67 }
67 pub fn events_to_files(&mut self, events: Vec<FileEvent>) -> (Vec<(FileId, String)>, Arc<FileResolver>) { 68 pub fn events_to_files(&mut self, events: Vec<FileEvent>) -> (Vec<(FileId, String)>, Arc<FileResolver>) {
68 let files = { 69 let files = {