aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2019-08-09 21:34:14 +0100
committerKirill Bulatov <[email protected]>2019-08-09 21:34:14 +0100
commit2c5c35bdae374b655489477280906b76fffc6a2a (patch)
treef83e82ab5b291cdadff0ed461ebb64050737de11
parent726535a44e2b5d6a6efb1b220edf7b82cdf27d32 (diff)
Always set the runnable name
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index fca5700a6..4ac051c96 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -325,13 +325,7 @@ pub fn handle_runnables(
325 continue; 325 continue;
326 } 326 }
327 } 327 }
328 let label = match &runnable.kind { 328 res.push(to_lsp_runnable(&world, file_id, runnable)?);
329 RunnableKind::Test { name } => format!("test {}", name),
330 RunnableKind::TestMod { path } => format!("test-mod {}", path),
331 RunnableKind::Bench { name } => format!("bench {}", name),
332 RunnableKind::Bin => "run binary".to_string(),
333 };
334 res.push(to_lsp_runnable(&world, file_id, runnable, label)?);
335 } 329 }
336 let mut check_args = vec!["check".to_string()]; 330 let mut check_args = vec!["check".to_string()];
337 let label; 331 let label;
@@ -686,12 +680,13 @@ pub fn handle_code_lens(
686 RunnableKind::Test { .. } | RunnableKind::TestMod { .. } => "▶️Run Test", 680 RunnableKind::Test { .. } | RunnableKind::TestMod { .. } => "▶️Run Test",
687 RunnableKind::Bench { .. } => "Run Bench", 681 RunnableKind::Bench { .. } => "Run Bench",
688 RunnableKind::Bin => "Run", 682 RunnableKind::Bin => "Run",
689 }; 683 }
690 let r = to_lsp_runnable(&world, file_id, runnable, title.to_string())?; 684 .to_string();
685 let r = to_lsp_runnable(&world, file_id, runnable)?;
691 let lens = CodeLens { 686 let lens = CodeLens {
692 range: r.range, 687 range: r.range,
693 command: Some(Command { 688 command: Some(Command {
694 title: title.to_string(), 689 title,
695 command: "rust-analyzer.runSingle".into(), 690 command: "rust-analyzer.runSingle".into(),
696 arguments: Some(vec![to_value(r).unwrap()]), 691 arguments: Some(vec![to_value(r).unwrap()]),
697 }), 692 }),
@@ -830,10 +825,15 @@ fn to_lsp_runnable(
830 world: &WorldSnapshot, 825 world: &WorldSnapshot,
831 file_id: FileId, 826 file_id: FileId,
832 runnable: Runnable, 827 runnable: Runnable,
833 label: String,
834) -> Result<req::Runnable> { 828) -> Result<req::Runnable> {
835 let args = runnable_args(world, file_id, &runnable.kind)?; 829 let args = runnable_args(world, file_id, &runnable.kind)?;
836 let line_index = world.analysis().file_line_index(file_id)?; 830 let line_index = world.analysis().file_line_index(file_id)?;
831 let label = match &runnable.kind {
832 RunnableKind::Test { name } => format!("test {}", name),
833 RunnableKind::TestMod { path } => format!("test-mod {}", path),
834 RunnableKind::Bench { name } => format!("bench {}", name),
835 RunnableKind::Bin => "run binary".to_string(),
836 };
837 Ok(req::Runnable { 837 Ok(req::Runnable {
838 range: runnable.range.conv_with(&line_index), 838 range: runnable.range.conv_with(&line_index),
839 label, 839 label,