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
yamlfmt insert blank line between commented line #34
Comments
Hi @sharuzzaman, Unfortunately at this time there aren't a ton of configuration options, so you wouldn't be able to configure a behaviour like this for the time being. However, I'm unable to reproduce this behaviour locally at the moment. I tried copying the yaml from the first block into a file on its own and it did not insert the newlines as you've mentioned. x.yaml: ---
Resources:
ElasticBeanstalk:
Type: AWS::CloudFormation::Stack
Properties:
#NotificationARNs:
# - String
#Parameters:
# Key : Value
#Tags:
# - Tag
TemplateURL: https://examplebucket.s3.ap-southeast-1.amazonaws.com/example-file.json
TimeoutInMinutes: 5 Piping it into braydonk@bk:~/Git/yamlfmt$ cat x.yaml | yamlfmt -
---
Resources:
ElasticBeanstalk:
Type: AWS::CloudFormation::Stack
Properties:
#NotificationARNs:
# - String
#Parameters:
# Key : Value
#Tags:
# - Tag
TemplateURL: https://examplebucket.s3.ap-southeast-1.amazonaws.com/example-file.json
TimeoutInMinutes: 5 There's a chance this is a platform issue. I'm running this on Linux. What operating system are you on? |
I'm running yamlfmt on Windows 10 using the Windows command line |
This seems to be a Windows-specific issue. Gotta be some kind of CRLF problem if I had to guess. I'll keep looking into it. |
This is tough. It's a combination of 2 bugs in
When the parser scans a head comment ending in The silver lining is that this is not a universal Windows issue, this is particularly with CRLF line endings. That is a possible workaround if you are flexible with line endings in your project. Regardless, I'll do what I can to get this solved. |
For the line ending problem, I opened go-yaml/yaml#891 and a PR for it go-yaml/yaml#892 |
I managed to find the problem in the parser code too. Opened go-yaml/yaml#893 and go-yaml/yaml#894 |
I've opened a hotfix for the behaviour while waiting for the upstream stuff to get fixed, and that's what will go in v0.3.0 so that Windows users can be fixed sooner. |
I would like to update that this issue is not happening again and the hotfix is working correctly. Thank you |
I have the following YAML:
after formatting, each commented line will have a blank line inserted, becoming:
I don't see any option to configure the formatter so that it does not include a blank line after each comment.
Thank you.
The text was updated successfully, but these errors were encountered: