aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/rust-analyzer/src/main_loop/handlers.rs5
-rw-r--r--editors/code/src/debug.ts5
2 files changed, 7 insertions, 3 deletions
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs
index be8688bc3..76ed6f29a 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 binary '{}'", 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),
diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts
index 966019883..1f93a2b7e 100644
--- a/editors/code/src/debug.ts
+++ b/editors/code/src/debug.ts
@@ -88,8 +88,9 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom
88 } 88 }
89 89
90 if (debugConfig.name === "run binary") { 90 if (debugConfig.name === "run binary") {
91 // A workaround for multiple binaries. It would be better to get proper names on the LSP side. 91 // The LSP side: crates\rust-analyzer\src\main_loop\handlers.rs,
92 debugConfig.name = `run binary [${path.basename(executable)}]`; 92 // fn to_lsp_runnable(...) with RunnableKind::Bin
93 debugConfig.name = `run binary '${path.basename(executable)}'`;
93 } 94 }
94 95
95 if (debugConfig.cwd) { 96 if (debugConfig.cwd) {