summaryrefslogtreecommitdiffstatshomepage
path: root/NvChad/lua/custom/plugins/lspconfig.lua
blob: 2a6e969839aa2d2e2b4010d27b63a4a18d5967ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
local M = {}

M.setup_lsp = function(attach, capabilities)
   local lspconfig = require "lspconfig"

   lspconfig.tsserver.setup {
      on_attach = function(client, bufnr)
         client.resolved_capabilities.document_formatting = false
         vim.api.nvim_buf_set_keymap(bufnr, "n", "A-F", "<cmd>lua vim.lsp.buf.formatting()<CR>", {})
      end,
   }

   -- lspservers with default config
   local servers = { "html", "cssls", "bashls", "clangd", "emmet_ls" }


   for _, lsp in ipairs(servers) do
      lspconfig[lsp].setup {
         on_attach = attach,
         capabilities = capabilities,
         flags = {
            debounce_text_changes = 150,
         },
      }
   end

end

return M