diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/src/main_loop/handlers.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs index 8d7baa14f..6b14830b6 100644 --- a/crates/rust-analyzer/src/main_loop/handlers.rs +++ b/crates/rust-analyzer/src/main_loop/handlers.rs | |||
@@ -1011,6 +1011,7 @@ fn to_lsp_runnable( | |||
1011 | runnable: Runnable, | 1011 | runnable: Runnable, |
1012 | ) -> Result<lsp_ext::Runnable> { | 1012 | ) -> Result<lsp_ext::Runnable> { |
1013 | let spec = CargoTargetSpec::for_file(world, file_id)?; | 1013 | let spec = CargoTargetSpec::for_file(world, file_id)?; |
1014 | let target = spec.as_ref().map(|s| s.target.clone()); | ||
1014 | let (args, extra_args) = CargoTargetSpec::runnable_args(spec, &runnable.kind)?; | 1015 | let (args, extra_args) = CargoTargetSpec::runnable_args(spec, &runnable.kind)?; |
1015 | let line_index = world.analysis().file_line_index(file_id)?; | 1016 | let line_index = world.analysis().file_line_index(file_id)?; |
1016 | let label = match &runnable.kind { | 1017 | let label = match &runnable.kind { |
@@ -1018,7 +1019,9 @@ fn to_lsp_runnable( | |||
1018 | RunnableKind::TestMod { path } => format!("test-mod {}", path), | 1019 | RunnableKind::TestMod { path } => format!("test-mod {}", path), |
1019 | RunnableKind::Bench { test_id } => format!("bench {}", test_id), | 1020 | RunnableKind::Bench { test_id } => format!("bench {}", test_id), |
1020 | RunnableKind::DocTest { test_id, .. } => format!("doctest {}", test_id), | 1021 | RunnableKind::DocTest { test_id, .. } => format!("doctest {}", test_id), |
1021 | RunnableKind::Bin => "run binary".to_string(), | 1022 | RunnableKind::Bin => { |
1023 | target.map_or_else(|| "run binary".to_string(), |t| format!("run {}", t)) | ||
1024 | } | ||
1022 | }; | 1025 | }; |
1023 | Ok(lsp_ext::Runnable { | 1026 | Ok(lsp_ext::Runnable { |
1024 | range: to_proto::range(&line_index, runnable.range), | 1027 | range: to_proto::range(&line_index, runnable.range), |