diff options
author | Aleksey Kladov <[email protected]> | 2021-04-06 11:10:50 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-04-06 11:10:50 +0100 |
commit | e3c47ccefca2069da70a9513bc2b7f6fbd0f894c (patch) | |
tree | 05957628c651905e5a242aa355486f4009aa7453 /crates/rust-analyzer/src/main_loop.rs | |
parent | 3698b3eab870706e6db075b3dcae7f095086c18c (diff) |
Use autoreload config to gate execution rather that staleness
Diffstat (limited to 'crates/rust-analyzer/src/main_loop.rs')
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index ae364f862..7e96f3c4a 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -454,7 +454,9 @@ impl GlobalState { | |||
454 | } | 454 | } |
455 | } | 455 | } |
456 | 456 | ||
457 | self.fetch_workspaces_if_needed(); | 457 | if self.config.cargo_autoreload() { |
458 | self.fetch_workspaces_if_needed(); | ||
459 | } | ||
458 | self.fetch_build_data_if_needed(); | 460 | self.fetch_build_data_if_needed(); |
459 | 461 | ||
460 | let loop_duration = loop_start.elapsed(); | 462 | let loop_duration = loop_start.elapsed(); |
@@ -494,7 +496,10 @@ impl GlobalState { | |||
494 | } | 496 | } |
495 | 497 | ||
496 | RequestDispatcher { req: Some(req), global_state: self } | 498 | RequestDispatcher { req: Some(req), global_state: self } |
497 | .on_sync::<lsp_ext::ReloadWorkspace>(|s, ()| Ok(s.fetch_workspaces_request()))? | 499 | .on_sync::<lsp_ext::ReloadWorkspace>(|s, ()| { |
500 | self.fetch_workspaces_request(); | ||
501 | self.fetch_workspaces_if_needed(); | ||
502 | })? | ||
498 | .on_sync::<lsp_ext::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))? | 503 | .on_sync::<lsp_ext::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))? |
499 | .on_sync::<lsp_ext::OnEnter>(|s, p| handlers::handle_on_enter(s.snapshot(), p))? | 504 | .on_sync::<lsp_ext::OnEnter>(|s, p| handlers::handle_on_enter(s.snapshot(), p))? |
500 | .on_sync::<lsp_types::request::Shutdown>(|s, ()| { | 505 | .on_sync::<lsp_types::request::Shutdown>(|s, ()| { |