diff options
author | veetaha <[email protected]> | 2020-05-23 02:58:22 +0100 |
---|---|---|
committer | veetaha <[email protected]> | 2020-05-31 01:10:23 +0100 |
commit | 030d78345fa79af07f8ebd89a9d244576fac992b (patch) | |
tree | 935da29fbb0418e8158e06f227f238bda13ee55f /crates | |
parent | 5f7225446e75509ae0d971a6f3e2b9d3e37d6f2a (diff) |
Fix invoking cargo without consulting CARGO or standard installation paths
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop/handlers.rs | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 65b487db3..2e49448cc 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml | |||
@@ -48,6 +48,7 @@ hir = { path = "../ra_hir", package = "ra_hir" } | |||
48 | hir_def = { path = "../ra_hir_def", package = "ra_hir_def" } | 48 | hir_def = { path = "../ra_hir_def", package = "ra_hir_def" } |
49 | hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" } | 49 | hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" } |
50 | ra_proc_macro_srv = { path = "../ra_proc_macro_srv" } | 50 | ra_proc_macro_srv = { path = "../ra_proc_macro_srv" } |
51 | ra_toolchain = { path = "../ra_toolchain" } | ||
51 | 52 | ||
52 | [target.'cfg(windows)'.dependencies] | 53 | [target.'cfg(windows)'.dependencies] |
53 | winapi = "0.3.8" | 54 | winapi = "0.3.8" |
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs index 1f910ff82..1b5b3325c 100644 --- a/crates/rust-analyzer/src/main_loop/handlers.rs +++ b/crates/rust-analyzer/src/main_loop/handlers.rs | |||
@@ -40,6 +40,7 @@ use crate::{ | |||
40 | world::WorldSnapshot, | 40 | world::WorldSnapshot, |
41 | LspError, Result, | 41 | LspError, Result, |
42 | }; | 42 | }; |
43 | use anyhow::Context; | ||
43 | 44 | ||
44 | pub fn handle_analyzer_status(world: WorldSnapshot, _: ()) -> Result<String> { | 45 | pub fn handle_analyzer_status(world: WorldSnapshot, _: ()) -> Result<String> { |
45 | let _p = profile("handle_analyzer_status"); | 46 | let _p = profile("handle_analyzer_status"); |
@@ -982,10 +983,15 @@ fn to_lsp_runnable( | |||
982 | target.map_or_else(|| "run binary".to_string(), |t| format!("run {}", t)) | 983 | target.map_or_else(|| "run binary".to_string(), |t| format!("run {}", t)) |
983 | } | 984 | } |
984 | }; | 985 | }; |
986 | let cargo_path = ra_toolchain::cargo() | ||
987 | .to_str() | ||
988 | .context("Path to cargo executable contains invalid UTF8 characters")? | ||
989 | .to_owned(); | ||
990 | |||
985 | Ok(lsp_ext::Runnable { | 991 | Ok(lsp_ext::Runnable { |
986 | range: to_proto::range(&line_index, runnable.range), | 992 | range: to_proto::range(&line_index, runnable.range), |
987 | label, | 993 | label, |
988 | bin: "cargo".to_string(), | 994 | bin: cargo_path, |
989 | args, | 995 | args, |
990 | extra_args, | 996 | extra_args, |
991 | env: { | 997 | env: { |