helm-ls icon indicating copy to clipboard operation
helm-ls copied to clipboard

Add helmfile support

Open DrummyFloyd opened this issue 1 year ago • 5 comments

Would be great to add the support of this wrapper

Which is mostly the same syntax as helm

http://github.com/helmfile/helmfile

DrummyFloyd avatar Apr 21 '23 18:04 DrummyFloyd

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/[email protected]/handler.go:44 +0x165\ngo.lsp.dev/jsonrpc2.(*conn).run(0xc000523a90, {0x1a33478, 0xc000046160}, 0xc000135a20)\n\t/go/pkg/mod/go.lsp.dev/[email protected]/conn.go:206 +0x22b\ncreated by go.lsp.dev/jsonrpc2.(*conn).Go\n\t/go/pkg/mod/go.lsp.dev/[email protected]/conn.go:189 +0xb0\n"

hinricht avatar Jul 10 '23 11:07 hinricht

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).

qvalentin avatar Jul 28 '23 13:07 qvalentin

@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)

hinricht avatar Jul 28 '23 14:07 hinricht

@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 avatar Jul 28 '23 15:07 qvalentin

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

qvalentin avatar Feb 03 '24 20:02 qvalentin