mrjosh / helm-ls

⎈ Language server for Helm ⎈
MIT License
217 stars 16 forks source link

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

Open zeljkobekcic opened 7 months ago

zeljkobekcic commented 7 months ago

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://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:///private/tmp/test-deploy/values.yamlChart not found for file: file:///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:///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 commented 6 months ago

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.

msvechla commented 4 months ago

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 commented 4 months ago

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 https://github.com/mrjosh/helm-ls/pull/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 https://github.com/mrjosh/helm-ls/pull/72

msvechla commented 4 months ago

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.

qvalentin commented 3 weeks ago

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!

Hi @msvechla, feel free to test https://github.com/mrjosh/helm-ls/pull/80, which should do what you suggested and provide some feedback.