aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main_loop.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-03-07 14:46:17 +0000
committerAleksey Kladov <[email protected]>2019-03-07 14:46:17 +0000
commit1aa11eb7e9a579abd2f47b6be61f983ef2bf2f38 (patch)
treee349e903732fe18a78a02f9bc98342c540fbec14 /crates/ra_lsp_server/src/main_loop.rs
parent5232099977d07492c1b6d5e6163c70d4f6eb07df (diff)
when loading workspace, say how many packages were loaded
this should help to debug configuration issues, when you see `0 packages loaded` or something like that.
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop.rs')
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index d0c2a95ef..eecf278a8 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -248,8 +248,10 @@ fn main_loop_inner(
248 && pending_libraries.is_empty() 248 && pending_libraries.is_empty()
249 && in_flight_libraries == 0 249 && in_flight_libraries == 0
250 { 250 {
251 let n_packages: usize = state.workspaces.iter().map(|it| it.count()).sum();
251 if options.show_workspace_loaded { 252 if options.show_workspace_loaded {
252 show_message(req::MessageType::Info, "workspace loaded", msg_sender); 253 let msg = format!("workspace loaded, {} rust packages", n_packages);
254 show_message(req::MessageType::Info, msg, msg_sender);
253 } 255 }
254 // Only send the notification first time 256 // Only send the notification first time
255 send_workspace_notification = false; 257 send_workspace_notification = false;
@@ -508,12 +510,10 @@ fn update_file_notifications_on_threadpool(
508 }); 510 });
509} 511}
510 512
511fn show_message<M: Into<String>>(typ: req::MessageType, msg: M, sender: &Sender<RawMessage>) { 513fn show_message(typ: req::MessageType, message: impl Into<String>, sender: &Sender<RawMessage>) {
512 let not = RawNotification::new::<req::ShowMessage>(&req::ShowMessageParams { 514 let message = message.into();
513 typ, 515 let params = req::ShowMessageParams { typ, message };
514 message: msg.into(), 516 let not = RawNotification::new::<req::ShowMessage>(&params);
515 });
516
517 sender.send(not.into()).unwrap(); 517 sender.send(not.into()).unwrap();
518} 518}
519 519