Setup lsp server
Before starting, it is strongly recommended that you walk through the LSP configuration lspconfig repository.
Then check configs.md to make sure your language's LSP server is present there.
- Plugin table
-- In order to modify the `lspconfig` configuration:
{
"neovim/nvim-lspconfig",
config = function()
require "configs.lspconfig"
end,
},
- configs/lspconfig.lua
local nvlsp = require "nvchad.configs.lspconfig"
local lspconfig = require "lspconfig"
nvlsp.defaults() -- loads nvchad's defaults
local servers = { "html", "cssls", "clangd" }
-- lsps with default config
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = nvlsp.on_attach,
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
}
end
-- Without the loop, you would have to manually set up each LSP
--
-- lspconfig.html.setup {
-- on_attach = nvlsp.on_attach,
-- capabilities = nvlsp.capabilities,
-- }
Mason.nvim
Run the MasonInstallAll
command
Once the binaries are installed, you will have to configure them to properly work with LSP, conform.nvim, nvim-lint, nvim-dap etc. It depends on what you installed. NvChad does not provide any language configuration aside from lua.