aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main_loop
diff options
context:
space:
mode:
authorRoberto Vidal <[email protected]>2019-04-13 18:45:21 +0100
committerRoberto Vidal <[email protected]>2019-04-14 09:04:38 +0100
commit7c7cfc5f04c51ed1e31b6a3091efc3941b3383c2 (patch)
tree0bc4d2f3afefb504509676388016da52598fe1dd /crates/ra_lsp_server/src/main_loop
parent3507bcb97aaaafba10d55c101bd295f3ab4fed4f (diff)
Sends cwd info for runnables and code lenses
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop')
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs5
1 files changed, 5 insertions, 0 deletions
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(
263 let line_index = world.analysis().file_line_index(file_id); 263 let line_index = world.analysis().file_line_index(file_id);
264 let offset = params.position.map(|it| it.conv_with(&line_index)); 264 let offset = params.position.map(|it| it.conv_with(&line_index));
265 let mut res = Vec::new(); 265 let mut res = Vec::new();
266 let workspace_root = world.workspace_root_for(file_id);
266 for runnable in world.analysis().runnables(file_id)? { 267 for runnable in world.analysis().runnables(file_id)? {
267 if let Some(offset) = offset { 268 if let Some(offset) = offset {
268 if !runnable.range.contains_inclusive(offset) { 269 if !runnable.range.contains_inclusive(offset) {
@@ -287,6 +288,7 @@ pub fn handle_runnables(
287 m.insert("RUST_BACKTRACE".to_string(), "short".to_string()); 288 m.insert("RUST_BACKTRACE".to_string(), "short".to_string());
288 m 289 m
289 }, 290 },
291 cwd: workspace_root.map(|root| root.to_string_lossy().to_string()),
290 }; 292 };
291 res.push(r); 293 res.push(r);
292 } 294 }
@@ -309,6 +311,7 @@ pub fn handle_runnables(
309 bin: "cargo".to_string(), 311 bin: "cargo".to_string(),
310 args: check_args, 312 args: check_args,
311 env: FxHashMap::default(), 313 env: FxHashMap::default(),
314 cwd: workspace_root.map(|root| root.to_string_lossy().to_string()),
312 }); 315 });
313 Ok(res) 316 Ok(res)
314} 317}
@@ -627,6 +630,7 @@ pub fn handle_code_lens(
627 let line_index = world.analysis().file_line_index(file_id); 630 let line_index = world.analysis().file_line_index(file_id);
628 631
629 let mut lenses: Vec<CodeLens> = Default::default(); 632 let mut lenses: Vec<CodeLens> = Default::default();
633 let workspace_root = world.workspace_root_for(file_id);
630 634
631 // Gather runnables 635 // Gather runnables
632 for runnable in world.analysis().runnables(file_id)? { 636 for runnable in world.analysis().runnables(file_id)? {
@@ -647,6 +651,7 @@ pub fn handle_code_lens(
647 bin: "cargo".into(), 651 bin: "cargo".into(),
648 args, 652 args,
649 env: Default::default(), 653 env: Default::default(),
654 cwd: workspace_root.map(|root| root.to_string_lossy().to_string()),
650 }; 655 };
651 656
652 let lens = CodeLens { 657 let lens = CodeLens {