mrjosh / helm-ls

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

Add helmfile support #27

Open DrummyFloyd opened 1 year ago

DrummyFloyd commented 1 year ago

Would be great to add the support of this wrapper

Which is mostly the same syntax as helm

http://github.com/helmfile/helmfile

hinricht commented 1 year ago

That would be awesome indeed ! Right now helm-ls breaks when it can't find any values.yaml or Chart.yaml:

[START][2023-07-10 13:42:19] LSP logging initiated
[ERROR][2023-07-10 13:42:19] .../vim/lsp/rpc.lua:734    "rpc"   "/home/varac/.local/share/nvim/mason/bin/helm_ls"   "stderr"    '{"level":"info","msg":"helm-lint-langserver: connections opened","time":"2023-07-10T13:42:19+02:00"}\n'
[ERROR][2023-07-10 13:42:19] .../vim/lsp/rpc.lua:734    "rpc"   "/home/varac/.local/share/nvim/mason/bin/helm_ls"   "stderr"    '{"level":"info","msg":"Error loaing values.yaml file open /home/varac/.../mastodon-helmfiles/values.yaml: no such file or directory","time":"2023-07-10T13:42:19+02:00"}\n'
[ERROR][2023-07-10 13:42:19] .../vim/lsp/rpc.lua:734    "rpc"   "/home/varac/.local/share/nvim/mason/bin/helm_ls"   "stderr"    'panic: request "initialize" was never replied to\n\ngoroutine 7 [running]:\n'
[ERROR][2023-07-10 13:42:19] .../vim/lsp/rpc.lua:734    "rpc"   "/home/varac/.local/share/nvim/mason/bin/helm_ls"   "stderr"    "go.lsp.dev/jsonrpc2.ReplyHandler.func1({0x1a33478, 0xc000046160}, 0xc00051f360, {0x7ffaf8285cd8?, 0xc000520b40?})\n\t/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/handler.go:44 +0x165\ngo.lsp.dev/jsonrpc2.(*conn).run(0xc000523a90, {0x1a33478, 0xc000046160}, 0xc000135a20)\n\t/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/conn.go:206 +0x22b\ncreated by go.lsp.dev/jsonrpc2.(*conn).Go\n\t/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/conn.go:189 +0xb0\n"
qvalentin commented 1 year ago

Can someone provide a example project, so the bug can be reproduced? The official examples seem to be working (e.g. https://github.com/helmfile/helmfile/tree/main/examples/charts/argocd-helmfile-deployment).

hinricht commented 1 year ago

@qvalentin: I can reproduce the issue with the helmfile.yaml.txt example from the docs: https://github.com/helmfile/helmfile/blob/main/docs/index.md#configuration

(renamed to .yaml.txt to be able to upload here)

qvalentin commented 1 year ago

@hinricht, thank you, I think I now understand the problem.

The bug occurs under the following condition:

  1. I open a file with the name helmfile*.yaml -> vim-helm detects that it is a file with the filetype helm (as defined here)
  2. nvim-lspconfig checks for the root directory of the project. The root directory is defined as a directory containing a file called Chart.yaml
  3. If no Chart.yaml is found nothing happens and helm-ls does not work
  4. If a Chart.yaml file is found helm-ls is started and looks for a values.yaml file. If the file is not found, helm-ls crashes. If a values.yaml file is found, helm-ls works.

It should be possible to fix the crash, but we have to seem what features of helm-ls will work on helmfile files.

Edit: I can confirm basic features, such as hover documentation (but only for functions that are also used in helm) are working.

qvalentin commented 8 months ago

For now you can already get autocompletion by adding

# yaml-language-server: $schema=https://json.schemastore.org/helmfile.json

to your helmfile.yaml

Edit: Should not be required anymore with v0.0.10