Architecture Overview
Magictt’s LSP setup uses three main components:LSP Server Installation
Automatic Installation with Mason
Language servers are automatically installed via Mason. The configuration is inlua/magictt/plugins/lsp/mason.lua:
Mason UI Configuration
Mason’s UI uses custom icons for package status:- Use
<leader>mmto open the Mason UI - View all installed and available packages
- Manually install/uninstall packages as needed
LSP Keybindings
LSP keybindings are automatically configured when a language server attaches to a buffer. This is handled inlua/magictt/lsp.lua using an autocommand:
Available LSP Keybindings
See the Keymaps page for a complete list of LSP keybindings. Quick reference:gd- Go to definitionK- Show documentation<leader>ca- Code actions<leader>rn- Rename symbol[d/]d- Navigate diagnostics
Diagnostic Configuration
Diagnostic Display
Diagnostics (errors, warnings, hints) are configured in two places: Basic configuration (lua/magictt/core/options.lua):
lua/magictt/lsp.lua):
Diagnostic Features
Virtual Text
Virtual Text
Diagnostic messages appear inline at the end of problematic lines with a bullet (●) prefix and 4-space padding.
Sign Column
Sign Column
Icons appear in the sign column (left gutter) indicating the severity:
- Error (red)
- Warning (yellow)
- Hint (blue)
- Info (cyan)
Underline
Underline
Problematic code is underlined to make it easy to spot issues.
Severity Sorting
Severity Sorting
Diagnostics are sorted by severity, with errors appearing first.
Auto-Format on Save
Magictt uses conform.nvim for automatic formatting on save. Configuration is inlua/magictt/plugins/conform.lua.
Formatters Installation
Formatters are automatically installed viamason-tool-installer:
Formatter Configuration
Formatters are configured per file type:Auto-Format Behavior
Files are automatically formatted on save using aBufWritePre autocommand:
Only configured file types will be auto-formatted. If you want to add support for additional languages, update the
formatters_by_ft table in lua/magictt/plugins/conform.lua.Adding New Language Servers
To add support for a new language:Find the LSP server name
Visit nvim-lspconfig server configurations to find the server name for your language.
Add to ensure_installed
Edit
lua/magictt/plugins/lsp/mason.lua and add the server name to the ensure_installed list:Troubleshooting
LSP Not Working
Check if LSP is attached
Check if LSP is attached
Run
:LspInfo in Neovim to see which language servers are attached to the current buffer.Restart LSP server
Restart LSP server
Use
<leader>rs to restart the LSP server for the current buffer.Check Mason installation
Check Mason installation
Open Mason with
<leader>mm and verify the language server is installed (✓ icon).View LSP logs
View LSP logs
Check
:messages or :LspLog for error messages.Formatter Not Working
- Verify the formatter is installed in Mason (
<leader>mm) - Check that your file type is configured in
formatters_by_ft - Ensure the formatter supports your file type
Related Configuration
Vim Options
Core Vim settings including diagnostic display
Keymaps
All LSP keybindings and shortcuts