LSP, formatting and Treesitter¶
Language packs
The quickest way to get a language working is a language pack: languages = { "python", "web", "lua" } installs and sets up the servers, formatters, linters, parsers and debugger for you. This page covers setting things up by hand, on top of or instead of the packs.
LSP¶
Install a language server (Mason + mason-lspconfig):
:LspInstall <server_or_filetype>
Examples: :LspInstall lua_ls, :LspInstall pyright.
Open :Mason for the UI. Commands work from a fresh Dashboard session (LspInstall / LspUninstall lazy-load mason-lspconfig).
Configure servers in user/settings.lua:
M.config.lsp = function()
-- vim.lsp.config("lua_ls", {})
-- vim.lsp.enable("lua_ls")
end
The LSP key maps (<leader>l… and Neovim's own K, grn, gra, ...) are listed on the Key maps page. :checkhealth vim.lsp (<leader>li) shows which servers are attached.
Inlay hints and code lens¶
Inlay hints (types and parameter names shown inside the code) and code lens (actions such as "Run test" or reference counts above a line) are on by default for servers that support them. <leader>lH toggles inlay hints and <leader>lC toggles code lens in the current buffer; <leader>lc runs the code lens on the cursor line. config.inlay_hints = { enabled = false } and config.code_lens = { enabled = false } turn them off everywhere (see Configuration).
Renaming files¶
Renaming or moving a file in neo-tree tells the language servers about it (nvim-lsp-file-operations), so servers that support it (vtsls, basedpyright, rust-analyzer, jdtls, ...) update the imports. disable_plugins.lsp_file_operations = true turns it off.
Servers started by a plugin¶
rust-analyzer is started by rustaceanvim, not by CodeArt or mason-lspconfig; configure it with config.rustaceanvim (see Language packs). :CodeArtLanguages shows it as rust_analyzer (started by rustaceanvim).
Formatting¶
conform.nvim formats the buffer. <leader>r formats on demand (conform with LSP fallback, or the language server alone if conform is disabled). CodeArt's defaults turn on format-on-save with LSP fallback. Formatters come from your language packs; add or replace them per filetype here:
M.config.conform = {
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
formatters_by_ft = {
lua = { "stylua" },
python = { "black" },
},
}
Install formatters with :Mason or your OS package manager. To format only with <leader>r, set format_on_save = false in config.conform.
Linting¶
nvim-lint runs linters when you open a buffer, save it, or leave insert mode. Apart from the ones language packs add (markdownlint-cli2, hadolint), no linters are set up; add your own here:
M.config.lint = {
linters_by_ft = {
python = { "flake8" },
sh = { "shellcheck" },
},
}
Lint results show up as diagnostics, like the language server's.
Treesitter¶
CodeArt uses nvim-treesitter on the main branch (Neovim 0.12+).
Requires tree-sitter CLI ≥ 0.26.1 on PATH (install tree-sitter-cli via your OS package manager — not npm).
Install parsers¶
Interactively:
:TSInstall lua
:TSUpdate
Or ensure on startup (opt-in; no defaults shipped):
M.config.treesitter = {
ensure_installed = { "lua", "vim", "python" },
}
Fresh installs have no parsers until you install some. Neovim may still highlight a few languages using bundled parsers.
Health¶
:checkhealth nvim-treesitter