mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Move target to AssistLabel
Target is used for assists sorting, so we need it before we compute the action.
This commit is contained in:
parent
ede8906844
commit
233f01c9ba
36 changed files with 288 additions and 252 deletions
|
@ -57,9 +57,9 @@ pub(crate) fn add_function(ctx: AssistCtx) -> Option<Assist> {
|
|||
|
||||
let function_builder = FunctionBuilder::from_call(&ctx, &call, &path, target_module)?;
|
||||
|
||||
ctx.add_assist(AssistId("add_function"), "Add function", |edit| {
|
||||
edit.target(call.syntax().text_range());
|
||||
|
||||
let target = call.syntax().text_range();
|
||||
// TODO: assert here?
|
||||
ctx.add_assist(AssistId("add_function"), "Add function", target, |edit| {
|
||||
if let Some(function_template) = function_builder.render() {
|
||||
edit.set_file(function_template.file);
|
||||
edit.set_cursor(function_template.cursor_offset);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue