mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Trigger VSCode to rename after extract variable assist is applied
When the user applies the "Extract Variable" assist, the cursor is positioned at the newly inserted variable. This commit adds a command to the assist that triggers the rename action in VSCode. This way, the user can quickly rename the variable after applying the assist. Fixes part of: #17579
This commit is contained in:
parent
5577e4e3b1
commit
8efe8a8528
17 changed files with 80 additions and 33 deletions
|
@ -98,7 +98,7 @@ fn quickfix_for_redundant_assoc_item(
|
|||
group: None,
|
||||
target: range,
|
||||
source_change: Some(source_change_builder.finish()),
|
||||
trigger_signature_help: false,
|
||||
command: None,
|
||||
}])
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ fn fixes(ctx: &DiagnosticsContext<'_>, d: &hir::TypedHole) -> Option<Vec<Assist>
|
|||
original_range.file_id,
|
||||
TextEdit::replace(original_range.range, code),
|
||||
)),
|
||||
trigger_signature_help: false,
|
||||
command: None,
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ fn add_variant_to_union(
|
|||
group: None,
|
||||
target: error_range.range,
|
||||
source_change: Some(src_change_builder.finish()),
|
||||
trigger_signature_help: false,
|
||||
command: None,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ fn add_field_to_struct_fix(
|
|||
group: None,
|
||||
target: error_range.range,
|
||||
source_change: Some(src_change_builder.finish()),
|
||||
trigger_signature_help: false,
|
||||
command: None,
|
||||
})
|
||||
}
|
||||
None => {
|
||||
|
@ -204,7 +204,7 @@ fn add_field_to_struct_fix(
|
|||
group: None,
|
||||
target: error_range.range,
|
||||
source_change: Some(src_change_builder.finish()),
|
||||
trigger_signature_help: false,
|
||||
command: None,
|
||||
})
|
||||
}
|
||||
Some(FieldList::TupleFieldList(_tuple)) => {
|
||||
|
@ -266,7 +266,7 @@ fn method_fix(
|
|||
file_id,
|
||||
TextEdit::insert(range.end(), "()".to_owned()),
|
||||
)),
|
||||
trigger_signature_help: false,
|
||||
command: None,
|
||||
})
|
||||
}
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -108,7 +108,7 @@ fn field_fix(
|
|||
(file_id, TextEdit::insert(range.start(), "(".to_owned())),
|
||||
(file_id, TextEdit::insert(range.end(), ")".to_owned())),
|
||||
])),
|
||||
trigger_signature_help: false,
|
||||
command: None,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ fn assoc_func_fix(ctx: &DiagnosticsContext<'_>, d: &hir::UnresolvedMethodCall) -
|
|||
file_id,
|
||||
TextEdit::replace(range, assoc_func_call_expr_string),
|
||||
)),
|
||||
trigger_signature_help: false,
|
||||
command: None,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -73,7 +73,7 @@ fn fixes(
|
|||
diagnostic_range.file_id,
|
||||
TextEdit::replace(name_range, format!("_{}", var_name.display(db))),
|
||||
)),
|
||||
trigger_signature_help: false,
|
||||
command: None,
|
||||
}])
|
||||
}
|
||||
|
||||
|
|
|
@ -613,7 +613,7 @@ fn unresolved_fix(id: &'static str, label: &str, target: TextRange) -> Assist {
|
|||
group: None,
|
||||
target,
|
||||
source_change: None,
|
||||
trigger_signature_help: false,
|
||||
command: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue