vimtricks.wiki Concise Vim tricks, one at a time.

How do I check which language servers are attached to the current buffer and debug my LSP setup in Neovim?

Answer

:LspInfo

Explanation

The :LspInfo command, provided by the nvim-lspconfig plugin, opens a diagnostic floating window showing every active LSP client and its configuration for the current buffer. It is the go-to command when language features like completion, go-to-definition, or diagnostics are not working as expected.

How it works

:LspInfo displays:

  • Active clients — LSP servers currently attached to the current buffer
  • Root directory — the project root each server detected (wrong root = missing features)
  • Filetypes — which filetypes the server is configured to handle
  • Command — the binary being used to start the server

It also shows other running clients that are not attached to the current buffer, helping diagnose conflicts.

Example

In a Go file, :LspInfo shows something like:

Active clients:
  gopls (id: 1)
    root:      /home/user/myproject
    filetypes: go, gomod, gowork
    cmd:       gopls

Other clients (not attached to this buffer):
  tsserver (id: 2)
    root:      /home/user/webapp
    filetypes: typescript, javascript

Tips

  • If no clients appear, run :checkhealth lsp or :checkhealth nvim-lspconfig for a detailed setup diagnosis
  • :LspStart, :LspStop, and :LspRestart control server lifecycle for the current buffer
  • The programmatic equivalent: :lua =vim.lsp.get_clients({ bufnr = 0 }) — useful in scripts
  • If the cmd is correct but the server isn't starting, verify the binary is on your $PATH with :!which gopls
  • In Neovim 0.10+, the built-in :checkhealth vim.lsp provides similar diagnostic output without requiring nvim-lspconfig

Next

How do I open the directory containing the current file in netrw from within Vim?