Open AlexJerabek opened 5 years ago
Don't know if I fully understand the request -- but in any case, since it's not critical, putting it into the 1.3 milestone to review later.
Also, @AlexJerabek , if you'd like to submit your own fix, by all means feel free :-)
The culprit here is that the YAML.dumpSafe
is not being passed the tabSize. (assuming they have a parameter you can pass for tabSize similar to JSON.stringify
)
That's the part I'm not sure about, is whether it even makes sense for the rest of the YAML to honor those tab sizes. Alex, let's talk in person at some point and see if you can convince me :-)
I think the argument for it should is much stronger than it shouldn't. The main reason I see is it looks strange to see 2 space tabs and 4 space tabs together.
Aside from looking strange, it messes with VS Code's tab size autodetect.
I understand this is low priority (unless customers are using the yaml in similar manners as the content team). Just reporting an issue as it's encountered.
Well, YAML spec allows for either 2 spaces or 4 spaces, so we're OK on that front. But what if someone chooses 3 spaces?...
That said, fine. We can have the logic use "editor.tabSize" if it's 2 or 4, and default to 4 otherwise. The safeDump
method accepts an "indent" option (see more at https://www.npmjs.com/package/js-yaml). So it should be fairly trivial to fix
Bug Report
Expected behavior:
Copying the snippet to the clipboard should have a consistent tab size for the entire file. This includes the tabs before "content" lines.
Actual behavior:
The SL-default of 2 spaces is applied to the yaml, except for user-generated content.
Steps to Reproduce:
Screenshot: