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

Blank lines removed after comments even when disabled by --fmt: off #673

Open
jmskarda opened this issue Feb 10, 2025 · 1 comment
Open
Labels
bug Something isn't working

Comments

@jmskarda
Copy link

Describe the bug
sqlfmt is removing blank lines after comment lines despite being disabled by --fmt: off

To Reproduce

-- fmt: off


-- Comment block A explaining something

-- Comment block B explaining a completely different thing
select 1 from table1;

Expected behavior

sqlfmt should not change anything below the -- fmt: off comment.

Actual behavior

sqlfmt removes the empty line between comment A and comment B.

-- fmt: off


-- Comment block A explaining something
-- Comment block B explaining a completely different thing
select 1 from table1;

Additional context
What is the output of sqlfmt --version? version 0.24.0

@tconbeer tconbeer added the bug Something isn't working label Feb 10, 2025
@tconbeer
Copy link
Owner

Agreed this is a bug.

The workaround here is to add an empty comment between your blocks:

-- Comment block A explaining something
--
-- Comment block B explaining a completely different thing
select 1 from table1;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants