VimPlugin: lsp

From wikinotes

Neovim's builtin lsp client.

Documentation

:h lsp https://neovim.io/doc/user/lsp.html
avail lsp's https://microsoft.github.io/language-server-protocol/implementors/servers/

Configuration

Language Install

Vanilla

  • install an lsp using your OS (ex. pacman -S gopls
  • enable lsp (ex. lua require('lspconfig').gopls.setup{on_attach = custom_lsp_attach})

lspconfig

VimPlugin: nvim-lspconfig contains several pre-made LSP configurations.
You'll still need to install the LSP provider.

Mason

VimPlugin: mason can automate installing LSPs.
Use the :Mason command to see installed.

Disable Inline Linter Errors

# neovim 6+
vim.diagnostic.config({virtual_text = false})

# old way
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
    vim.lsp.diagnostic.on_publish_diagnostics, {
        virtual_text = false
    }
)

Note that VimPlugin: Ale also has inline diagnostics.