diff options
| author | Robert Günzler <r@gnzler.io> | 2022-02-08 23:47:50 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2022-02-08 23:47:50 +0100 |
| commit | 465a93e204adbeccae6cb33fe05edf9636f7054e (patch) | |
| tree | 9ad0c408106140645ff23fa5e213a0d6544a433e /.vim | |
| parent | 22329e01bef43f8669b7385978dff3e6040c58aa (diff) | |
vim: disable custom code action handler
Diffstat (limited to '.vim')
| -rw-r--r-- | .vim/lua/lsp.lua | 80 | ||||
| -rw-r--r-- | .vim/lua/plugins.lua | 4 |
2 files changed, 41 insertions, 43 deletions
diff --git a/.vim/lua/lsp.lua b/.vim/lua/lsp.lua index 79f2526..2bb47b3 100644 --- a/.vim/lua/lsp.lua +++ b/.vim/lua/lsp.lua @@ -93,46 +93,46 @@ local setup = function() -- handler overwrites -- overwrite codeAction handler to not ask for confirmation if only a single -- action is given - vim.lsp.handlers['textDocument/codeAction'] = function(_, _, actions) -- {{{ - if actions == nil or #actions == 0 then - -- skip printing 'no code actions available' - return - end - - local action_chosen - if #actions == 1 then - action_chosen = actions[1] - else - 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 - - 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 - if action_chosen.edit then - vim.lsp.util.apply_workspace_edit(action_chosen.edit) - end - if type(action_chosen.command) == 'table' then - vim.lsp.buf.execute_command(action_chosen.command) - end - else - vim.lsp.buf.execute_command(action_chosen) - end - end + -- vim.lsp.handlers['textDocument/codeAction'] = function(_, _, actions) -- {{{ + -- if actions == nil or #actions == 0 then + -- -- skip printing 'no code actions available' + -- return + -- end + -- + -- local action_chosen + -- if #actions == 1 then + -- action_chosen = actions[1] + -- else + -- 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 + -- + -- vim.ui.select(option_strings, + -- { + -- prompt = 'Code Actions: blabla', + -- }, + -- 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 + -- if action_chosen.edit then + -- vim.lsp.util.apply_workspace_edit(action_chosen.edit) + -- end + -- if type(action_chosen.command) == 'table' then + -- vim.lsp.buf.execute_command(action_chosen.command) + -- end + -- else + -- vim.lsp.buf.execute_command(action_chosen) + -- end + -- end -- }}} lsp.ccls.setup { diff --git a/.vim/lua/plugins.lua b/.vim/lua/plugins.lua index 4b9b0c1..65b573f 100644 --- a/.vim/lua/plugins.lua +++ b/.vim/lua/plugins.lua @@ -202,9 +202,7 @@ return require('packer').startup({function() } end} -- }}} - use {'weilbith/nvim-code-action-menu', -- {{{ - cmd = 'CodeActionMenu', - } -- }}} + use {'weilbith/nvim-code-action-menu'} use {'nvim-treesitter/nvim-treesitter', -- {{{ run = ':TSUpdate', |