diff options
author | Pascal Kuthe | 2022-10-13 18:10:10 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-10-21 01:03:00 +0000 |
commit | 189aa0bfcfb6841ced946289e112cc9cdd4919a5 (patch) | |
tree | 21ea62e50048de9faad3877c4cc9d3627096352f /helix-term/src/commands | |
parent | dc3527f52df27ae20294ca14bac60994725519aa (diff) |
never sort menu items when no fuzzy matching is possible
Diffstat (limited to 'helix-term/src/commands')
-rw-r--r-- | helix-term/src/commands/lsp.rs | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index ecaab169..100fa196 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -490,35 +490,34 @@ pub fn code_action(cx: &mut Context) { _ => 7, }); - let mut picker = - ui::Menu::new(actions, false, (), move |editor, code_action, event| { - if event != PromptEvent::Validate { - return; - } + let mut picker = ui::Menu::new(actions, (), move |editor, code_action, event| { + if event != PromptEvent::Validate { + return; + } - // always present here - let code_action = code_action.unwrap(); + // always present here + let code_action = code_action.unwrap(); - match code_action { - lsp::CodeActionOrCommand::Command(command) => { - log::debug!("code action command: {:?}", command); - execute_lsp_command(editor, command.clone()); + match code_action { + lsp::CodeActionOrCommand::Command(command) => { + log::debug!("code action command: {:?}", command); + execute_lsp_command(editor, command.clone()); + } + lsp::CodeActionOrCommand::CodeAction(code_action) => { + log::debug!("code action: {:?}", code_action); + if let Some(ref workspace_edit) = code_action.edit { + log::debug!("edit: {:?}", workspace_edit); + apply_workspace_edit(editor, offset_encoding, workspace_edit); } - lsp::CodeActionOrCommand::CodeAction(code_action) => { - log::debug!("code action: {:?}", code_action); - if let Some(ref workspace_edit) = code_action.edit { - log::debug!("edit: {:?}", workspace_edit); - apply_workspace_edit(editor, offset_encoding, workspace_edit); - } - // if code action provides both edit and command first the edit - // should be applied and then the command - if let Some(command) = &code_action.command { - execute_lsp_command(editor, command.clone()); - } + // if code action provides both edit and command first the edit + // should be applied and then the command + if let Some(command) = &code_action.command { + execute_lsp_command(editor, command.clone()); } } - }); + } + }); picker.move_down(); // pre-select the first item let popup = Popup::new("code-action", picker); |