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:
Josh McKinney 2024-07-13 19:33:35 -07:00
parent 8efe8a8528
commit bfa6a5ca84
No known key found for this signature in database
GPG key ID: 722287396A903BC5
3 changed files with 10 additions and 13 deletions

View file

@ -1128,7 +1128,7 @@ pub struct WorkspaceSymbolConfig {
/// How many items are returned at most.
pub search_limit: usize,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct ClientCommandsConfig {
pub run_single: bool,
pub debug_single: bool,

View file

@ -1336,15 +1336,14 @@ pub(crate) fn code_action(
command: None,
};
if assist.command == Some(assists::Command::TriggerSignatureHelp)
&& snap.config.client_commands().trigger_parameter_hints
{
res.command = Some(command::trigger_parameter_hints());
} else if assist.command == Some(assists::Command::Rename)
&& snap.config.client_commands().rename
{
res.command = Some(command::rename());
}
let commands = snap.config.client_commands();
res.command = match assist.command {
Some(assists::Command::TriggerSignatureHelp) if commands.trigger_parameter_hints => {
Some(command::trigger_parameter_hints())
}
Some(assists::Command::Rename) if commands.rename => Some(command::rename()),
_ => None,
};
match (assist.source_change, resolve_data) {
(Some(it), _) => res.edit = Some(snippet_workspace_edit(snap, it)?),