diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-31 14:15:34 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-31 14:15:34 +0000 |
commit | 2a65020442142b68b32c0a97672faeeba5ff399e (patch) | |
tree | 32791da6860ea906017a8d30157baedc08bee484 /crates/ra_lsp_server/src | |
parent | 700b334a28b73133a25416319475eafe3ec11f90 (diff) | |
parent | 05daa86634b41aa3f311a1ac0b02bf7fed7ed569 (diff) |
Merge #165
165: Make modules with tests runnable r=farodin91 a=farodin91
Fixes #154
I having problems to traverse the path to module. The main problem is that module_tree only supports `FileId` and not `Module` in files. Any idea?
I need to clean up the code a bit later.
Co-authored-by: Jan Jansen <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 10 |
1 files changed, 10 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 012f74270..11825d74e 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -256,6 +256,7 @@ pub fn handle_runnables( | |||
256 | range: runnable.range.conv_with(&line_index), | 256 | range: runnable.range.conv_with(&line_index), |
257 | label: match &runnable.kind { | 257 | label: match &runnable.kind { |
258 | RunnableKind::Test { name } => format!("test {}", name), | 258 | RunnableKind::Test { name } => format!("test {}", name), |
259 | RunnableKind::TestMod { path } => format!("test-mod {}", path), | ||
259 | RunnableKind::Bin => "run binary".to_string(), | 260 | RunnableKind::Bin => "run binary".to_string(), |
260 | }, | 261 | }, |
261 | bin: "cargo".to_string(), | 262 | bin: "cargo".to_string(), |
@@ -307,6 +308,15 @@ pub fn handle_runnables( | |||
307 | res.push(name.to_string()); | 308 | res.push(name.to_string()); |
308 | res.push("--nocapture".to_string()); | 309 | res.push("--nocapture".to_string()); |
309 | } | 310 | } |
311 | RunnableKind::TestMod { path } => { | ||
312 | res.push("test".to_string()); | ||
313 | if let Some(spec) = spec { | ||
314 | spec.push_to(&mut res); | ||
315 | } | ||
316 | res.push("--".to_string()); | ||
317 | res.push(path.to_string()); | ||
318 | res.push("--nocapture".to_string()); | ||
319 | } | ||
310 | RunnableKind::Bin => { | 320 | RunnableKind::Bin => { |
311 | res.push("run".to_string()); | 321 | res.push("run".to_string()); |
312 | if let Some(spec) = spec { | 322 | if let Some(spec) = spec { |