Unnamed repository; edit this file 'description' to name the repository.
Add dynamic assistant description
A4-Tacks 6 months ago
parent 8549afe · commit 180a5e2
-rw-r--r--crates/ide-assists/src/handlers/convert_range_for_to_while.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ide-assists/src/handlers/convert_range_for_to_while.rs b/crates/ide-assists/src/handlers/convert_range_for_to_while.rs
index 16f9b4c411..68cb764030 100644
--- a/crates/ide-assists/src/handlers/convert_range_for_to_while.rs
+++ b/crates/ide-assists/src/handlers/convert_range_for_to_while.rs
@@ -43,9 +43,14 @@ pub(crate) fn convert_range_for_to_while(acc: &mut Assists, ctx: &AssistContext<
let body = for_.loop_body()?;
let last = previous_non_trivia_token(body.stmt_list()?.r_curly_token()?)?;
+ let description = if end.is_some() {
+ "Replace with while expression"
+ } else {
+ "Replace with loop expression"
+ };
acc.add(
AssistId::refactor("convert_range_for_to_while"),
- "Replace to while or loop",
+ description,
for_.syntax().text_range(),
|builder| {
let mut edit = builder.make_editor(for_.syntax());