zeroDivisible · 2022-11-08 19:00
Hi, I have a question as described in the title. I'm working a lot with Kubernetes and because of the nature of it - a lot of YAML files.
These files usually end being a YAML file with Go or helm templates, which totally breaks parsing of said file for with Flycheck. I do appreciate all the YAML structure hints and usual errors which Flycheck would catch - but I can't figure out a way how to stop whole buffer from highlighting if YAML file contains some go template logic - or similar. I'd say the same would be true if i.e. the file would be an ERB template of said YAML.
For context, I'm using doom-emacs, although not sure if that matters, I'd be happy to configure this even manually if needed.
yyoncho · 2022-11-08 20:28
I would ask that question in the yaml server channels. I'd there is no server side solution, then it can be implemented as a patch client side
Prudent-Dimension554 · 2022-11-09 03:24
I don't think the YAML language server can handle this. Here's the issue about this: [https://github.com/redhat-developer/yaml-language-server/issues/220](https://github.com/redhat-developer/yaml-language-server/issues/220)
I've experimented with getting Emacs to quote or comment out template items using hooks. It sort of worked but I couldn't get certain things like undo working so I gave up.
I do think that a language server patch would be ideal since even if there was a perfect Emacs mode that could send proper YAML, the results back would give back false errors. (ex. `port: {{ .Port }}` would error that port must be a number).
Thaodan · 2022-11-09 12:30
Is this yaml that has go code in templates or a template that isn't valid yaml but processed to be valid yaml?
zeroDivisible · 2022-11-09 19:25
This is a yaml file which has go code templates in it (i.e. based on some if / else render one or the other part of the yaml)