-
-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Helm Language Pack | ||
|
||
This plugin pack does the following: | ||
|
||
- Adds `go-template` Treesitter parsers | ||
- Adds `helm-ls` language server | ||
- Adds [vim-helm](https://github.com/towolf/vim-helm) for language specific tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
local utils = require "astronvim.utils" | ||
return { | ||
-- Helm support | ||
{ | ||
"nvim-treesitter/nvim-treesitter", | ||
optional = true, | ||
dependencies = { | ||
{ | ||
"ngalaiko/tree-sitter-go-template", | ||
config = function() | ||
require("nvim-treesitter.parsers").get_parser_configs().gotmpl = { | ||
install_info = { | ||
url = vim.fn.stdpath "data" .. "/lazy/tree-sitter-go-template", | ||
files = "src/parser.c", | ||
}, | ||
filetype = "helm", | ||
} | ||
end, | ||
}, | ||
}, | ||
}, | ||
{ | ||
"williamboman/mason-lspconfig.nvim", | ||
opts = function(_, opts) | ||
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "helm_ls") | ||
|
||
local configs = require "lspconfig.configs" | ||
local lspconfig = require "lspconfig" | ||
local util = require "lspconfig.util" | ||
|
||
if not configs.helm_ls then | ||
configs.helm_ls = { | ||
default_config = { | ||
cmd = { "helm_ls", "serve" }, | ||
filetypes = { "helm" }, | ||
root_dir = function(fname) return util.root_pattern "Chart.yaml"(fname) end, | ||
}, | ||
} | ||
end | ||
|
||
lspconfig.helm_ls.setup { | ||
filetypes = { "helm" }, | ||
cmd = { "helm_ls", "serve" }, | ||
} | ||
end, | ||
}, | ||
{ | ||
"towolf/vim-helm", | ||
init = function() | ||
local function helm_ft(path, _) | ||
-- check if file is in templates folder or is helmfile | ||
local path_regex = vim.regex "/templates/*\\.(tpl|yaml)$|*.gotmpl|helmfile*.yaml" | ||
if path_regex and path_regex:match_str(path) then return "helm" end | ||
|
||
-- return yaml if nothing else | ||
return "yaml" | ||
end | ||
|
||
vim.filetype.add { | ||
extension = { | ||
yaml = helm_ft, | ||
}, | ||
} | ||
end, | ||
ft = "helm", | ||
}, | ||
} |