diff options
| author | Robert Günzler <r@gnzler.io> | 2021-12-07 13:55:40 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2021-12-07 14:00:27 +0100 |
| commit | 9b5f086344ac06d9926dd8ca48140f31de29330e (patch) | |
| tree | 80b64dd5d4afbd2fe74a58b4965e1498e56bb0db /.vim/lua/lsp.lua | |
| parent | 6a3429dcccfa4ec1a35016c34c84e09bfc913200 (diff) | |
vim: use new vim.ui funcs (neovim 0.6.0)
Diffstat (limited to '.vim/lua/lsp.lua')
| -rw-r--r-- | .vim/lua/lsp.lua | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/.vim/lua/lsp.lua b/.vim/lua/lsp.lua index 91e2e2e..47eef75 100644 --- a/.vim/lua/lsp.lua +++ b/.vim/lua/lsp.lua @@ -106,18 +106,23 @@ local setup = function() if #actions == 1 then action_chosen = actions[1] else - local option_strings = {'Code Actions:'} + local option_strings = {} for i, action in ipairs(actions) do local title = action.title:gsub('\r\n', '\\r\\n') title = title:gsub('\n', '\\n') table.insert(option_strings, string.format('%d. %s', i, title)) end - local choice = vim.fn.inputlist(option_strings) - if choice < 1 or choice > #actions then - return - end - action_chosen = actions[choice] + vim.ui.select(option_strings, + { + prompt = 'Code Actions:', + }, + function(choice) + if choice < 1 or choice > #actions then + return + end + action_chosen = actions[choice] + end) end if action_chosen.edit or type(action_chosen.command) == 'table' then |