From 00d927a1885ec2938d3365a8e136993445b437f5 Mon Sep 17 00:00:00 2001 From: David Wood Date: Tue, 5 Mar 2019 22:29:23 +0100 Subject: Initial implementation of project-lock.json. This commit adds a initial implementation of project-lock.json, a build system agnostic method of specifying the crate graph and roots. --- crates/ra_lsp_server/src/server_world.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'crates/ra_lsp_server/src/server_world.rs') diff --git a/crates/ra_lsp_server/src/server_world.rs b/crates/ra_lsp_server/src/server_world.rs index 4a68c019f..4625a26a7 100644 --- a/crates/ra_lsp_server/src/server_world.rs +++ b/crates/ra_lsp_server/src/server_world.rs @@ -40,12 +40,7 @@ impl ServerWorldState { let mut roots = Vec::new(); roots.push(root.clone()); for ws in workspaces.iter() { - for pkg in ws.cargo.packages() { - roots.push(pkg.root(&ws.cargo).to_path_buf()); - } - for krate in ws.sysroot.crates() { - roots.push(krate.root_dir(&ws.sysroot).to_path_buf()) - } + ws.add_roots(&mut roots); } let (mut vfs, roots) = Vfs::new(roots); let roots_to_scan = roots.len(); @@ -185,7 +180,7 @@ impl ServerWorld { } else { res.push_str("workspaces:\n"); for w in self.workspaces.iter() { - res += &format!("{} packages loaded\n", w.cargo.packages().count()); + res += &format!("{} packages loaded\n", w.count()); } } res.push_str("\nanalysis:\n"); -- cgit v1.2.3 From 614dd3c34721a4f97e8c4f1eb89aed4362338ebb Mon Sep 17 00:00:00 2001 From: David Wood Date: Thu, 7 Mar 2019 00:39:50 +0100 Subject: Rename and change `add_roots` to return a `Vec`. --- crates/ra_lsp_server/src/server_world.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_lsp_server/src/server_world.rs') diff --git a/crates/ra_lsp_server/src/server_world.rs b/crates/ra_lsp_server/src/server_world.rs index 4625a26a7..7163568b9 100644 --- a/crates/ra_lsp_server/src/server_world.rs +++ b/crates/ra_lsp_server/src/server_world.rs @@ -40,7 +40,7 @@ impl ServerWorldState { let mut roots = Vec::new(); roots.push(root.clone()); for ws in workspaces.iter() { - ws.add_roots(&mut roots); + roots.extend(ws.to_roots()); } let (mut vfs, roots) = Vfs::new(roots); let roots_to_scan = roots.len(); -- cgit v1.2.3