From 7c7cfc5f04c51ed1e31b6a3091efc3941b3383c2 Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Sat, 13 Apr 2019 19:45:21 +0200 Subject: Sends cwd info for runnables and code lenses --- crates/ra_lsp_server/src/main_loop/handlers.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crates/ra_lsp_server/src/main_loop') diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index b96deb061..41d1f759f 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -263,6 +263,7 @@ pub fn handle_runnables( let line_index = world.analysis().file_line_index(file_id); let offset = params.position.map(|it| it.conv_with(&line_index)); let mut res = Vec::new(); + let workspace_root = world.workspace_root_for(file_id); for runnable in world.analysis().runnables(file_id)? { if let Some(offset) = offset { if !runnable.range.contains_inclusive(offset) { @@ -287,6 +288,7 @@ pub fn handle_runnables( m.insert("RUST_BACKTRACE".to_string(), "short".to_string()); m }, + cwd: workspace_root.map(|root| root.to_string_lossy().to_string()), }; res.push(r); } @@ -309,6 +311,7 @@ pub fn handle_runnables( bin: "cargo".to_string(), args: check_args, env: FxHashMap::default(), + cwd: workspace_root.map(|root| root.to_string_lossy().to_string()), }); Ok(res) } @@ -627,6 +630,7 @@ pub fn handle_code_lens( let line_index = world.analysis().file_line_index(file_id); let mut lenses: Vec = Default::default(); + let workspace_root = world.workspace_root_for(file_id); // Gather runnables for runnable in world.analysis().runnables(file_id)? { @@ -647,6 +651,7 @@ pub fn handle_code_lens( bin: "cargo".into(), args, env: Default::default(), + cwd: workspace_root.map(|root| root.to_string_lossy().to_string()), }; let lens = CodeLens { -- cgit v1.2.3