mrjosh / helm-ls

⎈ Language server for Helm ⎈
MIT License
237 stars 15 forks source link

Support for subcharts #46

Closed ameddin73 closed 9 months ago

ameddin73 commented 1 year ago

One really nice feature helm-ls is missing that other lsps have is "go to definition". It feels intuitive that you should be able to use the same shortcut that takes you to a variable definition in Go to get to a helper or values file definition in helm.

Has this been attempted? Is it hard? Would a PR be welcome?

qvalentin commented 1 year ago

This was added with https://github.com/mrjosh/helm-ls/pull/24 in v0.0.6.

Or do you mean something else?

ameddin73 commented 1 year ago

Thanks, you're right. Upon further investigation this actually should be a bug report. It looks go to definition does work, but it doesn't work for nested helm charts which index values in the parent chart. For example:

# charts/subchart/templates/deployment.yaml
  image: {{ .Values.global.image.repository }}:latest
---
# values.yaml
image:
  repository: ghcr.io/stefanprodan/podinfo

Got to definition on repository fails. AFAICT there's no error, it's just a no-op.

Same with

# charts/subchart/templates/deployment.yaml
    image: {{ .Values.image.repository }}:latest
---
# values.yaml
subchart:
  image:
    repository: ghcr.io/stefanprodan/podinfo
qvalentin commented 1 year ago

Thanks for the detailed explanation. Subcharts are currently not supported, so I would flag this as a feature request.

qvalentin commented 11 months ago

Brief outline of the necessary changes to enable subchart support:

qvalentin commented 9 months ago

Fixed in v0.0.10 with support for go to definition hover and completion.

thatnerdjosh commented 7 months ago

@qvalentin - this doesn't seem to work for values which exist in the top-level values, but not in the subchart values.

Example:

image

values.yaml

---
global:
  namespace: default
  ...
...

charts/<subchart>/values.yaml

---
# no global section
...

I'm on this version:

helm_ls version
Helm-ls version: 0.0.12
Git commit: Homebrew
Build type: Release
Build time: 2024-03-10T18:12:42Z
Golang: go1.22.1
Compiled by: Homebrew
qvalentin commented 7 months ago

Hi @thatnerdjosh, thanks for reporting, seem like only the linting is broken (you will get false positives). Hover and go-to-defintion should work. I will look into it.