Skip to content

Avoid an extra blank line before aliased subqueries - #923

Open
adenzhou1350 wants to merge 1 commit into
andialbrecht:masterfrom
adenzhou1350:codex/reindent-aliased-subquery
Open

adenzhou1350 wants to merge 1 commit into
andialbrecht:masterfrom
adenzhou1350:codex/reindent-aliased-subquery

Conversation

@adenzhou1350

Copy link
Copy Markdown

Fixes #334's spurious blank line.

Query parentheses already insert a leading newline. When an alias wraps one in an Identifier, the surrounding identifier list inserts another, leaving an empty line before the subquery.

Let the query parenthesis own that break. This preserves the existing subquery indentation rather than introducing a new alignment style; ordinary expressions, comma-first layout, wrapping, and blank lines between statements retain their behavior.

Validation on Windows / Python 3.14:

  • The same 14 regression/control cases: 8 failures on the original source, all pass with this change.
  • Full upstream suite: 520 passed, 2 xfailed, 1 xpassed; existing xfail/xpass outcomes are unchanged.
  • A separate 60-case option matrix preserves non-whitespace SQL tokens, and the original query gives identical SQLite results before/after formatting.
  • Ruff and git diff --check pass.

AI-assisted implementation, independently reproduced and checked locally. No other-platform CI or performance claim.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spurious empty line reformatting a query using a subselect

1 participant