lspconfig.lua (624B)
1 -- load defaults i.e lua_lsp 2 require("nvchad.configs.lspconfig").defaults() 3 4 local lspconfig = require "lspconfig" 5 6 -- EXAMPLE 7 local servers = { "html", "cssls", "clangd", "yamlls", "ts_ls" } 8 local nvlsp = require "nvchad.configs.lspconfig" 9 10 -- lsps with default config 11 for _, lsp in ipairs(servers) do 12 lspconfig[lsp].setup { 13 on_attach = nvlsp.on_attach, 14 on_init = nvlsp.on_init, 15 capabilities = nvlsp.capabilities, 16 } 17 end 18 19 -- configuring single server, example: typescript 20 -- lspconfig.ts_ls.setup { 21 -- on_attach = nvlsp.on_attach, 22 -- on_init = nvlsp.on_init, 23 -- capabilities = nvlsp.capabilities, 24 -- }