This plugin is no longer maintained.
I'm archiving the GitHub repo. Feel free to fork
A simple menu to handle some LSP requests.
This plugin just changes the
vim.ui.select
interface to a floating menu.
Supported methods:
textDocument/codeAction
textDocument/codeLens
Code Action | Code Lens |
- Neovim 0.7
vim.keymap
andvim.api.nvim_create_autocmd
required
packer.nvim
use 'aspeddro/lsp_menu.nvim'
local on_attach = function(client, bufnr)
require('lsp_menu').on_attach(client, bufnr)
-- Add keymap
vim.keymap.set('n', '<space>ca', require'lsp_menu'.codeaction.run, { buffer = bufnr })
vim.keymap.set('v', '<space>ca', function() require'lsp_menu'.codeaction.run{range = true} end, { buffer = bufnr })
vim.keymap.set('n', '<space>lr', require'lsp_menu'.codelens.run, { buffer = bufnr })
end
Use the confirm_key
or the number shortcut to execute the command.
Default options:
{
close_key = "q",
confirm_key = "<cr>",
style = {
border = "rounded",
}
}
Examples:
vim.keymap.set('n', '<space>ca', function()
require('lsp_menu').codeaction.run{style = { border = 'single' }}
end, { buffer = bufnr })