Closed zjsyhjh closed 3 years ago
If you want to use nvim_buf_set_keymap
for your mapping, the first argument must be the buffer handle, see :h nvim_buf_set_keymap()
(0
for the current buffer)
Otherwise you can set the mapping like so:
vim.api.nvim_set_keymap('n', 'gca', [[<cmd>lua vim.lsp.buf.code_action()<CR>]], { silent = true, noremap = true })
https://user-images.githubusercontent.com/5110713/122389003-0aa2ea80-cfa3-11eb-8d27-a69d0571370f.mov
@ojroques Sorry for my mistake. The video shows the whole process. I can get the code action when using the plugin, but when I confirm the action, it does nothing.
Code actions work fine on my side. Your issue most likely comes from the language server you're using and not from the plugin.
To check if that's the case, disable the plugin and retry applying the code action. If it still doesn't work, it definitely comes from your language server.
https://user-images.githubusercontent.com/5110713/122434191-75671c80-cfc9-11eb-8e13-d364c7a9be0a.mov
@ojroques it works when I disable the plugin.
I think I have found the issue, the logic was wrong when applying code actions. Hopefully everything works as intended now. Please update the plugin and re-open the issue if it still doesn't work.
It works for me now. Thanks!
codeAction doesn't seem to work for me. Here is the config.