diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_lsp_server/src/project_model.rs | 10 |
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 | } |