Native LSP in Neovim

Native LSP

Neovim 0.5 will be shipping with and API for Language Server Protocol.

I would recommend moving over to this since it will be supported by the Neovim Core team.

One thing to note is that the LSP API provided is very general.

In other words don't expect everything to just work out of the box.

This blog will hopefully help you get a good understanding of the new features and helpful plugins.

NOTE This will require the latest Neovim 0.5

NOTE for additional information :h lsp

Plugins

We will be using the following plugins for auto-complete and configuration:

Configuration

Code navigation:

Auto format:

Auto complete:

NOTE This file is configured in lua

Setting up Language Servers

This can be very easy or very hard depending on your language

For instance Python is extremely easy to set up, Java is an absolute nightmare as expected.

Remember you need to have some sort of language server binary installed and the configuration for it to work.

Luckily most language server binaries can be installed with npm (idc if it's bloat it's just so easy)

Here are some examples:

Python:

  • Install language server: npm i -g pyright
  • Configure language server:

Bash:

  • Install language server: npm i -g bash-language-server
  • Configure language server:

For more information on setting up language servers checkout this link

For more language specific plugins (for things like Java) checkout this link

To enable snippets for some languages checkout this link

For plugins that will hopefully make this easier someday checkout this link

Links for Plugins


Tagged in neovim