autoload/lsp/codeaction.vim | 18 ++++++++++++++---- diff --git a/autoload/lsp/codeaction.vim b/autoload/lsp/codeaction.vim index 862c4ac23005832a3149d550cf32281a0c4884b1..d739064f09a0ad6b60bea888bb0074ac565fffb0 100644 --- a/autoload/lsp/codeaction.vim +++ b/autoload/lsp/codeaction.vim @@ -77,16 +77,26 @@ cursorline: 1, mapping: 0, wrap: 0, title: 'Code action', - callback: (_, id) => { + callback: (_, result) => { # Invalid item selected or closed the popup - if id <= 0 || id > text->len() + if result <= 0 || result > text->len() return endif # Do the code action - HandleCodeAction(lspserver, actions[id - 1]) + HandleCodeAction(lspserver, actions[result - 1]) }, - filter: 'popup_filter_menu' + filter: (winid, key) => { + if key == 'h' || key == 'l' + popup_close(winid, -1) + elseif str2nr(key) > 0 + # supposed would not over 9 items + popup_close(winid, str2nr(key)) + else + return popup_filter_menu(winid, key) + endif + return 1 + }, }) else choice = inputlist(["Code action:"] + text)