aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cargo_watch/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-03-30 13:45:49 +0100
committerGitHub <[email protected]>2020-03-30 13:45:49 +0100
commit671926ac93f0ff921758a919eaf87c056979189f (patch)
tree111c2cc751cb7fcca38eb7518e1d39af394ee243 /crates/ra_cargo_watch/src
parent9e12b9e6fdc03ea6bc35a88cfb5d5d6751672ec8 (diff)
parent4c897d8d2dd047e0906d585318866c9ae7a21610 (diff)
Merge #3666
3666: Reload part of the server configuration without restarts r=matklad a=SomeoneToIgnore Partially addresses https://github.com/rust-analyzer/rust-analyzer/issues/2857 Closes #3751 Reloads all server configuration that's not related to VFS without restarts. The VFS-related parameters are not considered, since VFS is planned to be rewritten/replaced in the future and I have a suspicion that with the current code, swapping the VFS and the file watchers on the fly will cause big troubles. I have to store and process the config request id separately, since the `workspace/configuration` response returns `any[]` (https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_configuration), if there's a better way to handle those responses, let me know. Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates/ra_cargo_watch/src')
-rw-r--r--crates/ra_cargo_watch/src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/ra_cargo_watch/src/lib.rs b/crates/ra_cargo_watch/src/lib.rs
index c67ec39d4..2692c1bf5 100644
--- a/crates/ra_cargo_watch/src/lib.rs
+++ b/crates/ra_cargo_watch/src/lib.rs
@@ -95,6 +95,9 @@ impl CheckWatcherThread {
95 } 95 }
96 96
97 fn run(&mut self, task_send: &Sender<CheckTask>, cmd_recv: &Receiver<CheckCommand>) { 97 fn run(&mut self, task_send: &Sender<CheckTask>, cmd_recv: &Receiver<CheckCommand>) {
98 // If we rerun the thread, we need to discard the previous check results first
99 self.clean_previous_results(task_send);
100
98 loop { 101 loop {
99 select! { 102 select! {
100 recv(&cmd_recv) -> cmd => match cmd { 103 recv(&cmd_recv) -> cmd => match cmd {
@@ -127,6 +130,13 @@ impl CheckWatcherThread {
127 } 130 }
128 } 131 }
129 132
133 fn clean_previous_results(&self, task_send: &Sender<CheckTask>) {
134 task_send.send(CheckTask::ClearDiagnostics).unwrap();
135 task_send
136 .send(CheckTask::Status(WorkDoneProgress::End(WorkDoneProgressEnd { message: None })))
137 .unwrap();
138 }
139
130 fn should_recheck(&mut self) -> bool { 140 fn should_recheck(&mut self) -> bool {
131 if let Some(_last_update_req) = &self.last_update_req { 141 if let Some(_last_update_req) = &self.last_update_req {
132 // We currently only request an update on save, as we need up to 142 // We currently only request an update on save, as we need up to