Skip to content

Keep parenthesized expressions in identifier lists - #932

Open
adenzhou1350 wants to merge 1 commit into
andialbrecht:masterfrom
adenzhou1350:codex/group-parenthesized-list-expressions
Open

adenzhou1350 wants to merge 1 commit into
andialbrecht:masterfrom
adenzhou1350:codex/group-parenthesized-list-expressions

Conversation

@adenzhou1350

Copy link
Copy Markdown

Fixes #343.

Bare parenthesized expressions currently break a comma-separated identifier list. For example, SELECT a, b, (a-b) FROM bla groups only a, b, so reindent leaves the last expression on the wrong line.

Accept parenthesized list items and group VALUES before identifier lists, keeping each top-level VALUES row separate. Expressions inside those rows still form their own lists.

Tests cover first/middle/last items, adjacent and nested parentheses, scalar subqueries, reindent output, and VALUES row boundaries. The 12 new cases have 11 failures on the original grouping implementation; all pass after the fix.

Validation on native Windows Python 3.12 and 3.14: full suite 518 passed, 2 xfailed, 1 existing xpassed; Ruff and diff checks pass. Third-party pytest plugin autoload was disabled. The existing wide-column benchmark reports linear scaling from 500 to 4,000 columns. Linux/macOS and the remaining Python versions are left to CI.

AI-assisted implementation and local validation.

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.

Inconsistent treatment of IdentifierList

1 participant