| name | add-language |
| description | Use when adding language support to the Neovim config - creating LSP server configs, adding formatters and linters |
Add Language Support
Adds language support to the Neovim configuration at config/nvim/.worktrees/rewrite/.
Steps
- Create LSP config at
lsp/<server-name>.lua:
Use https://github.com/neovim/nvim-lspconfig/tree/master/lsp as a starting point for the server config. Find the matching server file there and adapt it.
return {
cmd = { "server-binary" },
filetypes = { "filetype" },
root_markers = { ".git" },
settings = {},
}
The file name must match the Mason package name. plugin/lsp.lua auto-discovers all files in lsp/.
- Add formatter to
formatters_by_ft in lua/plugins/conform.lua:
filetype = { "formatter-name" },
filetype = { "prettierd", "prettier", stop_after_first = true },
- Add linter to
linters_by_ft in lua/plugins/lint.lua:
filetype = { "linter-name" },
- Add filetype settings (optional) at
after/ftplugin/<filetype>.lua for indent, textwidth, etc.
Mason auto-installs the LSP server, formatter, and linter on next startup.
Looking Up Names
Quick Reference
| What | Where |
|---|
| LSP config | lsp/<server>.lua |
| Formatters | lua/plugins/conform.lua → formatters_by_ft |
| Linters | lua/plugins/lint.lua → linters_by_ft |
| Filetype opts | after/ftplugin/<ft>.lua |
| Mason skip list | lua/plugins/mason.lua → skip table |