darold / darold/pgFormatter

How to preserve as least 1 newline between comments?

Open
#328 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PLpgSQL
Stars
2k
Forks
121
Avg merge
4d 21h
Merged PRs (30d)
7

Description

How to preserve as least 1 newline between comments?

Give:
-- comment AA


-- comment BB
-- comment CC

drop table if exists accounts;

-- comment DD
Expected output:

remove extra newlines between comments &/ statements;
but preserve at least one.

-- comment AA

-- comment BB
-- comment CC

drop table if exists accounts;

-- comment DD
Current output:

All newlines between comments &/ statements are removed.

-- comment AA
-- comment BB
-- comment CC
drop table if exists accounts;

-- comment DD

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the supplied SQL example as the reproduction case and inspect pgFormatter's handling of blank lines between comments and statements. Run the formatter on that input; done means extra newlines are removed while at least one blank line remains where shown in the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql
Domain
databases, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.