| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
The whitespace between the upper bound of a BETWEEN predicate and
whatever follows it was doubled, because the sub-expression already
emits a trailing space and formatBetweenPredicate added another one on
top. It shows up with default options, e.g.
SELECT CASE WHEN foo BETWEEN 1 AND 2 THEN 3 END
produced "WHEN foo BETWEEN 1 AND 2 THEN 3".
Normalize the trailing whitespace the same way the lower bound already
does, with NO_SPACE followed by SPACE.
📝 Walkthrough
WalkthroughThe formatter changes whitespace token emission after BETWEEN. Existing expectations are updated for arithmetic and CASE expressions, and a regression test verifies formatting inside a CASE WHEN clause. ChangesBETWEEN whitespace correction
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: nene 🚥 Pre-merge checks | ✅ 4 ✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ ShareComment @coderabbitai help to get the list of available commands. |
Sorry, something went wrong.
There was a problem hiding this comment.
Awesome! Thanks.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
I noticed the formatter emits two spaces after a BETWEEN predicate whenever something follows it on the same line. With default options:
gives WHEN foo BETWEEN 1 AND 2 THEN 3. Same for logicalOperatorNewline: 'after' (b BETWEEN 1 AND 2 AND) and for b BETWEEN 1 AND 2 IS TRUE.
The cause is in formatBetweenPredicate: the sub-expression for the upper bound already ends with a trailing space, and the method then adds another WS.SPACE on top. It usually goes unnoticed because with the default logicalOperatorNewline: 'before' the following WS.NEWLINE trims the doubled space away. The lower bound already normalizes this with WS.NO_SPACE, WS.SPACE, so I did the same for the upper bound.
Two existing expectations had the extra space baked in (test/features/between.ts and test/features/case.ts); both are updated to the intended single space.
Tested with pnpm run check (typecheck, prettier, eslint, full jest suite) — all green. I also re-ran a format/re-format idempotency sweep over the repo's own test queries across every dialect and the option matrix; nothing changed apart from the removed space.