-
Notifications
You must be signed in to change notification settings - Fork 222
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
double braces (for helm stuff) get a space put in between them #246
Comments
We're using Go templates in YAML files - and the space insertion breaks them. Is it possible to stop checking when encountering a {{ }} sequence ? |
I'm assuming you mean stop validating when {{}} are hit so that no error is reported? Technically it's possible but the problem is then we're implementing helm specific things into this extension when this extension is supposed to be only for pure yaml. This extension has some support for helm that I think would be better suited: https://marketplace.visualstudio.com/items?itemName=ms-kubernetes-tools.vscode-kubernetes-tools you just need to change your file type association to helm and then the error dissapears |
Our stuff is not Helm-related - it just uses the YAML as input to the Go template engine. So for the time being, the file in question is not pure YAML yet. So the question remains: how can I configure the vscode-yaml extension that I can use it also for "not pure YAML yet" files? |
There's currently no way to do that, but it would be an interesting enhancement |
Hey all! I got around this by strong quoting ( Here's an example of what I mean: - namespace: {{ requiredEnv "NAMESPACE" }}
+ namespace: '{{ requiredEnv "NAMESPACE" }}' I haven't tested this in a helm chart yet so I don't know if this change will work there (meaning I am not sure if this will be interpreted properly by the go templating parser). Additionally, I am not sure if this will work for stuff like Jinja2 (I don't think so) so it might be worth just writing an exception for this plugin to just ignore |
A simple solution now is close the bracketSpacing in Yaml Plugin. {
"yaml.format.bracketSpacing": false,
} But this will get a 'side-effect', the space inside double braces also removed. - {{.Values.node2}} But at least it works now. |
Not working for me. |
@c0bra Try "prettier.bracketSpacing" instead. |
@adampodolski's suggestion worked for me ( An alternative solution is to use a Really wish they didn't remove the |
It's not work because you may using prettier as your yaml formatter, you can change your yaml formatter with "[yaml]": {
"editor.defaultFormatter": "redhat.vscode-yaml",
} or use @adampodolski 's suggestion |
I created ~/.prettierignore file, added *.yaml, *.yml to it, then updated vscode User setting |
Pain in the neck. |
Previously, i saw the above behaviour, but with
Format to this...
|
It seems that go-style templating of yaml files is just too common in kubernetes world... P.S. |
So, still no solution without side effects found?
That is very annoying! Please add an option like |
+1 |
I'll add an extra use case. The helmfile format allows in-line go templates in the values section of a release. I am using this behavior to pass in all of the values from the environment into a helm release like this: - name: aws-load-balancer-controller-iam
namespace: kube-system
chart: ../argocd/aws-load-balancer-controller-iam
values:
- {{ toYaml .Values | nindent 8 }} When I save the file the - name: aws-load-balancer-controller-iam
namespace: kube-system
chart: ../argocd/aws-load-balancer-controller-iam
values:
- {? {toYaml .Values | nindent 8: ''} : '',} I don't know what the syntax is supposed to be, but I've turned off JSON schema, disable formatters, turned off validation, turned off bracket spacing, and I'm still getting this output. |
{{
become{ {
... not desiredThe text was updated successfully, but these errors were encountered: