aboutsummaryrefslogtreecommitdiff
path: root/crates/server/src/main_loop/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/server/src/main_loop/mod.rs')
-rw-r--r--crates/server/src/main_loop/mod.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/crates/server/src/main_loop/mod.rs b/crates/server/src/main_loop/mod.rs
index 3d131274f..b66a24de1 100644
--- a/crates/server/src/main_loop/mod.rs
+++ b/crates/server/src/main_loop/mod.rs
@@ -32,6 +32,7 @@ enum Task {
32} 32}
33 33
34pub fn main_loop( 34pub fn main_loop(
35 internal_mode: bool,
35 root: PathBuf, 36 root: PathBuf,
36 msg_receriver: &mut Receiver<RawMessage>, 37 msg_receriver: &mut Receiver<RawMessage>,
37 msg_sender: &mut Sender<RawMessage>, 38 msg_sender: &mut Sender<RawMessage>,
@@ -47,6 +48,7 @@ pub fn main_loop(
47 let mut pending_requests = HashMap::new(); 48 let mut pending_requests = HashMap::new();
48 let mut subs = Subscriptions::new(); 49 let mut subs = Subscriptions::new();
49 let main_res = main_loop_inner( 50 let main_res = main_loop_inner(
51 internal_mode,
50 root, 52 root,
51 &pool, 53 &pool,
52 msg_sender, 54 msg_sender,
@@ -80,6 +82,7 @@ pub fn main_loop(
80} 82}
81 83
82fn main_loop_inner( 84fn main_loop_inner(
85 internal_mode: bool,
83 ws_root: PathBuf, 86 ws_root: PathBuf,
84 pool: &ThreadPool, 87 pool: &ThreadPool,
85 msg_sender: &mut Sender<RawMessage>, 88 msg_sender: &mut Sender<RawMessage>,
@@ -145,8 +148,7 @@ fn main_loop_inner(
145 match ws { 148 match ws {
146 Ok(ws) => { 149 Ok(ws) => {
147 let workspaces = vec![ws]; 150 let workspaces = vec![ws];
148 let not = RawNotification::new::<req::DidReloadWorkspace>(&workspaces); 151 feedback(internal_mode, "workspace loaded", msg_sender);
149 msg_sender.send(RawMessage::Notification(not));
150 for ws in workspaces.iter() { 152 for ws in workspaces.iter() {
151 for pkg in ws.packages().filter(|pkg| !pkg.is_member(ws)) { 153 for pkg in ws.packages().filter(|pkg| !pkg.is_member(ws)) {
152 debug!("sending root, {}", pkg.root(ws).to_path_buf().display()); 154 debug!("sending root, {}", pkg.root(ws).to_path_buf().display());
@@ -404,3 +406,11 @@ fn update_file_notifications_on_threadpool(
404 } 406 }
405 }); 407 });
406} 408}
409
410fn feedback(intrnal_mode: bool, msg: &str, sender: &Sender<RawMessage>) {
411 if !intrnal_mode {
412 return;
413 }
414 let not = RawNotification::new::<req::InternalFeedback>(&msg.to_string());
415 sender.send(RawMessage::Notification(not));
416}