helm-ls
helm-ls copied to clipboard
yamlls and helm_ls
hi, thank you for this language server!
should yamlls be enabled for ft=helm? for example if a file begins with {{- if .Values...}}
yamlls diagnostics are useless.
what's the recommended way to use this LS with yamlls?
Hi, i have the same problem here : https://github.com/mrjosh/helm-ls/issues/29
My issue is close because i was too busy to respond in time … Sorry my bad
But problem is still there … I use lazyvim setup and i get errors on every lines even if deployment is ok in k8s ...
oh! and i have add { "towolf/vim-helm", lazy = false } even if it seems to be no more maintained
hi, thank you for this language server!
should yamlls be enabled for ft=helm? for example if a file begins with
{{- if .Values...}}
yamlls diagnostics are useless.what's the recommended way to use this LS with yamlls?
To answer the original issue: yamlls should be disabled for helm files. There is some effort to support this in https://github.com/mrjosh/helm-ls/pull/32.
Hi, i have the same problem here : #29
My issue is close because i was too busy to respond in time … Sorry my bad
But problem is still there … I use lazyvim setup and i get errors on every lines even if deployment is ok in k8s ...
oh! and i have add { "towolf/vim-helm", lazy = false } even if it seems to be no more maintained
If you run set ft?
in vim, what does it return? How did you configure yamlls, you should use https://github.com/neovim/nvim-lspconfig for this.
To answer the original issue: yamlls should be disabled for helm files. There is some effort to support this in #32.
thank you. if there is any way i can assist with development (testing,coding,etc.) please let me know. i'd be more than happy.
perhaps a note/caveat section in the readme on how to use this LS with yamlls will be helpful, no?
To answer the original issue: yamlls should be disabled for helm files. There is some effort to support this in #32.
thank you. if there is any way i can assist with development (testing,coding,etc.) please let me know. i'd be more than happy.
perhaps a note/caveat section in the readme on how to use this LS with yamlls will be helpful, no?
Feel free to take a look at the code for reviewing or look for more bugs. I just stated a list with todos and bugs in the first merge request comment.
@qvalentin Yes lazyvim use lspconfig LspInfo return yamlls and helm_ls on a deployment.yaml
set ft
return filetype=conf
feel free to ask me other debug comment no problem …
I had the same issue, but found a solution for it. I exclude yaml support when filetype helm
is active.
Below you can find how i have solved it.
https://github.com/rgruyters/nvim/commit/dd7fb86fb6d69a84642ae0869c9ade47eb678735
@rgruyters thanks no more red yamlls errors :-D
now is there a way to have auto-format or just auto-indent on save ?
how do you exclude yamlls when setting up yamlls through lspconfig i can't really figure that out at the moment
This is really a little bit complicated, because there is a lot of filetype detection magic going on:
I found two solutions to fix it:
- (recommended) Use lazy to install
towolf/vim-helm
and setft=helm
:
require("lazy").setup({
-- towolf/vim-helm provides basic syntax highlighting and filetype detection
-- ft = 'helm' is important to not start yamlls
{ 'towolf/vim-helm', ft = 'helm' },
{ "neovim/nvim-lspconfig", event = { "BufReadPre", "BufNewFile", "BufEnter" } }
})
Check out the minimal config example: https://github.com/mrjosh/helm-ls/blob/master/examples/nvim/init.lua
- Install vim-polyglot instead of
towolf/vim-helm
.
Hey all, I am having some trouble getting yamlls to play nice with Helm chart files.
I had vim-helm
installed and I think I have setup yamlls and helm_ls correctly, but I get millions of yamlls errors on Helm charts and templates. I've looked through some of the examples in this thread but don't really understand them so I feel a little uncomfortable using them.
I have now uninstalled vim-helm
and installed vim-polyglot
instead and I get a few less errors in my Helm chart files from yamlls, but still too many than I would like that aren't relevant.
Here is my config for LSP's: https://github.com/Mo0rBy/nvim_config/blob/fix-helmls-lsp/lua/moorby/plugins/lsp/lspconfig.lua
And here is part of a Helm chart file that is still getting a few too many LSP errors for my liking:
First of all, I want to check if what I'm doing is correct, and if not what am I doing wrong?
If I'm not doing anything wrong, can someone help me out in getting yamlls and helm_ls to work together properly.
Also, is there currently any work/idea to make this installation process easier and more user friendly. I'd be interested in helping to test this as a minimum contribution, but if I have time and energy I could even try and contribute code to this project as it seems to be the only one around that is trying to get Helm implementation done properly in neovim (and I really don't want to go back to VSCode).
I was also wondering, would it be possible to configure helmls or yamlls to warn/error for your own formatting, for example in my team, we like to have indents on array values, e.g.
someKeyForArray:
- arrayItem1
- arrayItem2
Rather than having it inline with the key value:
someKeyForArray:
- arrayItem1
- arrayItem2
Hi @Mo0rBy, thanks for the detailed description.
There a two type of problems currently known:
- Getting diagnostics from yamlls because it was wrongly started for helm files. This is what this thread was about up to now.
- Getting wrong diagnostics that helm-ls got from yamlls. These always start with "Yamlls" and are your problem as shown in the screenshot.
Those diagnostics are caused by the yamlls integration of helm-ls which can be disabled via the config. This should fix the problem for you, but you will be missing some features.
The wrong diagnostics seem to be a bug, please send me all helm template files that caused wrong diagnostics starting with "Yamlls" so I can try to fix the bugs.
Thanks for the quick response @qvalentin , I've set the configuration to disable yamlls and now I get no errors (nice!), but I think without yamlls enabled, there are A LOT of features missing. With this initial look, it seems all I can get is documentation for go template stuff, for example:
ne
default
quote
toYaml
I'll revert this change so I can get you the info on the LSP bugs that you describe, but I will need some time to modify the charts slightly as I can't share them as they are right now. Give me some time to do this (probably this weekend) and then I'll get them to you. Do you just want them posted here? I have a lot of examples, so it will be a big post.
Thanks for the quick response @qvalentin , I've set the configuration to disable yamlls and now I get no errors (nice!), but I think without yamlls enabled, there are A LOT of features missing. With this initial look, it seems all I can get is documentation for go template stuff, for example:
ne
default
quote
toYaml
I'll revert this change so I can get you the info on the LSP bugs that you describe, but I will need some time to modify the charts slightly as I can't share them as they are right now. Give me some time to do this (probably this weekend) and then I'll get them to you. Do you just want them posted here? I have a lot of examples, so it will be a big post.
Sounds good, maybe open a seperate issue and post the files as gists/pastebins or a new git repo.
Thanks for the quick response @qvalentin , I've set the configuration to disable yamlls and now I get no errors (nice!), but I think without yamlls enabled, there are A LOT of features missing. With this initial look, it seems all I can get is documentation for go template stuff, for example:
ne
default
quote
toYaml
I'll revert this change so I can get you the info on the LSP bugs that you describe, but I will need some time to modify the charts slightly as I can't share them as they are right now. Give me some time to do this (probably this weekend) and then I'll get them to you. Do you just want them posted here? I have a lot of examples, so it will be a big post.
One short edit: You can also set the configuration option yamlls.diagnosticsLimit
to a small number, to remove the wrong diagnostics, but not remove all yamlls features.
I've decided not to post my own Helm charts as I'm a little worried my company would come after me!
Instead, can I suggest looking at the Bitnami Helm charts repo? There are looooooads of examples available on there that can be worked with.
1 question I have to see if this would even be possible. So with Helm Library charts, they can be stored and referenced within the local machines filesystem and I imagine that with this method, it would be possible to get the LSP to find definitions for Helm templates, however, would this be possible for library charts hosted in online repositories? For example, Bitnami have a common library which contains a bunch of useful utility templates that are heavily used in their own Helm charts and can easily be used in your own custom Helm charts. Furthermore, would it be possible to setup the LSP to get template definitions from private repositories? (my initial guess would be no without setting up some authentication stuff which I think would be kind of advanced for any LSP to do).
I would love to contribute to this so if you could point me to something that needs doing, let me know!
I've decided not to post my own Helm charts as I'm a little worried my company would come after me!
Instead, can I suggest looking at the Bitnami Helm charts repo? There are looooooads of examples available on there that can be worked with.
1 question I have to see if this would even be possible. So with Helm Library charts, they can be stored and referenced within the local machines filesystem and I imagine that with this method, it would be possible to get the LSP to find definitions for Helm templates, however, would this be possible for library charts hosted in online repositories? For example, Bitnami have a common library which contains a bunch of useful utility templates that are heavily used in their own Helm charts and can easily be used in your own custom Helm charts. Furthermore, would it be possible to setup the LSP to get template definitions from private repositories? (my initial guess would be no without setting up some authentication stuff which I think would be kind of advanced for any LSP to do).
I would love to contribute to this so if you could point me to something that needs doing, let me know!
I understand that You can't share the whole charts of you company, maybe you could pick a file where helm-ls breaks and try to delete stuff until you find out what causes the problem? Then you can narrow it down an make it easier to remove private information of your company. I actually used the bitnami charts repo for testing, but probably not tested all files.
I've disabled the yamlls, using this code in my LSP:
["helm-ls"] = {
logLevel = "info",
valuesFiles = {
mainValuesFile = "values.yaml",
lintOverlayValuesFile = "values.lint.yaml",
additionalValuesFilesGlobPattern = "values*.yaml",
},
yamlls = {
enabled = false,
diagnosticsLimit = 50,
showDiagnosticsDirectly = false,
path = "yaml-language-server",
filetypes_exclude = { "helm" },
config = {
schemas = {
kubernetes = "templates/**",
},
completion = true,
hover = true,
-- any other config from https://github.com/redhat-developer/yaml-language-server#language-server-settings
},
},
},
And I'm getting this weird behavior that it shows some Yamlls errors, and each time I save the file the errors change until they disapear.
Did anyone else encounter this?
Had the issue, too... After staring on my nvim-lspconfig
setup for too long, the fault wasn't there all along:
The ft = 'helm'
option on "towolf/wim-helm"
is the magic sauce, no further Lua magic was necessary after that.
This config block helped me figure out what's going on: https://github.com/mrjosh/helm-ls/blob/master/examples/nvim/init.lua#L29-L38
In my config I was doing this:
Not Working:
settings = { [Not committed yet]
yamlls = {
enabled = false, -- not yet working, see: https://github.com/mrjosh/helm-ls/issues/44
enabledForFilesGlob = "*.{yaml.yml}",
path = "yaml-language-server",
config = {
keyOrdering = false,
},
},
},
Working:
settings = {
['helm-ls'] = {
yamlls = {
enabled = false, -- not yet working, see: https://github.com/mrjosh/helm-ls/issues/44
enabledForFilesGlob = "*.{yaml.yml}",
path = "yaml-language-server",
config = {
keyOrdering = false,
},
},
}, [Not committed yet]
},
Notice there is 1 additional layer of key indirection: settings.helm-ls.yamlls
even though the settings are already for helm_ls
in the lsp.