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
|
return {
"mason-org/mason-lspconfig.nvim",
dependencies = {
{ "mason-org/mason.nvim", opts = {} },
"neovim/nvim-lspconfig",
"saghen/blink.cmp",
},
opts = {
ensure_installed = {
"pyright",
"lua_ls",
"bashls",
"terraformls",
"yamlls",
"ts_ls",
"cssls",
"html",
"helm_ls",
},
-- default true: auto-calls vim.lsp.enable() for every Mason-installed
-- server as it finishes installing.
},
config = function(_, opts)
-- helm_ls's default config only attaches to filetype "helm" /
-- "yaml.helm-values" (not plain "yaml"), so without this,
-- templates/*.yaml only gets yamlls — which flags Helm's Go template
-- syntax ({{ .Values.x }}) as invalid YAML. values.yaml gets the
-- composite filetype instead, which both yamlls and helm_ls match, so
-- it keeps YAML validation *and* gets helm_ls's values-schema support.
vim.filetype.add({
pattern = {
[".*/templates/.*%.ya?ml"] = "helm",
[".*/templates/.*%.tpl"] = "helm",
[".*/values.*%.ya?ml"] = "yaml.helm-values",
},
})
-- Merge blink.cmp's LSP capabilities into every server's default config
-- (Mason-managed or not) before any server gets enabled.
vim.lsp.config("*", {
capabilities = require("blink.cmp").get_lsp_capabilities(),
})
require("mason-lspconfig").setup(opts)
-- clangd ships with Xcode Command Line Tools already, so it's not
-- Mason-managed — nvim-lspconfig provides its default config, we just
-- need to turn it on.
vim.lsp.enable("clangd")
end,
}
|