-
Notifications
You must be signed in to change notification settings - Fork 16
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
Feat: yamlls #32
Feat: yamlls #32
Conversation
@qvalentin Can you please resolve the conflicts and golang ci lint errors so we can merge the pr? |
This still has some major bugs I need to resolve before it is ready. |
This seems like a very cool change, but a bit hard for me to try out due to the conflicts. Do you have a ref where you have this PR, and possibly also #24, applied on top of mrjosh/helm-ls/tree/master ? |
I will probably need one or two more weekends till it will be in a useable state. |
No problem. |
Here is some information about the current state and the problems of this, maybe you have some ideas: The currently implemented approach takes the yaml from the helm template and tries to remove everything that is not valid yaml and produces no output when the template is rendered. For example: It removes the control structures of an if, but keeps the content of an if. For more examples check out the tests. Everything that would be replaced when the template is being rendered is kept in the trimmed yaml. When diagnostics are sent from yamlls those are filtered and all diagnostics that relate to a template (everything inside This was relatively easy to implement and works for most templates. The important part is that the positions (line and char) of the yaml are not changed, when it is trimmed. This way yamlls and helmls use the same positions for all lsp operations (e.g. hover, completion, diagnostics). Problematic is everything where complex yaml structures are produced when rendering the template. So I have two ideas of how this could be avoided:
Overall this was very interesting to implement and maybe we have to make a few compromises. All features using yamlls will be "best-effort" and won't guarantee correctness. |
Got it up and running now, will try it out and see if I can contribute. For anyone else tuning in, apply this patch after checking out: diff --git a/internal/adapter/yamlls/yamlls.go b/internal/adapter/yamlls/yamlls.go
index 304abb5..b1e2d78 100644
--- a/internal/adapter/yamlls/yamlls.go
+++ b/internal/adapter/yamlls/yamlls.go
@@ -17,8 +17,8 @@ type YamllsConnector struct {
}
func NewYamllsConnector(workingDir string, clientConn jsonrpc2.Conn, documents *lsplocal.DocumentStore) *YamllsConnector {
- // yamllsCmd := exec.Command("yaml-language-server", "--stdio")
- yamllsCmd := exec.Command("debug-lsp.sh")
+ yamllsCmd := exec.Command("yaml-language-server", "--stdio")
+ // yamllsCmd := exec.Command("debug-lsp.sh")
stdin, err := yamllsCmd.StdinPipe()
if err != nil { I also had to update my PATH in order to make mason.nvim binaries available. $ nvim --headless -c 'lua =table.concat(require("lspconfig.configs").yamlls.cmd, " ")' +qa
/home/me/.local/share/nvim/mason/bin/yaml-language-server --stdio |
Hey, I've been using this for some weeks now.
But all in all, awesome work! |
Any news on this ? Can we hope this get merged, even if not completely working, we currently have no proper editing experience for helm chart, it's either gotemplate which doesn't do a lot, or yamlls, which is plenty of errors because of gotemplate. |
Hi there hope you're doing well. |
Hi, nice to hear from you again @mrjosh. I'm a bit reluctant to put more work into this MR (and there's still a lot of work to be done) when I don't know when I'll get the chance to merge it. If you would authorize me to push on the project, that would increase my motivation. Otherwise I would probably set up my own fork. This also refers to the other MRs, most of which are ready to merge for some time already. Those should be looked at before moving on here. |
Hi, thanks for the work you put into this project |
@mrjosh thanks for answering and allowing allowing @qvalentin to push to the repo ! @qvalentin if you need some help / tester ... don't hesitate ;) |
0405282
to
7dd2c21
Compare
If anyone has experience with tree-sitter grammars: Help with this: ngalaiko/tree-sitter-go-template#5 would be appreciated. |
A little experience, but I would love to get this working, so I will try and have a look once I get around to it. |
0615c7e
to
4fc63c4
Compare
This looks super helpful @qvalentin - do you know if this would add support for subcharts (or at least make implementing that functionality a little easier?) |
Hi @ejhayes, this is not related to subcharts, adding that feature would still take the same steps. I added some more info to #46 |
5ecc59f
to
a7e7ee9
Compare
efb17cd
to
61037bb
Compare
This is ready for a final round of testing, I updated the description of this PR. |
Awesome job, well done! I see have a un-checked box with my name on it, so I will try out the latest version ASAP. :) |
Looking very good! One question though, how do you plan on making the tree-sitter grammar available? |
Nice, thanks for testing. Regarding tree-sitter, I'm planning to upstream all changes to the grammar to https://github.com/ngalaiko/tree-sitter-go-template. I haven't really looked into using the grammar in neovim directly, but this is definitely something we should include in the Readme, would be related to #33. |
I have also tested this since you changed the title to testers wanted. I would say it is working pretty great, really do appreciate your time on this, it is a very good feature to have. |
5d292f0
to
ab71fac
Compare
Thanks to everyone who tested :) |
Can not thank you enough for your work on this! |
@cenk1cenk2 ikr? @qvalentin is a legend. :) |
Testers needed
This is finally in the state where you can do some final testing before this can be merged:
Check out the updated documentation: https://github.com/qvalentin/helm-ls/tree/feat-yamlls
To test this branch you need to compile helm-ls yourself or download it from here; https://github.com/qvalentin/helm-ls/releases/tag/master:
Feel free to ask if something is unclear, so I can improve the docs and report any bugs you find.
Original PR description
Integration of yamll.
This enables:
Also contains some other commits, so it must be rebased.
Some todos:
List of false positives of diagnostics:
List of general bugs:
Feature to add after this was merged: