mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Address feedback from @DropDemBits
- move `edit.rename()` to the end of the function - use a match statement to set `res.command`
This commit is contained in:
parent
8efe8a8528
commit
bfa6a5ca84
3 changed files with 10 additions and 13 deletions
|
@ -135,7 +135,6 @@ pub(crate) fn extract_variable(acc: &mut Assists, ctx: &AssistContext<'_>) -> Op
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
edit.rename();
|
|
||||||
}
|
}
|
||||||
Anchor::Replace(stmt) => {
|
Anchor::Replace(stmt) => {
|
||||||
cov_mark::hit!(test_extract_var_expr_stmt);
|
cov_mark::hit!(test_extract_var_expr_stmt);
|
||||||
|
@ -150,7 +149,6 @@ pub(crate) fn extract_variable(acc: &mut Assists, ctx: &AssistContext<'_>) -> Op
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
edit.rename();
|
|
||||||
}
|
}
|
||||||
Anchor::WrapInBlock(to_wrap) => {
|
Anchor::WrapInBlock(to_wrap) => {
|
||||||
let indent_to = to_wrap.indent_level();
|
let indent_to = to_wrap.indent_level();
|
||||||
|
@ -194,12 +192,12 @@ pub(crate) fn extract_variable(acc: &mut Assists, ctx: &AssistContext<'_>) -> Op
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
edit.rename();
|
|
||||||
|
|
||||||
// fixup indentation of block
|
// fixup indentation of block
|
||||||
block.indent(indent_to);
|
block.indent(indent_to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
edit.rename();
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1128,7 +1128,7 @@ pub struct WorkspaceSymbolConfig {
|
||||||
/// How many items are returned at most.
|
/// How many items are returned at most.
|
||||||
pub search_limit: usize,
|
pub search_limit: usize,
|
||||||
}
|
}
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub struct ClientCommandsConfig {
|
pub struct ClientCommandsConfig {
|
||||||
pub run_single: bool,
|
pub run_single: bool,
|
||||||
pub debug_single: bool,
|
pub debug_single: bool,
|
||||||
|
|
|
@ -1336,15 +1336,14 @@ pub(crate) fn code_action(
|
||||||
command: None,
|
command: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
if assist.command == Some(assists::Command::TriggerSignatureHelp)
|
let commands = snap.config.client_commands();
|
||||||
&& snap.config.client_commands().trigger_parameter_hints
|
res.command = match assist.command {
|
||||||
{
|
Some(assists::Command::TriggerSignatureHelp) if commands.trigger_parameter_hints => {
|
||||||
res.command = Some(command::trigger_parameter_hints());
|
Some(command::trigger_parameter_hints())
|
||||||
} else if assist.command == Some(assists::Command::Rename)
|
|
||||||
&& snap.config.client_commands().rename
|
|
||||||
{
|
|
||||||
res.command = Some(command::rename());
|
|
||||||
}
|
}
|
||||||
|
Some(assists::Command::Rename) if commands.rename => Some(command::rename()),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
|
||||||
match (assist.source_change, resolve_data) {
|
match (assist.source_change, resolve_data) {
|
||||||
(Some(it), _) => res.edit = Some(snippet_workspace_edit(snap, it)?),
|
(Some(it), _) => res.edit = Some(snippet_workspace_edit(snap, it)?),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue