aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-12-08 18:54:00 +0000
committerAleksey Kladov <[email protected]>2018-12-09 10:33:16 +0000
commit32c067f8c9aec56bb502c5a569884679bae27af3 (patch)
tree1e6eb59bdc6eac574a0982b507824b382adb7388 /crates/ra_lsp_server/src
parent34956b7823d72467fbf4fa62bd4413dfb680f78d (diff)
track deps in project model
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r--crates/ra_lsp_server/src/project_model.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/ra_lsp_server/src/project_model.rs b/crates/ra_lsp_server/src/project_model.rs
index 3305d468a..22495f49c 100644
--- a/crates/ra_lsp_server/src/project_model.rs
+++ b/crates/ra_lsp_server/src/project_model.rs
@@ -28,6 +28,7 @@ struct PackageData {
28 manifest: PathBuf, 28 manifest: PathBuf,
29 targets: Vec<Target>, 29 targets: Vec<Target>,
30 is_member: bool, 30 is_member: bool,
31 dependencies: Vec<Package>,
31} 32}
32 33
33#[derive(Debug, Clone)] 34#[derive(Debug, Clone)]
@@ -106,6 +107,7 @@ impl CargoWorkspace {
106 manifest: PathBuf::from(meta_pkg.manifest_path), 107 manifest: PathBuf::from(meta_pkg.manifest_path),
107 targets: Vec::new(), 108 targets: Vec::new(),
108 is_member, 109 is_member,
110 dependencies: Vec::new(),
109 }; 111 };
110 for meta_tgt in meta_pkg.targets { 112 for meta_tgt in meta_pkg.targets {
111 let tgt = Target(targets.len()); 113 let tgt = Target(targets.len());
@@ -119,6 +121,14 @@ impl CargoWorkspace {
119 } 121 }
120 packages.push(pkg_data) 122 packages.push(pkg_data)
121 } 123 }
124 let resolve = meta.resolve.expect("metadata executed with deps");
125 for node in resolve.nodes {
126 let source = pkg_by_id[&node.id];
127 for id in node.dependencies {
128 let target = pkg_by_id[&id];
129 packages[source.0].dependencies.push(target);
130 }
131 }
122 132
123 Ok(CargoWorkspace { packages, targets }) 133 Ok(CargoWorkspace { packages, targets })
124 } 134 }