aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorvsrs <[email protected]>2020-05-14 14:02:01 +0100
committervsrs <[email protected]>2020-05-14 14:02:01 +0100
commit20fdd14c62aa9c5327f1e6afc04f01a5af6763fb (patch)
tree162fc72991b2ed514be0649f027ba577a4b5ba80 /crates
parent5f6cdae18f415b9af3b3d24234ab2943efb30993 (diff)
Multiple binaries support for launch.json.
Generate unique names on the LSP side.
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/main_loop/handlers.rs5
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 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),