esc
esc copied to clipboard
Config editor inlines & escapes multiline strings with two newlines
What happened?
We have an ESC config with a YAML string in it. Typically the ESC editor preserves our formatting on save, but if we accidentally add an empty newline and save, pulumi collapses it into a single line. Would be great if the editor was a little more lenient on whitespace
Example
- Create an ESC file with the following config and save
values:
myConfig: |-
a: 1
a2: 2
b: 2
c: 3
- Add a newline between any keys
- Observe the string has collapsed into a oneline string like
values:
myConfig: "a: 1\n a2: 2 \n\nb: 2\nc: 3"
Output of pulumi about
n/a
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
Which editor are you using? Guessing that this is via any editor--the web UI or esc env edit
--and is probably related to the pipeline we use to encrypt/decrypt secrets.
I can't repro this using esc env init
/esc env edit
with vim
.
- I created an empty environment using
esc env init
- I edited the environment using
esc env edit
s.t. its definition was
values:
myConfig: |-
a: 1
a2: 2
b: 2
c: 3
- I edited the environment again using
esc env edit
s.t. its definition was
values:
myConfig: |-
a: 1
a2: 2
b: 2
c: 3
All formatting was preserved. Are there other entities in the environments where you're seeing the reformat?
okay, we have a repro. choice of editor matters, as the repro only hits if there are actual spaces in the blank line:
https://github.com/pulumi/esc/pull/218
Ah this was with the web editor - newlines are indented by default whereas other editors might clear the whitespace on save