Language packs¶
A language pack turns on everything a language needs in one line: language servers, a formatter, a linter, treesitter parsers, a debugger and a test adapter. CodeArt installs the tools with Mason in the background, so you can clone, pick your languages and start coding.
-- user/settings.lua (:CodeArtConfig opens it)
local M = {}
M.languages = { "python", "web", "lua" }
return M
Restart Neovim. Missing tools and parsers install in the background a moment after startup, and a notification tells you when they are done. Open :Mason to watch the progress.
- Default:
{ "lua" }. lua-language-server and stylua are self-contained programs, so the default pack works without Node.js or Python. Every CodeArt user edits Lua, if only this config. - Setting
languagesreplaces the default list. Add"lua"to your list if you want to keep it. languages = {}turns every pack off. CodeArt then behaves like 2.3: nothing is installed for you, and formatters and linters are opt-in.- Unknown names get one warning after startup, with a suggestion for typos (
"pyhton"→"python"). Other names for a pack also work:"c","typescript","sh","yml"and so on (see Aliases).
Built-in packs¶
| Pack | Language servers | Formatter | Linter | Debugger | Needs on PATH |
|---|---|---|---|---|---|
lua |
lua_ls | stylua ¹ | lua_ls | local-lua-debugger | Node.js and luajit (or lua 5.1–5.4) for debugging |
python |
basedpyright, ruff | ruff format | ruff (server) | debugpy | Python |
web |
vtsls, html, cssls, jsonls, eslint | prettier ² | eslint (server) | js-debug (Node.js) | Node.js / npm |
go |
gopls | goimports, gofumpt | gopls | delve | Go |
rust |
rust_analyzer (started by rustaceanvim ⁵) | rustfmt ³ | rust-analyzer (cargo check) | codelldb | cargo (rustup) |
cpp |
clangd | clang-format ⁴ | clangd (clang-tidy) | codelldb | Python for clang-format |
java |
jdtls | jdtls | jdtls | java-debug (through jdtls) | Java 25+ (current jdtls), Python for the jdtls launcher |
bash |
bashls | shfmt | shellcheck (through bashls) | bash-debug-adapter | Node.js / npm |
markdown |
marksman | – | markdownlint-cli2 | – | Node.js / npm for the linter |
yaml |
yamlls | yamlls | yamlls (schemas) | – | Node.js / npm |
toml |
taplo | taplo | taplo | – | – |
docker |
dockerls, docker_compose_language_service | – | hadolint | – | Node.js / npm |
csharp |
roslyn_ls | csharpier | roslyn_ls (analyzers) | netcoredbg | .NET SDK (dotnet) |
sql |
sqls, sqruff | sqruff ⁶ | sqruff (server) | – | Go for sqls |
php |
phpactor | pint or php-cs-fixer ⁷ | phpactor | php-debug-adapter (Xdebug) | PHP; Node.js for the debugger |
zig |
zls | zig fmt | zls | codelldb | Zig (zls must match its version) |
ruby |
ruby_lsp | ruby_lsp (the project's RuboCop or Standard) | ruby_lsp (RuboCop) | rdbg (debug gem) | Ruby (with its headers) |
kotlin |
kotlin_lsp (JetBrains) | kotlin_lsp | kotlin_lsp | kotlin-debug-adapter | Java 17+ (a JDK) |
terraform |
terraformls, tflint | terraform fmt (or tofu fmt) | tflint (server) | – | terraform or tofu for formatting and the tasks |
powershell |
powershell_es (PowerShell Editor Services) | powershell_es | PSScriptAnalyzer (through powershell_es) | PowerShell Editor Services | PowerShell 7 (pwsh); Windows PowerShell 5.1 works too |
vue |
vue_ls, vtsls (with the Vue TypeScript plugin) | prettier | eslint (with the web pack) |
js-debug (with the web pack) |
Node.js / npm |
dart |
dartls (from the SDK) | dart format | dartls | the SDK's debug adapter | The Dart or Flutter SDK (nothing comes from Mason) |
tex |
texlab, tinymist (Typst) | latexindent (through texlab), typstyle (through tinymist) | chktex (through texlab), tinymist | – | latexmk (TeX Live, MacTeX, MiKTeX) or Tectonic for LaTeX; nothing extra for Typst |
nix |
nil_ls ⁸ | nixfmt ⁸ | nil_ls | – | Nix |
elixir |
elixirls (ElixirLS) | mix format | elixirls (compiler, Dialyzer) | ElixirLS's debug adapter | Elixir (and Erlang/OTP) |
- Only in projects with a
stylua.tomlor.stylua.toml. Elsewhere lua_ls formats, so files outside your projects keep their style. - A project's own prettier in
node_moduleswins over Mason's. - rustfmt comes with rustup, not Mason.
- Only in projects with a
.clang-formatfile. Elsewhere clangd formats. - rustaceanvim starts rust-analyzer (Mason's when it is installed) and adds
:RustLsp(runnables, debuggables, testables, expand macro, explain error, ...). Its options go inconfig.rustaceanvim; settings for rust_analyzer inconfig.lspdo not apply to it (see rustaceanvim). - Only in projects with a
.sqrufffile (it sets the dialect and rules). sqls connects to the databases in itsconfig.yml(see sqls);:DBUI(vim-dadbod-ui) browses a database and runs queries. - Laravel Pint in projects with
pint.jsonorvendor/bin/pint, php-cs-fixer in projects with.php-cs-fixer.phpor.php-cs-fixer.dist.php. Elsewhere phpactor formats. - nil and nixfmt come from Nix, not Mason (Mason builds nil with cargo, which needs Nix too, and has nixfmt for Linux x64 only):
nix profile install nixpkgs#nil nixpkgs#nixfmt. They are used from PATH;:CodeArtLanguages installinstalls nothing for this pack.
These packs also bring a test adapter for neotest: lua (neotest-plenary), python (neotest-python), go (neotest-golang), web (neotest-jest and neotest-vitest), rust (rustaceanvim), cpp (neotest-ctest), java (neotest-java), csharp (neotest-vstest), php (neotest-phpunit), ruby (neotest-rspec), dart (neotest-dart), elixir (neotest-elixir). See Testing.
In the web pack, jsonls validates and completes JSON files against the SchemaStore catalog (package.json, tsconfig.json, .eslintrc.json, ...) through SchemaStore.nvim; jsonls downloads a schema the first time a file needs it. Your own json.schemas in config.lsp.jsonls replace the catalog. disable_plugins.schemastore = true turns SchemaStore off.
Every pack also installs the treesitter parsers for its languages (for example python and toml for the Python pack). Neovim already ships the lua, markdown, vim, vimdoc, query and c parsers, so those are never downloaded.
When a program in the last column is missing, its tools are skipped with one notice that names the program. Install it and run :CodeArtLanguages install.
Mason's netcoredbg download for macOS has been broken upstream at times; if it fails, install netcoredbg from your package manager and it is picked up from PATH.
Aliases¶
| You write | Pack |
|---|---|
c, c++, cxx, objc |
cpp |
c#, cs, dotnet |
csharp |
dockerfile, compose |
docker |
golang |
go |
md |
markdown |
py, python3 |
python |
luajit |
lua |
rs |
rust |
sh, shell, zsh |
bash |
javascript, js, typescript, ts, html, css, json, node |
web |
yml |
yaml |
postgresql, postgres, mysql, sqlite |
sql |
rb, rails |
ruby |
kt |
kotlin |
tf, opentofu, tofu, hcl |
terraform |
pwsh, ps1 |
powershell |
vuejs |
vue |
flutter |
dart |
latex, typst, bibtex |
tex |
nixos |
nix |
ex, exs, phoenix, heex |
elixir |
:CodeArtLanguages¶
:CodeArtLanguages lists the active packs and, for each one, which tools (✓ installed, ✗ missing, – needs a program that is not on PATH) and parsers are installed. :CodeArtLanguages install installs whatever is missing right away. :checkhealth codeart has a "Language packs" section with the same information.
To install only when you ask for it, turn the background install off:
M.config = {
language_packs = {
auto_install = false,
},
}
The background install only runs when Neovim has a UI. Headless and scripted runs (nvim --headless, CI) never install anything.
Rust and rustaceanvim¶
Since 2.7 the rust pack uses rustaceanvim, which starts rust-analyzer itself, so neither CodeArt nor mason-lspconfig do. rust-analyzer options move from config.lsp to config.rustaceanvim:
M.config = {
rustaceanvim = {
server = {
default_settings = {
["rust-analyzer"] = { cargo = { allFeatures = true } },
},
},
},
}
config.rustaceanvim is merged over CodeArt's options (the Mason rust-analyzer, blink.cmp capabilities, codelldb for :RustLsp debuggables, and neotest as the test executor). It may also be a function that returns the table.
Your settings win¶
Packs are a base layer. Anything you set yourself is applied on top:
config.conform.formatters_by_ft: a filetype you list replaces the pack's formatters for it.config.lint.linters_by_ft: the same for linters.config.lsp: runs after the pack's server defaults, sovim.lsp.config(...)there wins andvim.lsp.enable("ruff", false)turns a pack's server off.config.mason_lspconfig.automatic_enable: kept as you set it; packs only add tools such as stylua to itsexcludelist so they are not started as language servers.- Debugger launch configurations: a pack only adds configurations for filetypes that have none yet.
M.languages = { "python", "web" }
M.config = {
conform = {
formatters_by_ft = {
python = { "black" }, -- instead of ruff format
},
},
lsp = function()
vim.lsp.config("basedpyright", {
settings = { basedpyright = { analysis = { typeCheckingMode = "strict" } } },
})
end,
}
Your own packs¶
Put a file in user/languages/ (for example ~/.config/nvim/user/languages/ocaml.lua). The file name is the pack name. Like the rest of user/, the folder is ignored by git, so :CodeArtUpdate never touches it. (CodeArt 2.7 and older read packs from languages/ next to init.lua; 2.8 moves them.)
-- ~/.config/nvim/user/languages/ocaml.lua
return {
description = "OCaml",
filetypes = { "ocaml" },
lsp = { "ocamllsp" },
formatters_by_ft = { ocaml = { "ocamlformat" } },
treesitter = { "ocaml" },
mason = { "ocaml-lsp", "ocamlformat" },
}
-- user/settings.lua
M.languages = { "ocaml", "lua" }
A file with the same name as a built-in pack (for example user/languages/python.lua) replaces that pack. Copy the built-in one from lua/codeart/languages/ and change what you need.
A pack that needs CodeArt's helpers requires them by their codeart. names, for example require("codeart.languages.util") or require("codeart.utils"). The old top-level names (utils, plugins.…) were removed in 2.5 (see Migrating). :CodeArtSetup lists your own packs next to the built-in ones.
Every pack is checked when CodeArt starts. A pack that fails to load or has a wrong field is skipped (or the built-in pack is used instead) and you get one warning that lists the problems.
Pack fields¶
| Field | Type | What it does |
|---|---|---|
name |
string | Optional; must match the file name |
description |
string | Shown by :CodeArtLanguages |
filetypes |
list of strings | The filetypes the pack is for |
lsp |
list of strings | Server names from nvim-lspconfig. Mason-installed servers start automatically; servers already on PATH are enabled too |
lsp_config |
{ server = vim.lsp.Config } |
Defaults for those servers (before config.lsp) |
lsp_exclude |
list of strings | Mason packages that must not be started as a language server |
formatters_by_ft |
{ filetype = { formatter, ... } } |
conform.nvim formatters |
formatters |
{ formatter = options } |
conform.nvim formatter overrides (for example require_cwd = true) |
linters_by_ft |
{ filetype = { linter, ... } } |
nvim-lint linters; they run once they are installed |
treesitter |
list of strings | Parsers to install |
dap |
function(dap) |
Sets up debug adapters and launch configurations when nvim-dap loads |
test |
function() |
Returns the neotest adapter (or a list of them); called when neotest loads |
test_plugins |
list of lazy.nvim specs | The adapter plugins test uses; installed only while the pack is on and neotest is not disabled |
plugins |
list of lazy.nvim specs | Other plugins the pack needs (the rust pack's rustaceanvim); installed only while the pack is on |
lsp_managed |
{ server = "plugin" } |
Servers a plugin starts itself; CodeArt and mason-lspconfig leave them alone and :CodeArtLanguages shows who starts them |
mason |
list | Mason packages: "name" or { "name", needs = "program" } (needs may be a list; any one of them is enough) |
needs |
string or list | A program the pack's tools need on PATH when no Mason package names it (a server that comes with its SDK, like dart); :checkhealth codeart reports it with an install hint |
run |
list of templates | Run and build tasks for <leader>R / :CodeArtRun, offered whether or not the pack is on; see Running and building |
require("codeart.languages.install").bin("name") returns the full path of a program from Mason (or PATH), and require("codeart.languages.util").set_configs(dap, filetypes, configs) adds launch configurations without replacing existing ones. See Debugging.