sql-formatter-org / sql-formatter-org/sql-formatter
Feature Request: Keep some blank lines when formatting
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 456
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 3
Description
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:
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior with the SQL migration example in the issue and inspect the formatter's configuration and whitespace-handling entry points. The work is done when the requested blank line can be preserved through the proposed default or configuration option without breaking normal formatting behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100