In Neovim 0.8, I had the following command mapped
vnoremap <leader>a :lua vim.lsp.buf.range_code_action()<cr>
which in visual mode, gave me options such as Wrap In Try-Catch/Extract Method etc.
Now in 0.9 range_code_action
no longer exists and https://neovim.io/doc/user/lsp.html#vim.lsp.buf.code_action() says "range: (table|nil) Range for which code actions should be requested. If in visual mode this defaults to the active selection."
I've tried simply changing the mapping to lua vim.lsp.buf.range_code_action()
but I'm just getting the basic code actions, not the various Wrap/Extract method etc.
I'm coding Dart.
Any ideas how I a get my range code actions back?
:
you're actually switching to command-line mode. Try using<Cmd>
to run the:lua
command without switching to command-line mode from your mapping, such asvnoremap <leader>a <Cmd>lua vim.lsp.buf.code_action()<cr>
. See:help <Cmd>
for more details.