Skip to main content

Overview

This configuration uses Neovim’s native LSP client (0.11+) with nvim-lspconfig for standardized server configurations. All language servers are installed globally and managed outside of Neovim. Configuration file: lua/plugins/lsp/init.lua:11

Architecture

The LSP configuration follows a three-layer approach:
  1. Global defaults - Applied to all language servers via vim.lsp.config("*")
  2. nvim-lspconfig defaults - Standard configurations from the lspconfig repository
  3. Local overrides - Custom settings in after/lsp/*.lua files
Server-specific configurations in after/lsp/ directories take precedence over default settings.

Enabled language servers

The configuration enables the following language servers (source:42-60):
  • lua_ls - Lua language server
  • gopls - Go language server
  • tsgo - TypeScript/JavaScript (Microsoft’s native server)
  • bashls - Bash/Shell script support
  • clangd - C/C++ language server
markdown_oxide is currently disabled but can be re-enabled by uncommenting line 54.

Global capabilities

All servers share these capabilities (source:21-29):
textDocument.foldingRange.dynamicRegistration
boolean
default:"false"
Disables dynamic registration for folding ranges.
textDocument.foldingRange.lineFoldingOnly
boolean
default:"true"
Only enables line-based folding (used by nvim-ufo).
root_markers
string[]
default:"[\".git\"]"
All servers use .git directory to detect project root.

Keymaps

Keymaps are automatically set up when an LSP server attaches to a buffer (source:65-132):
K
keymap
Hover documentation - Shows symbol information in a floating window
  • Border: rounded
  • Max height: 25 lines
  • Max width: 120 characters
<C-k>
keymap
Signature help - Shows function signature (works in both normal and insert mode)
  • Border: rounded
ga
keymap
Code action - Shows available code actions (works in normal and visual mode)
<leader>rn
keymap
Rename symbol - Intelligently renames symbol across workspace
<leader>ca is mapped to tiny-code-action plugin for enhanced code action UI.
[d
keymap
Previous diagnostic - Jump to previous diagnostic in buffer
]d
keymap
Next diagnostic - Jump to next diagnostic in buffer
<leader>cd
keymap
Show diagnostic - Open floating window with diagnostic details
<leader>wa
keymap
Add workspace folder - Add a directory to the workspace
<leader>wr
keymap
Remove workspace folder - Remove a directory from the workspace
<leader>wl
keymap
List workspace folders - Print all workspace folders
<leader>ih
keymap
Toggle inlay hints - Enable/disable inline type annotations
Inlay hints are disabled by default. Press <leader>ih to toggle them on.

Diagnostic configuration

Diagnostics are configured globally (source:163-181):
severity_sort
boolean
default:"true"
Sorts diagnostics by severity (errors first, then warnings, info, hints).
float.border
string
default:"rounded"
Uses rounded borders for diagnostic floating windows.
float.source
boolean
default:"true"
Shows the diagnostic source (e.g., “eslint”, “typescript”) in floating windows.
underline
boolean
default:"true"
Underlines diagnostic regions in the buffer.
update_in_insert
boolean
default:"false"
Disables diagnostic updates while in insert mode for better performance.
virtual_text
boolean
default:"false"
Disabled because the tiny-diagnostic plugin provides better inline diagnostics.
Custom icons are displayed in the sign column:
  • Error: 󰅚 (red background in line numbers)
  • Warning: 󰀪 (yellow background in line numbers)
  • Info: 󰋽
  • Hint: 󰌶
signs = {
  text = {
    [vim.diagnostic.severity.ERROR] = "󰅚 ",
    [vim.diagnostic.severity.WARN] = "󰀪 ",
    [vim.diagnostic.severity.INFO] = "󰋽 ",
    [vim.diagnostic.severity.HINT] = "󰌶 ",
  },
  numhl = {
    [vim.diagnostic.severity.ERROR] = "ErrorMsg",
    [vim.diagnostic.severity.WARN] = "WarningMsg",
  },
}

Server-specific configurations

Server-specific settings are defined in after/lsp/*.lua files:
Configuration file: after/lsp/lua_ls.lua
settings.Lua.diagnostics.globals
string[]
default:"[\"vim\"]"
Recognizes vim as a global variable to avoid undefined warnings.
settings.Lua.diagnostics.disable
string[]
Disables: inject-field, undefined-field, missing-fields
settings.Lua.runtime.version
string
default:"LuaJIT"
Uses LuaJIT runtime (Neovim’s Lua version).
settings.Lua.workspace.library
table
Includes Neovim runtime files for completion.
settings.Lua.workspace.checkThirdParty
boolean
default:"false"
Disables third-party library prompts.
settings.Lua.telemetry.enable
boolean
default:"false"
Disables telemetry.
Configuration file: after/lsp/gopls.luaCode lenses (mostly disabled to reduce CPU usage):
  • generate, gc_details, test, tidy, vendor, regenerate_cgo, upgrade_dependency, run_govulncheck - All disabled
Inlay hints (all enabled):
  • Variable types, composite literal fields/types, constant values, function type parameters, parameter names, range variable types
Key settings:
settings.gopls.gofumpt
boolean
default:"true"
Uses gofumpt for stricter formatting.
settings.gopls.staticcheck
boolean
default:"false"
Disabled to reduce CPU/memory usage. Use <leader>ll for linting.
settings.gopls.diagnosticsDelay
string
default:"1000ms"
Increases delay to reduce CPU spikes during typing.
settings.gopls.semanticTokens
boolean
default:"true"
Enables semantic highlighting.
Configuration file: after/lsp/tsgo.luaMemory settings:
init_options.maxTsServerMemory
number
default:"8192"
Allocates up to 8GB for the TypeScript server.
Auto-imports:
  • autoImports: true - Automatic import suggestions
  • importModuleSpecifierPreference: "shortest" - Uses shortest import paths
  • includePackageJsonAutoImports: "auto" - Includes package.json imports
Inlay hints (all enabled):
  • Parameter names, types, variable types, property types, return types, enum values
Code lenses:
  • Implementation references on interfaces and classes
  • Reference counts on all functions
Settings apply to both TypeScript and JavaScript files.

LSP attach behavior

When an LSP server attaches to a buffer (source:137-158):
  1. Keymaps are configured for that buffer
  2. Omnifunc is set to vim.lsp.omnifunc for <C-x><C-o> completion
  3. Inlay hints are disabled by default (toggle with <leader>ih)

LSP detach cleanup

When an LSP server detaches (source:186-192):
  1. References are cleared from the buffer
  2. Document highlight autogroups are removed
All language servers and tools must be installed globally. See the installation documentation for platform-specific instructions.

Build docs developers (and LLMs) love