-
Notifications
You must be signed in to change notification settings - Fork 228
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
Formatting document should not destroy comments #75
Comments
This is an issue with the underlying parser. Currently there is not a parser (that I can find) that supports comment nodes. if one becomes available then I would happily switch the formatter to use that to preserve the comments. |
We should follow this issue then: mulesoft-labs/yaml-ast-parser#27 |
@JPinkney do you think the parser can be updated to https://github.com/eemeli/yaml?, that's what the issue above leads to, it supports fully comments |
Only the formatter needs to be updated to use that parser instead. If we do that then a better formatter can be built ontop of that. |
Can you share a link to the formatter? |
The current one? Its just this |
Hi! we've replaced the formatter with a new one that doesn't strip comments! |
@JPinkney I still see comments getting removed, any thoughts? |
Which version are you on and can you post an example |
@JPinkney I'm on |
Is there any particular case that the comment gets removed? Formatting # First Comment
hello: world
#Second Comment
cwd: /hello
scripts: #Third Comment
postinstall: test #Fourth Comment
#Fifth comment doesn't remove any comments for me. Do you have any other YAML related extensions installed? |
@JPinkney thanks for helping me out, had another YAML formatter installed. 👍 |
No worries! I'm glad to see that we could get the issue resolved :) |
If
yaml.format.enable
istrue
, using the "Format Document" function destroys YAML comments.The text was updated successfully, but these errors were encountered: