diff options
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop.rs | 10 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/world.rs | 6 |
2 files changed, 9 insertions, 7 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 81fd08c91..dda318e43 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs | |||
@@ -305,7 +305,6 @@ fn loop_turn( | |||
305 | log::info!("queued count = {}", queue_count); | 305 | log::info!("queued count = {}", queue_count); |
306 | } | 306 | } |
307 | 307 | ||
308 | let mut state_changed = false; | ||
309 | match event { | 308 | match event { |
310 | Event::Task(task) => { | 309 | Event::Task(task) => { |
311 | on_task(task, &connection.sender, &mut loop_state.pending_requests, world_state); | 310 | on_task(task, &connection.sender, &mut loop_state.pending_requests, world_state); |
@@ -313,7 +312,6 @@ fn loop_turn( | |||
313 | } | 312 | } |
314 | Event::Vfs(task) => { | 313 | Event::Vfs(task) => { |
315 | world_state.vfs.write().handle_task(task); | 314 | world_state.vfs.write().handle_task(task); |
316 | state_changed = true; | ||
317 | } | 315 | } |
318 | Event::Lib(lib) => { | 316 | Event::Lib(lib) => { |
319 | world_state.add_lib(lib); | 317 | world_state.add_lib(lib); |
@@ -338,7 +336,6 @@ fn loop_turn( | |||
338 | &mut loop_state.subscriptions, | 336 | &mut loop_state.subscriptions, |
339 | not, | 337 | not, |
340 | )?; | 338 | )?; |
341 | state_changed = true; | ||
342 | } | 339 | } |
343 | Message::Response(resp) => { | 340 | Message::Response(resp) => { |
344 | let removed = loop_state.pending_responses.remove(&resp.id); | 341 | let removed = loop_state.pending_responses.remove(&resp.id); |
@@ -349,7 +346,12 @@ fn loop_turn( | |||
349 | }, | 346 | }, |
350 | }; | 347 | }; |
351 | 348 | ||
352 | loop_state.pending_libraries.extend(world_state.process_changes()); | 349 | let mut state_changed = false; |
350 | if let Some(changes) = world_state.process_changes() { | ||
351 | state_changed = true; | ||
352 | loop_state.pending_libraries.extend(changes); | ||
353 | } | ||
354 | |||
353 | while loop_state.in_flight_libraries < MAX_IN_FLIGHT_LIBS | 355 | while loop_state.in_flight_libraries < MAX_IN_FLIGHT_LIBS |
354 | && !loop_state.pending_libraries.is_empty() | 356 | && !loop_state.pending_libraries.is_empty() |
355 | { | 357 | { |
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs index 5e53b0278..79431e7e6 100644 --- a/crates/ra_lsp_server/src/world.rs +++ b/crates/ra_lsp_server/src/world.rs | |||
@@ -145,10 +145,10 @@ impl WorldState { | |||
145 | /// FIXME: better API here | 145 | /// FIXME: better API here |
146 | pub fn process_changes( | 146 | pub fn process_changes( |
147 | &mut self, | 147 | &mut self, |
148 | ) -> Vec<(SourceRootId, Vec<(FileId, RelativePathBuf, Arc<String>)>)> { | 148 | ) -> Option<Vec<(SourceRootId, Vec<(FileId, RelativePathBuf, Arc<String>)>)>> { |
149 | let changes = self.vfs.write().commit_changes(); | 149 | let changes = self.vfs.write().commit_changes(); |
150 | if changes.is_empty() { | 150 | if changes.is_empty() { |
151 | return Vec::new(); | 151 | return None; |
152 | } | 152 | } |
153 | let mut libs = Vec::new(); | 153 | let mut libs = Vec::new(); |
154 | let mut change = AnalysisChange::new(); | 154 | let mut change = AnalysisChange::new(); |
@@ -182,7 +182,7 @@ impl WorldState { | |||
182 | } | 182 | } |
183 | } | 183 | } |
184 | self.analysis_host.apply_change(change); | 184 | self.analysis_host.apply_change(change); |
185 | libs | 185 | Some(libs) |
186 | } | 186 | } |
187 | 187 | ||
188 | pub fn add_lib(&mut self, data: LibraryData) { | 188 | pub fn add_lib(&mut self, data: LibraryData) { |