diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-25 11:13:37 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-08-25 11:13:37 +0100 |
commit | 1fbe5ffba8fdcdb47a53a06f2fd6a5fd8fc99bf3 (patch) | |
tree | fd0c5fbdd6fd1647737478b0d50c81591cd00a87 /crates/ra_lsp_server/src | |
parent | cd433ed194f7d3570c2bee2e5ac01917513e8aa3 (diff) | |
parent | ee932d464b2c15b9c130e734a01fc50e5a18d106 (diff) |
Merge #1735
1735: :arrow_up: vfs r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop.rs | 2 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/world.rs | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index ce25ff162..45bd52769 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs | |||
@@ -217,7 +217,7 @@ fn main_loop_inner( | |||
217 | Err(RecvError) => Err("client exited without shutdown")?, | 217 | Err(RecvError) => Err("client exited without shutdown")?, |
218 | }, | 218 | }, |
219 | recv(task_receiver) -> task => Event::Task(task.unwrap()), | 219 | recv(task_receiver) -> task => Event::Task(task.unwrap()), |
220 | recv(state.vfs.read().task_receiver()) -> task => match task { | 220 | recv(state.task_receiver) -> task => match task { |
221 | Ok(task) => Event::Vfs(task), | 221 | Ok(task) => Event::Vfs(task), |
222 | Err(RecvError) => Err("vfs died")?, | 222 | Err(RecvError) => Err("vfs died")?, |
223 | }, | 223 | }, |
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs index 6696dff71..cc7964469 100644 --- a/crates/ra_lsp_server/src/world.rs +++ b/crates/ra_lsp_server/src/world.rs | |||
@@ -3,6 +3,7 @@ use std::{ | |||
3 | sync::Arc, | 3 | sync::Arc, |
4 | }; | 4 | }; |
5 | 5 | ||
6 | use crossbeam_channel::{unbounded, Receiver}; | ||
6 | use gen_lsp_server::ErrorCode; | 7 | use gen_lsp_server::ErrorCode; |
7 | use lsp_types::Url; | 8 | use lsp_types::Url; |
8 | use parking_lot::RwLock; | 9 | use parking_lot::RwLock; |
@@ -10,7 +11,7 @@ use ra_ide_api::{ | |||
10 | Analysis, AnalysisChange, AnalysisHost, CrateGraph, FeatureFlags, FileId, LibraryData, | 11 | Analysis, AnalysisChange, AnalysisHost, CrateGraph, FeatureFlags, FileId, LibraryData, |
11 | SourceRootId, | 12 | SourceRootId, |
12 | }; | 13 | }; |
13 | use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsRoot}; | 14 | use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsRoot, VfsTask}; |
14 | use ra_vfs_glob::{Glob, RustPackageFilterBuilder}; | 15 | use ra_vfs_glob::{Glob, RustPackageFilterBuilder}; |
15 | use relative_path::RelativePathBuf; | 16 | use relative_path::RelativePathBuf; |
16 | 17 | ||
@@ -39,6 +40,7 @@ pub struct WorldState { | |||
39 | pub workspaces: Arc<Vec<ProjectWorkspace>>, | 40 | pub workspaces: Arc<Vec<ProjectWorkspace>>, |
40 | pub analysis_host: AnalysisHost, | 41 | pub analysis_host: AnalysisHost, |
41 | pub vfs: Arc<RwLock<Vfs>>, | 42 | pub vfs: Arc<RwLock<Vfs>>, |
43 | pub task_receiver: Receiver<VfsTask>, | ||
42 | pub latest_requests: Arc<RwLock<LatestRequests>>, | 44 | pub latest_requests: Arc<RwLock<LatestRequests>>, |
43 | } | 45 | } |
44 | 46 | ||
@@ -80,8 +82,9 @@ impl WorldState { | |||
80 | RootEntry::new(pkg_root.path().clone(), filter.into_vfs_filter()) | 82 | RootEntry::new(pkg_root.path().clone(), filter.into_vfs_filter()) |
81 | })); | 83 | })); |
82 | } | 84 | } |
83 | 85 | let (task_sender, task_receiver) = unbounded(); | |
84 | let (mut vfs, vfs_roots) = Vfs::new(roots); | 86 | let task_sender = Box::new(move |t| task_sender.send(t).unwrap()); |
87 | let (mut vfs, vfs_roots) = Vfs::new(roots, task_sender); | ||
85 | let roots_to_scan = vfs_roots.len(); | 88 | let roots_to_scan = vfs_roots.len(); |
86 | for r in vfs_roots { | 89 | for r in vfs_roots { |
87 | let vfs_root_path = vfs.root2path(r); | 90 | let vfs_root_path = vfs.root2path(r); |
@@ -109,6 +112,7 @@ impl WorldState { | |||
109 | workspaces: Arc::new(workspaces), | 112 | workspaces: Arc::new(workspaces), |
110 | analysis_host, | 113 | analysis_host, |
111 | vfs: Arc::new(RwLock::new(vfs)), | 114 | vfs: Arc::new(RwLock::new(vfs)), |
115 | task_receiver, | ||
112 | latest_requests: Default::default(), | 116 | latest_requests: Default::default(), |
113 | } | 117 | } |
114 | } | 118 | } |