Skip to content

Conversation

@psteinroe
Copy link
Collaborator

@psteinroe psteinroe commented Oct 2, 2025

for the review: if you skip the nodes/ dir as well as the snapshot tests, the size of this pr is manageable. I makes sense to read through the renderer and how layout events work, as well as the integration of it in the language server and the cli.

@psteinroe psteinroe force-pushed the feat/pretty-print-try-2 branch from 4c5072f to c7d27e6 Compare October 30, 2025 19:08
@psteinroe psteinroe mentioned this pull request Dec 9, 2025
@psteinroe psteinroe changed the title chore: pretty-print poc attempt 2 chore: initial pretty printer Dec 31, 2025
psteinroe and others added 2 commits January 6, 2026 08:32
- Add pgls_pretty_print and pgls_pretty_print_codegen crates
- Implement SQL formatting with configurable keyword casing
- Support keyword_case and constant_case settings (default: lowercase)
- Integrate format command into CLI
- Add LSP formatting handler
…rinter

- Use dollar quotes for function/procedure bodies instead of single quotes
- Add DollarQuoteHint enum to select context-appropriate delimiters
  ($function$ for functions, $procedure$ for procedures, $do$ for DO blocks)
- Handle nested dollar quotes by falling back to alternative delimiters
- Use emit_identifier_maybe_quoted for identifiers that don't need quoting
  (lowercase names without special characters or reserved keywords)
- Add tests for dollar quoted functions, nested dollar quotes, and
  lowercase/quoted table identifiers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@psteinroe psteinroe force-pushed the feat/pretty-print-try-2 branch from 6ede0e1 to 0c40983 Compare January 6, 2026 08:23
CREATE TRIGGER was indenting all its clauses (BEFORE, ON, FOR EACH, EXECUTE)
while similar DDL statements like CREATE FUNCTION and CREATE EVENT TRIGGER
did not indent their clauses. This creates inconsistency in the output.

Remove indent_start/indent_end wrapping to match the style used by other
DDL statements.
The branch was missing the splinter options feature (ignore patterns for
rules) and the pgls_matcher crate that was added in main after the
branch diverged. This restores those files to sync with main.
- Update build.rs to use Rust 2024 inline format strings
- Handle both INT_MAX (2147483647) and LLONG_MAX for FETCH ALL detection
  to support cross-platform consistency
The pg_query parser library handles integer overflow differently on Windows
vs Linux/macOS, causing snapshot mismatches in edge cases like:
- $2147483648 (INT_MAX + 1) becomes $2147483647 on Windows
- FETCH FORWARD ALL using INT_MAX vs LLONG_MAX

These are parser library limitations, not pretty printer bugs.
@psteinroe psteinroe marked this pull request as ready for review January 6, 2026 09:53
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.

2 participants