diff options
Diffstat (limited to 'crates/server/src/server_world.rs')
-rw-r--r-- | crates/server/src/server_world.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/server/src/server_world.rs b/crates/server/src/server_world.rs index f78b56cf8..95c109e10 100644 --- a/crates/server/src/server_world.rs +++ b/crates/server/src/server_world.rs | |||
@@ -47,7 +47,6 @@ impl ServerWorldState { | |||
47 | .map(|event| { | 47 | .map(|event| { |
48 | let text = match event.kind { | 48 | let text = match event.kind { |
49 | FileEventKind::Add(text) => Some(text), | 49 | FileEventKind::Add(text) => Some(text), |
50 | FileEventKind::Remove => None, | ||
51 | }; | 50 | }; |
52 | (event.path, text) | 51 | (event.path, text) |
53 | }) | 52 | }) |
@@ -65,6 +64,18 @@ impl ServerWorldState { | |||
65 | 64 | ||
66 | self.analysis_host.change_files(changes); | 65 | self.analysis_host.change_files(changes); |
67 | } | 66 | } |
67 | pub fn add_library(&mut self, events: Vec<FileEvent>) { | ||
68 | let pm = &mut self.path_map; | ||
69 | let files = events.into_iter() | ||
70 | .map(|event| { | ||
71 | let text = match event.kind { | ||
72 | FileEventKind::Add(text) => text, | ||
73 | }; | ||
74 | (event.path, text) | ||
75 | }) | ||
76 | .map(|(path, text)| (pm.get_or_insert(path), text)); | ||
77 | self.analysis_host.add_library(files); | ||
78 | } | ||
68 | 79 | ||
69 | pub fn add_mem_file(&mut self, path: PathBuf, text: String) -> FileId { | 80 | pub fn add_mem_file(&mut self, path: PathBuf, text: String) -> FileId { |
70 | let file_id = self.path_map.get_or_insert(path); | 81 | let file_id = self.path_map.get_or_insert(path); |