aboutsummaryrefslogtreecommitdiff
path: root/nvim/lua/configs/lspconfig.lua
blob: f5de9ba12c3038d7f7ee4fd14f79f45ad72e01b6 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
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" }
}

-- Dart / Flutter
lspconfig.dartls.setup({
  cmd = { "dart", "language-server", "--protocol=lsp" },
  filetypes = { "dart" },
  root_dir = lspconfig.util.root_pattern("pubspec.yaml"),
  settings = {
    dart = {
      completeFunctionCalls = true,
      showTodos = true,
    },
  },
})