aspeddro / lsp_menu.nvim

A simple menu to handle some LSP requests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No Longer Maintained

This plugin is no longer maintained.

I'm archiving the GitHub repo. Feel free to fork

lsp_menu.nvim

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

Screenshots

Code Action Code Lens
LSP: rust_analyzer

Requirements

  • Neovim 0.7
    • vim.keymap and vim.api.nvim_create_autocmd required

Installation

packer.nvim

use 'aspeddro/lsp_menu.nvim'

Usage

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.

Customize Menu

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 })

About

A simple menu to handle some LSP requests.

License:MIT License


Languages

Language:Lua 100.0%