mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Edits with cursors
This commit is contained in:
parent
a7d31b55a4
commit
aa0d344581
5 changed files with 85 additions and 37 deletions
|
@ -187,12 +187,12 @@ pub fn handle_execute_command(
|
|||
let arg: ActionRequest = from_value(arg)?;
|
||||
let file_id = arg.text_document.try_conv_with(&path_map)?;
|
||||
let file = world.file_syntax(file_id)?;
|
||||
let edit = match arg.id {
|
||||
ActionId::FlipComma => libeditor::flip_comma(&file, arg.offset).map(|edit| edit()),
|
||||
ActionId::AddDerive => libeditor::add_derive(&file, arg.offset).map(|edit| edit()),
|
||||
let action_result = match arg.id {
|
||||
ActionId::FlipComma => libeditor::flip_comma(&file, arg.offset).map(|f| f()),
|
||||
ActionId::AddDerive => libeditor::add_derive(&file, arg.offset).map(|f| f()),
|
||||
};
|
||||
let edit = match edit {
|
||||
Some(edit) => edit,
|
||||
let edit = match action_result {
|
||||
Some(action_result) => action_result.edit,
|
||||
None => bail!("command not applicable"),
|
||||
};
|
||||
let line_index = world.file_line_index(file_id)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue