mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Always set the runnable name
This commit is contained in:
parent
726535a44e
commit
2c5c35bdae
1 changed files with 11 additions and 11 deletions
|
@ -325,13 +325,7 @@ pub fn handle_runnables(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let label = match &runnable.kind {
|
res.push(to_lsp_runnable(&world, file_id, runnable)?);
|
||||||
RunnableKind::Test { name } => format!("test {}", name),
|
|
||||||
RunnableKind::TestMod { path } => format!("test-mod {}", path),
|
|
||||||
RunnableKind::Bench { name } => format!("bench {}", name),
|
|
||||||
RunnableKind::Bin => "run binary".to_string(),
|
|
||||||
};
|
|
||||||
res.push(to_lsp_runnable(&world, file_id, runnable, label)?);
|
|
||||||
}
|
}
|
||||||
let mut check_args = vec!["check".to_string()];
|
let mut check_args = vec!["check".to_string()];
|
||||||
let label;
|
let label;
|
||||||
|
@ -686,12 +680,13 @@ pub fn handle_code_lens(
|
||||||
RunnableKind::Test { .. } | RunnableKind::TestMod { .. } => "▶️Run Test",
|
RunnableKind::Test { .. } | RunnableKind::TestMod { .. } => "▶️Run Test",
|
||||||
RunnableKind::Bench { .. } => "Run Bench",
|
RunnableKind::Bench { .. } => "Run Bench",
|
||||||
RunnableKind::Bin => "Run",
|
RunnableKind::Bin => "Run",
|
||||||
};
|
}
|
||||||
let r = to_lsp_runnable(&world, file_id, runnable, title.to_string())?;
|
.to_string();
|
||||||
|
let r = to_lsp_runnable(&world, file_id, runnable)?;
|
||||||
let lens = CodeLens {
|
let lens = CodeLens {
|
||||||
range: r.range,
|
range: r.range,
|
||||||
command: Some(Command {
|
command: Some(Command {
|
||||||
title: title.to_string(),
|
title,
|
||||||
command: "rust-analyzer.runSingle".into(),
|
command: "rust-analyzer.runSingle".into(),
|
||||||
arguments: Some(vec![to_value(r).unwrap()]),
|
arguments: Some(vec![to_value(r).unwrap()]),
|
||||||
}),
|
}),
|
||||||
|
@ -830,10 +825,15 @@ fn to_lsp_runnable(
|
||||||
world: &WorldSnapshot,
|
world: &WorldSnapshot,
|
||||||
file_id: FileId,
|
file_id: FileId,
|
||||||
runnable: Runnable,
|
runnable: Runnable,
|
||||||
label: String,
|
|
||||||
) -> Result<req::Runnable> {
|
) -> Result<req::Runnable> {
|
||||||
let args = runnable_args(world, file_id, &runnable.kind)?;
|
let args = runnable_args(world, file_id, &runnable.kind)?;
|
||||||
let line_index = world.analysis().file_line_index(file_id)?;
|
let line_index = world.analysis().file_line_index(file_id)?;
|
||||||
|
let label = match &runnable.kind {
|
||||||
|
RunnableKind::Test { name } => format!("test {}", name),
|
||||||
|
RunnableKind::TestMod { path } => format!("test-mod {}", path),
|
||||||
|
RunnableKind::Bench { name } => format!("bench {}", name),
|
||||||
|
RunnableKind::Bin => "run binary".to_string(),
|
||||||
|
};
|
||||||
Ok(req::Runnable {
|
Ok(req::Runnable {
|
||||||
range: runnable.range.conv_with(&line_index),
|
range: runnable.range.conv_with(&line_index),
|
||||||
label,
|
label,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue