Skip to content

Commit 5583a49

Browse files
committed
fix(neovim): prevent yamlls from attaching to helm template files
- Add root_dir function to yamlls that returns nil for /templates/*.yaml files - This prevents yamlls from providing diagnostics for helm charts - Helm templates (especially with Jinja2/cookiecutter syntax) are handled by helm_ls - Fixes yamlls errors on valid helm template syntax
1 parent 23e2267 commit 5583a49

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

common/neovim/lua/plugins/lsp.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ return {
77
inlay_hints = { enabled = false }, -- Disable inlay hints by default (toggle with <leader>uh)
88
-- Configure LSP servers
99
servers = {
10+
-- YAML Language Server - disable for helm templates (which may contain Jinja2)
11+
yamlls = {
12+
filetypes = { "yaml", "yaml.docker-compose", "yaml.gitlab", "yaml.helm-values" },
13+
-- Helm templates are handled by helm_ls, not yamlls
14+
root_dir = function(fname)
15+
local lspconfig = require("lspconfig")
16+
-- Don't attach yamlls to helm chart templates
17+
if fname:match("/templates/.*%.yaml$") or fname:match("/templates/.*%.yml$") then
18+
return nil
19+
end
20+
return lspconfig.util.root_pattern(".git")(fname)
21+
end,
22+
},
1023
-- TypeScript/JavaScript (updated name)
1124
ts_ls = {
1225
settings = {

0 commit comments

Comments
 (0)