From daca5a3711851db2a954646c6f7209be996144ff Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Mon, 13 Jan 2020 17:12:14 +0100 Subject: Defer cargo check until after workspace load --- crates/ra_cargo_watch/src/lib.rs | 13 +++++++++++-- crates/ra_lsp_server/src/main_loop.rs | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/ra_cargo_watch/src/lib.rs b/crates/ra_cargo_watch/src/lib.rs index cb0856aa4..20fa5a924 100644 --- a/crates/ra_cargo_watch/src/lib.rs +++ b/crates/ra_cargo_watch/src/lib.rs @@ -184,8 +184,13 @@ impl CheckWatcherState { workspace_root: PathBuf, shared: Arc>, ) -> CheckWatcherState { - let watcher = WatchThread::new(&options, &workspace_root); - CheckWatcherState { options, workspace_root, watcher, last_update_req: None, shared } + CheckWatcherState { + options, + workspace_root, + watcher: WatchThread::dummy(), + last_update_req: None, + shared, + } } fn run(&mut self, task_send: &Sender, cmd_recv: &Receiver) { @@ -313,6 +318,10 @@ enum CheckEvent { } impl WatchThread { + fn dummy() -> WatchThread { + WatchThread { handle: None, message_recv: never() } + } + fn new(options: &CheckOptions, workspace_root: &PathBuf) -> WatchThread { let mut args: Vec = vec![ options.command.clone(), diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 7a49cad86..844259796 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs @@ -416,6 +416,7 @@ fn loop_turn( if world_state.feature_flags().get("notifications.workspace-loaded") { let msg = format!("workspace loaded, {} rust packages", n_packages); show_message(req::MessageType::Info, msg, &connection.sender); + world_state.check_watcher.update(); } } -- cgit v1.2.3