Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vs code formats yaml file with extra spaces between brackets

I use vscode as an editor and have several yaml files in the project where parameter replacement occurs. However, it re-formats only one file with extra spaces between brackets, a file named service.yaml used by helm in our ci/cd pipeline. See below for before and after. enter image description here

and after enter image description here

I was wondering if the name of the file has particular significance for vscode or any other extensions... Thanks.

like image 637
user906573 Avatar asked Mar 08 '26 08:03

user906573


2 Answers

Uncheck Bracket Spacing in Extensions/YAML.

enter image description here

Edit: There is a caveat. This will format {{ foo }} or { { foo } } to {{foo}}, which is not necessarily syntactically correct in terms of Jinja templating.

like image 149
Aarkon Avatar answered Mar 11 '26 00:03

Aarkon


One of the way how to resolve this issue - wrap values into the quotes.

Like this:

app: "{{ .Values.name }}"

Probably not the best solution, but it works for me.

like image 39
chuve Avatar answered Mar 10 '26 23:03

chuve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!