LSP Configuration
GentlemanNvim leverages LazyVim’s LSP configuration with additional language support and custom settings for frontend development.Overview
The LSP setup is managed through LazyVim extras, providing:Auto-installation
LSP servers install automatically on first use
Multiple Languages
TypeScript, Go, Nix, JSON, TOML, and more
Format on Save
Prettier and Biome integration
Inline Diagnostics
Real-time error checking
Enabled Language Servers
Configured through LazyVim extras inconfig/lazy.lua:
TypeScript & JavaScript
- tsserver - TypeScript language server
- Angular Language Service - Angular-specific IntelliSense
- Type checking and auto-imports
- Refactoring support
TypeScript Features
TypeScript Features
- Go to definition/references
- Rename symbol across project
- Organize imports
- Quick fixes and code actions
- Inlay hints for types
- Auto-completion with type information
JSON
- jsonls - JSON language server
- Schema validation
- Auto-completion for package.json, tsconfig.json, etc.
Markdown
- marksman - Markdown language server
- Link validation
- Table of contents generation
- Reference completion
Go
- gopls - Official Go language server
- Code formatting with gofmt
- Import organization
- Test integration
Other Languages
| Extra | Language Server | Purpose |
|---|---|---|
lang.astro | astro-ls | Astro framework support |
lang.nix | nil | Nix language support |
lang.toml | taplo | TOML configuration files |
Formatters
Prettier
- JavaScript/TypeScript
- JSON
- Markdown
- HTML/CSS
- YAML
.prettierrc in your project root. Default settings apply if not found.
Biome
- 10-20x faster than Prettier
- Integrated linter
- Compatible with Prettier configs
biome.json exists in project root.
Biome and Prettier coexist - Biome is used when configured, otherwise Prettier is the fallback.
Linters
ESLint
- Real-time error highlighting
- Code action fixes
- Auto-fix on save (when configured)
.eslintrc.js.eslintrc.jsoneslint.config.js(flat config)
LSP Keybindings
Inherited from LazyVim:Navigation
| Keymap | Action | Description |
|---|---|---|
gd | Go to definition | Jump to where symbol is defined |
gr | Go to references | Show all references |
gI | Go to implementation | Jump to implementation |
gy | Go to type definition | Jump to type definition |
K | Hover documentation | Show documentation popup |
Code Actions
| Keymap | Action | Description |
|---|---|---|
<leader>ca | Code actions | Show available code actions |
<leader>rn | Rename | Rename symbol project-wide |
<leader>cf | Format | Format current buffer |
<leader>cF | Format injected | Format injected code (e.g., in markdown) |
Diagnostics
| Keymap | Action | Description |
|---|---|---|
]d | Next diagnostic | Jump to next error/warning |
[d | Previous diagnostic | Jump to previous error/warning |
<leader>cd | Line diagnostics | Show diagnostics for current line |
<leader>xx | Trouble | Open trouble list (all diagnostics) |
Custom LSP Configuration
Node.js Integration
Custom Node.js host configuration:The configuration automatically detects and uses the Node.js in your PATH. Required for:
- TypeScript language server
- ESLint
- Prettier
- Angular Language Service
LSP on Attach
LazyVim automatically sets up LSP keybindings when a language server attaches. No additional configuration needed.Completion Engine
Blink.cmp
Modern completion engine replacing nvim-cmp:- Faster than nvim-cmp
- LSP completion
- Snippet support
- Fuzzy matching
- AI assistant completion (Avante integration)
Completion Sources Priority
Completion Sources Priority
- avante_mentions (score: 1000) -
@mentionsin AI chat - avante_files (score: 100) - File paths
- avante_commands (score: 90) - AI commands
- LSP (score: 60) - Language server completions
- Buffer - Words from current buffer
- Path - File system paths
Copilot Integration
GitHub Copilot completions are integrated but disabled in specific file types:Format on Save
LazyVim automatically formats on save using configured formatters:- Biome (if
biome.jsonexists) - Prettier (fallback for JS/TS/JSON/MD)
- LSP formatter (language-specific)
Disable Format on Save
Per-buffer:Diagnostic Configuration
LazyVim provides sensible diagnostic defaults:Diagnostic Settings
Diagnostic Settings
LSP Server Management
Mason
LazyVim uses Mason to manage LSP servers:| Command | Action |
|---|---|
:Mason | Open Mason UI |
:MasonInstall <server> | Install LSP server |
:MasonUninstall <server> | Uninstall LSP server |
:MasonUpdate | Update all installed servers |
Commonly Installed Servers
These install automatically based on file types:- typescript-language-server - TypeScript/JavaScript
- angular-language-server - Angular
- json-lsp - JSON
- marksman - Markdown
- gopls - Go
- nil - Nix
- taplo - TOML
- lua-language-server - Lua
Troubleshooting
LSP Not Starting
Formatting Not Working
ESLint Not Running
Create configuration:Advanced Configuration
Custom LSP Settings
Override LSP server settings by creatinglua/plugins/lsp.lua:
Add Custom Language Server
Example for adding a new LSP:Performance Tips
Next Steps
AI Assistants
Enhance LSP with AI-powered code intelligence
Keymaps
Learn all LSP-related keybindings