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

Feature Request: Keep some blank lines when formatting #750

Open
arm32x opened this issue Jun 20, 2024 · 1 comment
Open

Feature Request: Keep some blank lines when formatting #750

arm32x opened this issue Jun 20, 2024 · 1 comment
Labels

Comments

@arm32x
Copy link

arm32x commented Jun 20, 2024

Describe the Feature
A configuration option (or default behavior) to keep some existing blank lines from the input file. For example, IntelliJ has the following options for Java:
20240619_22h02m40s_grim

Why do you want this feature?
I have some SQL files used for database migrations with a header comment at the top that isn't directly related to the first query:

-- Some header comment
-- with metadata for migrations tool

CREATE TABLE something(id INTEGER PRIMARY KEY);

When I format this with sql-formatter, it currently deletes the blank line between the header comment and the first query.

@arm32x arm32x added the feature label Jun 20, 2024
@nene
Copy link
Collaborator

nene commented Jun 21, 2024

Thanks for the suggestion. It would definitely make sense to preserve blank lines.

However, with the current architecture of the formatter this is pretty hard to accomplish. Besides, I'm not actively developing this tool any more. Instead concentrating on prettier-plugin-sql-cst. So this is unlikely to happen unless you would like to implement it by yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants