aboutsummaryrefslogtreecommitdiff
path: root/nvim/lua/configs/lspconfig.lua
blob: 14912dd7262a61d89b85acc653541a79bf47b34d (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
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
require("nvchad.configs.lspconfig").defaults()

local servers = { "html", "cssls", "rust_analyzer", "zls" }
vim.lsp.enable(servers)

local lspconfig = require("lspconfig")

-- Zig
lspconfig.zls.setup{
  cmd = { "zls" },
  filetypes = { "zig", "zir" },
  root_dir = lspconfig.util.root_pattern("build.zig", "zls.json", ".git")
}

-- TS/JS
lspconfig.ts_ls.setup {
  cmd = { "typescript-language-server", "--stdio" },
  filetypes = {
    "javascript", "javascriptreact",
    "typescript", "typescriptreact",
    "javascript.jsx", "typescript.tsx"
  },
  root_dir = lspconfig.util.root_pattern("package.json", "tsconfig.json", ".git")
}

-- Python
lspconfig.pylsp.setup {
  cmd = { "pylsp" },
  filetypes = { "python" },
  settings = {
    pylsp = {
      plugins = {
        black = { enabled = true },
        ruff = { enabled = true },
        flake8 = { enabled = true },
        isort = { enabled = true }
      }
    }
  }
}

-- Elixir
lspconfig.elixirls.setup {
  cmd = { "elixir-ls" },
  filetypes = { "elixir" },
}

-- Erlang
lspconfig.erlangls.setup {
  cmd = { "erlang-ls" },
  filetypes = { "erlang" },
}

-- C/C++
lspconfig.clangd.setup {
  cmd = { "clangd" },
  filetypes = { "c", "cpp" }
}

-- Gopls
lspconfig.gopls.setup {
  cmd = { "gopls" },
  filetype = { "go" }
}