diff options
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 22 |
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, |