-
Notifications
You must be signed in to change notification settings - Fork 112
chore: initial pretty printer #546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
psteinroe
wants to merge
14
commits into
main
Choose a base branch
from
feat/pretty-print-try-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4c5072f to
c7d27e6
Compare
Open
- 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]>
6ede0e1 to
0c40983
Compare
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.