aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/project_model
diff options
context:
space:
mode:
authorDJMcNab <[email protected]>2019-01-26 20:16:15 +0000
committerDJMcNab <[email protected]>2019-01-26 20:16:15 +0000
commit632b0f290232913ef9950ee46917d5c195193102 (patch)
treebe26fe86b87105ca64505e37e0b42824a0414dce /crates/ra_lsp_server/src/project_model
parentd0ef1bde893bb46f0c7f9cab34706713169adb49 (diff)
Use the correct working directory for cargo metadata and rustfmt
Diffstat (limited to 'crates/ra_lsp_server/src/project_model')
-rw-r--r--crates/ra_lsp_server/src/project_model/cargo_workspace.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/ra_lsp_server/src/project_model/cargo_workspace.rs b/crates/ra_lsp_server/src/project_model/cargo_workspace.rs
index 75ae78bca..8cf99d586 100644
--- a/crates/ra_lsp_server/src/project_model/cargo_workspace.rs
+++ b/crates/ra_lsp_server/src/project_model/cargo_workspace.rs
@@ -117,9 +117,13 @@ impl Target {
117 117
118impl CargoWorkspace { 118impl CargoWorkspace {
119 pub fn from_cargo_metadata(cargo_toml: &Path) -> Result<CargoWorkspace> { 119 pub fn from_cargo_metadata(cargo_toml: &Path) -> Result<CargoWorkspace> {
120 let meta = MetadataCommand::new() 120 let mut meta = MetadataCommand::new();
121 .manifest_path(cargo_toml) 121 meta.manifest_path(cargo_toml)
122 .features(CargoOpt::AllFeatures) 122 .features(CargoOpt::AllFeatures);
123 if let Some(parent) = cargo_toml.parent() {
124 meta.current_dir(parent);
125 }
126 let meta = meta
123 .exec() 127 .exec()
124 .map_err(|e| format_err!("cargo metadata failed: {}", e))?; 128 .map_err(|e| format_err!("cargo metadata failed: {}", e))?;
125 let mut pkg_by_id = FxHashMap::default(); 129 let mut pkg_by_id = FxHashMap::default();