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 lspor:checkhealth nvim-lspconfigfor a detailed setup diagnosis :LspStart,:LspStop, and:LspRestartcontrol server lifecycle for the current buffer- The programmatic equivalent:
:lua =vim.lsp.get_clients({ bufnr = 0 })— useful in scripts - If the
cmdis correct but the server isn't starting, verify the binary is on your$PATHwith:!which gopls - In Neovim 0.10+, the built-in
:checkhealth vim.lspprovides similar diagnostic output without requiringnvim-lspconfig