Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

aspeddro/lsp_menu.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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