summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/configs/lspconfig.lua
blob: 34c2fb54e5e3ecf9c4e758dd8247d4048a3e5a5c (plain) (blame)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
-- load defaults i.e lua_lsp
require("nvchad.configs.lspconfig").defaults()

local lspconfig = require "lspconfig"

-- EXAMPLE
local servers = { "html", "cssls" }
local nvlsp = require "nvchad.configs.lspconfig"
local spell_words = {}

-- 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

lspconfig.ltex.setup({
  settings = {
    ltex = {
      language = "en-US",
      enabled = true,
      dictionary = {
        ["en-US"] = spell_words,
      },
    },
  },
})

lspconfig.eslint.setup({
  on_attach = function(client, bufnr)
    vim.api.nvim_create_autocmd("BufWritePre", {
      buffer = bufnr,
      command = "EslintFixAll",
    })
  end,
})

lspconfig.rust_analyzer.setup {
  -- server-specific settings. See ':help lspconfig-setup'
  settings = {
    ['rust_analyzer'] = {},
  },
}

lspconfig.basedpyright.setup {
  cmd  = { "basedpyright-langserver", "--stdio" },
  filetypes = { "python" },
  settings = {
    basedpright = {
      analysis = {
        autoSearchPaths = true,
        diagnosticMode = "openFilesOnly",
        uuseLibraryCodeForTypes = true
      },
    },
  },
}

-- configuring single server, example: typescript
-- lspconfig.tsserver.setup {
--   on_attach = nvlsp.on_attach,
--   on_init = nvlsp.on_init,
--   capabilities = nvlsp.capabilities,
-- }