Skip to content

Proposal: optional matching-parenthesis line breaks #417

Closed

Description

@arnodirlam

Would you be open to an option that puts a closing parenthesis on its own line when the formatted content after the opening parenthesis starts on a new line?

I find this makes the end of longer column lists and subqueries easier to spot. For example, with -B and all other formatting options at their defaults:

INSERT INTO widgets (
    id,
    label)
SELECT
    1,
    2;

With the proposed option:

INSERT INTO widgets (
    id,
    label
)
SELECT
    1,
    2;

The closing parenthesis would align with the line containing its opening parenthesis. Nested pairs would follow the same rule independently, and content that starts on the same line as ( would keep its current layout.

My suggested name is --matching-paren-newline, disabled by default since this is a style preference. I’d welcome your thoughts on both the name and the behavior.

I’ve put together an implementation in #415 to make the proposal concrete. Feel free to close that PR if this option isn’t something you’d like to support.

Thanks for maintaining pgFormatter!

Activity

  1. darold commented on Sep 20, 2026

    @darold
    Owner

    patch applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions