Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm Dependencies and values.yaml completion and GoTo-Definition #61

Open
zeljkobekcic opened this issue Feb 20, 2024 · 4 comments
Open
Labels
enhancement New feature or request

Comments

@zeljkobekcic
Copy link

Hey,

I was trying to use the LS in NeoVim but the completion based on dependencies (in the Helm Chart) do not work and also going to the definition. Going to the definition of a value in the dependency would be nice.

A minimal case can be:

helm create github-issue-chart

Then copy over this Chart.yaml

apiVersion: v2
name: test-deploy
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "1.16.0"

dependencies:
  - name: nginx
    repository: "oci:https://registry-1.docker.io/bitnamicharts"
    version: "15.10.29"

I would expect this Helm LS to be able to suggest values for nginx.SOMETHING inside the values.yaml. This does not work either after running helm dependency update and even after un-tar-ing the tarball (chart).

Here are the logs from :LspLog

[ERROR][2024-02-20 19:42:22] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/zeljkobekcic/.local/share/nvim/mason/bin/helm_ls"	"stderr"	'{"level":"error","msg":"Error getting chart info for filefile:https:///private/tmp/test-deploy/values.yamlChart not found for file: file:https:///private/tmp/test-deploy/values.yaml. Using fallback","time":"2024-02-20T19:42:22+01:00"}\n{"level":"info","msg":"/private/tmp/test-deploy/values.yaml","time":"2024-02-20T19:42:22+01:00"}\n{"level":"info","msg":"helm lint: result for file file:https:///private/tmp/test-deploy/values.yaml : []","time":"2024-02-20T19:42:22+01:00"}\n{"level":"debug","msg":"Merged diagnostics[]","time":"2024-02-20T19:42:22+01:00"}\n{"level":"info","msg":"Workspace configuration: [{{true yaml-language-server 50 false {map[kubernetes:templates/**] true true}} {values.yaml values.lint.yaml values*.yaml} info}]","time":"2024-02-20T19:42:22+01:00"}\n'

I am also using the latest version of helm-ls.

Thank you in advance!

@qvalentin
Copy link
Collaborator

Hi thanks for the submission of the feature request,

currently there is no support at all for editing values.yaml files, so your nvim config is kind of wrong for even having helm-ls enabled for those files.

@qvalentin qvalentin added the enhancement New feature or request label Feb 20, 2024
@msvechla
Copy link

I realize that completion inside values files is not supported yet, however it would be really helpful if completion of values of dependency charts would work inside templates.

So same as the example above, it would be nice if {{ .Values.nginx. would show completion for the merged values of the nginx dependency chart.

It looks like from the design this is currently not supported? At least the Chart in https://github.com/mrjosh/helm-ls/blob/master/internal/charts/chart.go does not yet have any reference to the actual dependency chart structs, correct?

What would be the best way of adding this? I could also try to contribute here.

Thanks for your support!

@qvalentin
Copy link
Collaborator

I realize that completion inside values files is not supported yet, however it would be really helpful if completion of values of dependency charts would work inside templates.

So same as the example above, it would be nice if {{ .Values.nginx. would show completion for the merged values of the nginx dependency chart.

It looks like from the design this is currently not supported? At least the Chart in https://github.com/mrjosh/helm-ls/blob/master/internal/charts/chart.go does not yet have any reference to the actual dependency chart structs, correct?

What would be the best way of adding this? I could also try to contribute here.

Thanks for your support!

You are right, the internal chart is missing the dependency information. Reinplementing this could become quit a lot of work, thats why I suggested #77. Either way it would probably be good to use the chart struct as implemented by helm (https://github.com/helm/helm/tree/main/pkg/chart or https://github.com/mrjosh/helm-ls/tree/master/pkg/chart) for this.
Please also note that im currently refactoring completion etc. in #72

@msvechla
Copy link

Ah thanks for the hint, that makes sense. Then this could definitely be tackled in the refactoring with #77 .

Then I guess it makes sense to wait until #72 is completed. Thanks for the insights.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants