diff options
Diffstat (limited to 'crates/ra_lsp_server/src/server_world.rs')
-rw-r--r-- | crates/ra_lsp_server/src/server_world.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/crates/ra_lsp_server/src/server_world.rs b/crates/ra_lsp_server/src/server_world.rs index 76c76766d..2debbe557 100644 --- a/crates/ra_lsp_server/src/server_world.rs +++ b/crates/ra_lsp_server/src/server_world.rs | |||
@@ -15,7 +15,7 @@ use parking_lot::RwLock; | |||
15 | use failure::format_err; | 15 | use failure::format_err; |
16 | 16 | ||
17 | use crate::{ | 17 | use crate::{ |
18 | project_model::{CargoWorkspace, TargetKind}, | 18 | project_model::{ProjectWorkspace, TargetKind}, |
19 | Result, | 19 | Result, |
20 | }; | 20 | }; |
21 | 21 | ||
@@ -23,26 +23,26 @@ use crate::{ | |||
23 | pub struct ServerWorldState { | 23 | pub struct ServerWorldState { |
24 | pub roots_to_scan: usize, | 24 | pub roots_to_scan: usize, |
25 | pub root: PathBuf, | 25 | pub root: PathBuf, |
26 | pub workspaces: Arc<Vec<CargoWorkspace>>, | 26 | pub workspaces: Arc<Vec<ProjectWorkspace>>, |
27 | pub analysis_host: AnalysisHost, | 27 | pub analysis_host: AnalysisHost, |
28 | pub vfs: Arc<RwLock<Vfs>>, | 28 | pub vfs: Arc<RwLock<Vfs>>, |
29 | } | 29 | } |
30 | 30 | ||
31 | pub struct ServerWorld { | 31 | pub struct ServerWorld { |
32 | pub workspaces: Arc<Vec<CargoWorkspace>>, | 32 | pub workspaces: Arc<Vec<ProjectWorkspace>>, |
33 | pub analysis: Analysis, | 33 | pub analysis: Analysis, |
34 | pub vfs: Arc<RwLock<Vfs>>, | 34 | pub vfs: Arc<RwLock<Vfs>>, |
35 | } | 35 | } |
36 | 36 | ||
37 | impl ServerWorldState { | 37 | impl ServerWorldState { |
38 | pub fn new(root: PathBuf, workspaces: Vec<CargoWorkspace>) -> ServerWorldState { | 38 | pub fn new(root: PathBuf, workspaces: Vec<ProjectWorkspace>) -> ServerWorldState { |
39 | let mut change = AnalysisChange::new(); | 39 | let mut change = AnalysisChange::new(); |
40 | 40 | ||
41 | let mut roots = Vec::new(); | 41 | let mut roots = Vec::new(); |
42 | roots.push(root.clone()); | 42 | roots.push(root.clone()); |
43 | for ws in workspaces.iter() { | 43 | for ws in workspaces.iter() { |
44 | for pkg in ws.packages() { | 44 | for pkg in ws.cargo.packages() { |
45 | roots.push(pkg.root(&ws).to_path_buf()); | 45 | roots.push(pkg.root(&ws.cargo).to_path_buf()); |
46 | } | 46 | } |
47 | } | 47 | } |
48 | let roots_to_scan = roots.len(); | 48 | let roots_to_scan = roots.len(); |
@@ -56,13 +56,13 @@ impl ServerWorldState { | |||
56 | let mut pkg_to_lib_crate = FxHashMap::default(); | 56 | let mut pkg_to_lib_crate = FxHashMap::default(); |
57 | let mut pkg_crates = FxHashMap::default(); | 57 | let mut pkg_crates = FxHashMap::default(); |
58 | for ws in workspaces.iter() { | 58 | for ws in workspaces.iter() { |
59 | for pkg in ws.packages() { | 59 | for pkg in ws.cargo.packages() { |
60 | for tgt in pkg.targets(ws) { | 60 | for tgt in pkg.targets(&ws.cargo) { |
61 | let root = tgt.root(ws); | 61 | let root = tgt.root(&ws.cargo); |
62 | if let Some(file_id) = vfs.load(root) { | 62 | if let Some(file_id) = vfs.load(root) { |
63 | let file_id = FileId(file_id.0.into()); | 63 | let file_id = FileId(file_id.0.into()); |
64 | let crate_id = crate_graph.add_crate_root(file_id); | 64 | let crate_id = crate_graph.add_crate_root(file_id); |
65 | if tgt.kind(ws) == TargetKind::Lib { | 65 | if tgt.kind(&ws.cargo) == TargetKind::Lib { |
66 | pkg_to_lib_crate.insert(pkg, crate_id); | 66 | pkg_to_lib_crate.insert(pkg, crate_id); |
67 | } | 67 | } |
68 | pkg_crates | 68 | pkg_crates |
@@ -72,8 +72,8 @@ impl ServerWorldState { | |||
72 | } | 72 | } |
73 | } | 73 | } |
74 | } | 74 | } |
75 | for pkg in ws.packages() { | 75 | for pkg in ws.cargo.packages() { |
76 | for dep in pkg.dependencies(ws) { | 76 | for dep in pkg.dependencies(&ws.cargo) { |
77 | if let Some(&to) = pkg_to_lib_crate.get(&dep.pkg) { | 77 | if let Some(&to) = pkg_to_lib_crate.get(&dep.pkg) { |
78 | for &from in pkg_crates.get(&pkg).into_iter().flatten() { | 78 | for &from in pkg_crates.get(&pkg).into_iter().flatten() { |
79 | crate_graph.add_dep(from, dep.name.clone(), to); | 79 | crate_graph.add_dep(from, dep.name.clone(), to); |