From 00e80b24e3a46b3c4a6411151132fccc539abd5f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 8 Nov 2018 18:43:02 +0300 Subject: workspace-symbols function for Emacs --- crates/ra_lsp_server/src/main_loop/mod.rs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'crates/ra_lsp_server/src/main_loop') diff --git a/crates/ra_lsp_server/src/main_loop/mod.rs b/crates/ra_lsp_server/src/main_loop/mod.rs index db878e0aa..78d93741a 100644 --- a/crates/ra_lsp_server/src/main_loop/mod.rs +++ b/crates/ra_lsp_server/src/main_loop/mod.rs @@ -48,6 +48,7 @@ enum Task { pub fn main_loop( internal_mode: bool, root: PathBuf, + publish_decorations: bool, msg_receiver: &Receiver, msg_sender: &Sender, ) -> Result<()> { @@ -67,6 +68,7 @@ pub fn main_loop( let mut subs = Subscriptions::new(); let main_res = main_loop_inner( internal_mode, + publish_decorations, root, &pool, msg_sender, @@ -99,6 +101,7 @@ pub fn main_loop( fn main_loop_inner( internal_mode: bool, + publish_decorations: bool, ws_root: PathBuf, pool: &ThreadPool, msg_sender: &Sender, @@ -210,6 +213,7 @@ fn main_loop_inner( update_file_notifications_on_threadpool( pool, state.snapshot(), + publish_decorations, task_sender.clone(), subs.subscriptions(), ) @@ -416,6 +420,7 @@ impl<'a> PoolDispatcher<'a> { fn update_file_notifications_on_threadpool( pool: &ThreadPool, world: ServerWorld, + publish_decorations: bool, sender: Sender, subscriptions: Vec, ) { @@ -432,15 +437,17 @@ fn update_file_notifications_on_threadpool( sender.send(Task::Notify(not)); } } - match handlers::publish_decorations(&world, file_id) { - Err(e) => { - if !is_canceled(&e) { - error!("failed to compute decorations: {:?}", e); + if publish_decorations { + match handlers::publish_decorations(&world, file_id) { + Err(e) => { + if !is_canceled(&e) { + error!("failed to compute decorations: {:?}", e); + } + } + Ok(params) => { + let not = RawNotification::new::(¶ms); + sender.send(Task::Notify(not)) } - } - Ok(params) => { - let not = RawNotification::new::(¶ms); - sender.send(Task::Notify(not)) } } } -- cgit v1.2.3