diff options
author | Emil Lauridsen <[email protected]> | 2019-12-25 11:21:38 +0000 |
---|---|---|
committer | Emil Lauridsen <[email protected]> | 2019-12-25 16:37:40 +0000 |
commit | 66e8ef53a0ed018d03340577a0443030a193f773 (patch) | |
tree | ce35fbd25ac7bb3b7374dccbb79d89545d9904a7 /crates/ra_lsp_server/src/world.rs | |
parent | 52b44ba7edbdb64a30b781292eaaea59e8c2490d (diff) |
Initial implementation of cargo check watching
Diffstat (limited to 'crates/ra_lsp_server/src/world.rs')
-rw-r--r-- | crates/ra_lsp_server/src/world.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs index 79431e7e6..8e9380ca0 100644 --- a/crates/ra_lsp_server/src/world.rs +++ b/crates/ra_lsp_server/src/world.rs | |||
@@ -24,6 +24,7 @@ use std::path::{Component, Prefix}; | |||
24 | 24 | ||
25 | use crate::{ | 25 | use crate::{ |
26 | main_loop::pending_requests::{CompletedRequest, LatestRequests}, | 26 | main_loop::pending_requests::{CompletedRequest, LatestRequests}, |
27 | cargo_check::{CheckWatcher, CheckWatcherSharedState}, | ||
27 | LspError, Result, | 28 | LspError, Result, |
28 | }; | 29 | }; |
29 | use std::str::FromStr; | 30 | use std::str::FromStr; |
@@ -52,6 +53,7 @@ pub struct WorldState { | |||
52 | pub vfs: Arc<RwLock<Vfs>>, | 53 | pub vfs: Arc<RwLock<Vfs>>, |
53 | pub task_receiver: Receiver<VfsTask>, | 54 | pub task_receiver: Receiver<VfsTask>, |
54 | pub latest_requests: Arc<RwLock<LatestRequests>>, | 55 | pub latest_requests: Arc<RwLock<LatestRequests>>, |
56 | pub check_watcher: CheckWatcher, | ||
55 | } | 57 | } |
56 | 58 | ||
57 | /// An immutable snapshot of the world's state at a point in time. | 59 | /// An immutable snapshot of the world's state at a point in time. |
@@ -61,6 +63,7 @@ pub struct WorldSnapshot { | |||
61 | pub analysis: Analysis, | 63 | pub analysis: Analysis, |
62 | pub vfs: Arc<RwLock<Vfs>>, | 64 | pub vfs: Arc<RwLock<Vfs>>, |
63 | pub latest_requests: Arc<RwLock<LatestRequests>>, | 65 | pub latest_requests: Arc<RwLock<LatestRequests>>, |
66 | pub check_watcher: Arc<RwLock<CheckWatcherSharedState>>, | ||
64 | } | 67 | } |
65 | 68 | ||
66 | impl WorldState { | 69 | impl WorldState { |
@@ -127,6 +130,9 @@ impl WorldState { | |||
127 | } | 130 | } |
128 | change.set_crate_graph(crate_graph); | 131 | change.set_crate_graph(crate_graph); |
129 | 132 | ||
133 | // FIXME: Figure out the multi-workspace situation | ||
134 | let check_watcher = CheckWatcher::new(folder_roots.first().cloned().unwrap()); | ||
135 | |||
130 | let mut analysis_host = AnalysisHost::new(lru_capacity, feature_flags); | 136 | let mut analysis_host = AnalysisHost::new(lru_capacity, feature_flags); |
131 | analysis_host.apply_change(change); | 137 | analysis_host.apply_change(change); |
132 | WorldState { | 138 | WorldState { |
@@ -138,6 +144,7 @@ impl WorldState { | |||
138 | vfs: Arc::new(RwLock::new(vfs)), | 144 | vfs: Arc::new(RwLock::new(vfs)), |
139 | task_receiver, | 145 | task_receiver, |
140 | latest_requests: Default::default(), | 146 | latest_requests: Default::default(), |
147 | check_watcher, | ||
141 | } | 148 | } |
142 | } | 149 | } |
143 | 150 | ||
@@ -199,6 +206,7 @@ impl WorldState { | |||
199 | analysis: self.analysis_host.analysis(), | 206 | analysis: self.analysis_host.analysis(), |
200 | vfs: Arc::clone(&self.vfs), | 207 | vfs: Arc::clone(&self.vfs), |
201 | latest_requests: Arc::clone(&self.latest_requests), | 208 | latest_requests: Arc::clone(&self.latest_requests), |
209 | check_watcher: self.check_watcher.shared.clone(), | ||
202 | } | 210 | } |
203 | } | 211 | } |
204 | 212 | ||