@@ -3494,47 +3494,48 @@ pub fn code_action(cx: &mut Context) {
3494 move |editor: &mut Editor,
3494 move |editor: &mut Editor,
3495 compositor: &mut Compositor,
3495 compositor: &mut Compositor,
3496 response: Option<lsp::CodeActionResponse>| {
3496 response: Option<lsp::CodeActionResponse>| {
3497− if let Some(actions) = response {
3497+ let actions = match response {
3498− if actions.is_empty() {
3501+ if actions.is_empty() {
3499− editor.set_status("No code actions available".to_owned());
3502+ editor.set_status("No code actions available".to_owned());
3506+ let picker = ui::Menu::new(actions, move |editor, code_action, event| {
3507+ if event != PromptEvent::Validate {
3503− let picker = ui::Menu::new(actions, move |editor, code_action, event| {
3504− if event != PromptEvent::Validate {
3508− // always present here
3511+ // always present here
3509− let code_action = code_action.unwrap();
3512+ let code_action = code_action.unwrap();
3511− match code_action {
3514+ match code_action {
3512− lsp::CodeActionOrCommand::Command(command) => {
3515+ lsp::CodeActionOrCommand::Command(command) => {
3513− log::debug!("code action command: {:?}", command);
3516+ log::debug!("code action command: {:?}", command);
3514− execute_lsp_command(editor, command.clone());
3517+ execute_lsp_command(editor, command.clone());
3519+ lsp::CodeActionOrCommand::CodeAction(code_action) => {
3520+ log::debug!("code action: {:?}", code_action);
3521+ if let Some(ref workspace_edit) = code_action.edit {
3522+ log::debug!("edit: {:?}", workspace_edit);
3523+ apply_workspace_edit(editor, offset_encoding, workspace_edit);
3516− lsp::CodeActionOrCommand::CodeAction(code_action) => {
3517− log::debug!("code action: {:?}", code_action);
3518− if let Some(ref workspace_edit) = code_action.edit {
3519− log::debug!("edit: {:?}", workspace_edit);
3520− apply_workspace_edit(editor, offset_encoding, workspace_edit);
3523− // if code action provides both edit and command first the edit
3526+ // if code action provides both edit and command first the edit
3524− // should be applied and then the command
3527+ // should be applied and then the command
3525− if let Some(command) = &code_action.command {
3528+ if let Some(command) = &code_action.command {
3526− execute_lsp_command(editor, command.clone());
3529+ execute_lsp_command(editor, command.clone());
3532− Popup::new("code-action", picker).margin(helix_view::graphics::Margin {
3534+ let popup = Popup::new("code-action", picker).margin(helix_view::graphics::Margin {
3533− vertical: 1,
3535+ vertical: 1,
3534− horizontal: 1,
3536+ horizontal: 1,
3536− compositor.push(Box::new(popup))
3538+ compositor.push(Box::new(popup))