SpaceVim uses nvim-lspconfig (neovim native LSP) via the lsp layer.
Active clients are declared in SpaceVim.d/init.toml under [[layers]] name = "lsp".
[[layers]]
name = "lsp"
enabled_clients = ['pyright', "gopls", "tsserver", "sourcekit", "solargraph", "rust_analyzer"]| Key | Action |
|---|---|
gd |
Go to definition |
gD |
Go to type definition |
gr |
Find references |
gi |
Go to implementation |
K |
Show hover documentation |
<leader>rn |
Rename symbol |
SPC l d |
Show document |
SPC l e |
Rename symbol |
SPC l s |
Show line diagnostics |
SPC l x |
Find references |
npm install -g pyrightgo install golang.org/x/tools/gopls@latestCustom flag in config (shared daemon mode):
[layers.override_cmd]
gopls = ['gopls', '-remote=auto']npm install -g typescript typescript-language-servergd uses _typescript.goToSourceDefinition to jump to source instead of stopping at re-exports.
Bundled with Xcode. Requires Xcode to be installed and selected:
xcode-select --install
sudo xcode-select -s /Applications/Xcode.app/Contents/DeveloperRoot detection is customised in SpaceVim.d/lua/lingti/lsp.lua to prefer Package.swift over .git for Find References to work in multi-package repos.
gem install solargraphInstall via rustup (recommended — keeps in sync with the toolchain):
rustup component add rust-analyzerVerify:
rust-analyzer --versionNote:
rust-analyzeris a toolchain component, not a standalone binary in PATH. Therustup-managed wrapper at~/.cargo/bin/rust-analyzeris what nvim-lspconfig invokes.
Diagnostics are handled by the checkers layer (ALE engine):
[[layers]]
name = "checkers"
enable_ale = true| Key | Action |
|---|---|
SPC l s |
Show current line diagnostics |
]e / [e |
Jump to next/previous error |
Check if an LSP client is attached to the current buffer:
:lua print(vim.inspect(vim.lsp.get_clients({bufnr=0})))Check LSP log for errors:
:lua vim.cmd('edit ' .. vim.lsp.get_log_path())Verify the binary is executable:
which rust-analyzer
which gopls
which pyright
which typescript-language-server
which solargraphReload LSP for current buffer:
:LspRestart