Skip to content
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

formatter delete blank line between comment. #12826

Closed
zw963 opened this issue Dec 8, 2022 · 1 comment · Fixed by #12909
Closed

formatter delete blank line between comment. #12826

zw963 opened this issue Dec 8, 2022 · 1 comment · Fixed by #12909
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:tools:formatter

Comments

@zw963
Copy link
Contributor

zw963 commented Dec 8, 2022

Bug Report

Following is a example:

require "socket"

# line 1

# line 2

After save, it formatted to:

require "socket"

# line 1
# line 2

I consider this is not a correct behavior, because the commented line probably is commented code, it should't change commented code.

Thanks

@zw963 zw963 added the kind:bug A bug in the code. Does not apply to documentation, specs, etc. label Dec 8, 2022
@straight-shoota
Copy link
Member

Note that this only happens for single comment lines.

Blocks of multiple comments are not merged:

# line 1
# line 2

# line 3
# line 4

If the latter comment is a doc comment, the empty line is not removed either:

# line 1

# line 2
def foo
end

So I'm wondering if this might be at least semi-intended behaviour?
I don't see a real benefit though, and I probably wouldn't expect the formatter to remove the empty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:tools:formatter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants