-
Notifications
You must be signed in to change notification settings - Fork 105
chore: pretty print poc #480
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
Draft
Draft
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
8350bdd
i guess i will try this
psteinroe 9e039b7
progress
psteinroe 048db82
progress
psteinroe 0911372
progress
psteinroe 75101a6
progress
psteinroe 111de33
progress
psteinroe a34467d
progress
psteinroe 4405de6
progress
psteinroe e91137b
chore: add agentic loop poc
psteinroe 9f587b1
progress
psteinroe fbb05e5
progress
psteinroe 166e9bb
progress
psteinroe 9a5fb50
progress
psteinroe 215625a
progress
psteinroe 2b935e9
progress
psteinroe 9da08d8
progress
psteinroe d00ffdc
progress
psteinroe 8fd9060
progress
psteinroe ad93e98
progress
psteinroe b8181a6
progress
psteinroe a764d58
progress
psteinroe aebf166
progress
psteinroe 4d377e5
progress
psteinroe 32c9f88
progress
psteinroe d14958c
progress
psteinroe 20d9cae
progress
psteinroe d03fea5
progress
psteinroe 1f26910
progress
psteinroe 9caaea9
progress
psteinroe 2434372
progress
psteinroe 62685be
progress
psteinroe 23cf241
progress
psteinroe 48e9406
progress
psteinroe d3d5d18
progress
psteinroe 5cee7af
progress
psteinroe 4acf8c6
progress
psteinroe b72b244
progress
psteinroe af987f1
progress
psteinroe 8ff7313
Merge branch 'main' into pretty-print
psteinroe aa7c304
progress
psteinroe 1f3ef97
fix: joins
psteinroe 864f7ae
fix: joins
psteinroe 534e057
fix: cleanup GroupStart
psteinroe 82cf149
progress
psteinroe be311d9
progress
psteinroe 17f44b9
progress
psteinroe 27366cf
progress
psteinroe 74dd155
progress
psteinroe 6c4aea4
progress
psteinroe 8f2d607
progress
psteinroe b6e36eb
progress
psteinroe e20198f
progress
psteinroe 1a32873
progress
psteinroe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
.cargo/config.toml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[alias] | ||
xtask = "run -p xtask --" |
78 changes: 78 additions & 0 deletions
Cargo.lock
Oops, something went wrong.
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
56 changes: 56 additions & 0 deletions
STATE.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Pretty Print Formatter State | ||
|
||
## Current Phase: Code Quality Improvements - COMPLETED ✅ | ||
|
||
## Last Completed Work | ||
- Fixed all forbidden patterns in nodes.rs: | ||
- Removed length-based formatting logic (e.g., `if items.len() > 3`) | ||
- Eliminated manual child node parsing patterns (e.g., `if let Some(pgt_query::protobuf::node::Node::List(list))`) | ||
- Enhanced List implementation with context-aware formatting | ||
- Added helper functions for common string formatting patterns | ||
- Cleaned up ObjectOpfamily/ObjectOpclass handling | ||
- Fixed clippy warnings and compilation errors | ||
|
||
## Issues Found and Fixed | ||
|
||
### 1. Length-based Formatting ✅ FIXED | ||
- **Issue**: Code changing formatting behavior based on list length | ||
- **Locations**: InsertStmt (line 1159), AExprList (line 1258) | ||
- **Solution**: Use consistent formatting with SoftOrSpace, let renderer decide breaks | ||
|
||
### 2. Manual Child Node Parsing ✅ FIXED | ||
- **Issue**: Parent nodes manually inspecting child node types instead of calling `to_tokens()` | ||
- **Locations**: | ||
- DropStmt (line 1742) | ||
- RangeFunction (line 2228) | ||
- DefElem instances (lines 3019, 3100, 3172, 3277) | ||
- RenameStmt (line 6314) | ||
- AlterObjectSchemaStmt (line 6489) | ||
- AlterOwnerStmt (line 6581) | ||
- **Solution**: Use `node.to_tokens(e)` and enhanced List context handling | ||
|
||
### 3. Code Quality Improvements ✅ FIXED | ||
- Added EventEmitter helper methods for string formatting | ||
- Consolidated identical if blocks in List implementation | ||
- Fixed clippy warnings (collapsible if/else, unused code, etc.) | ||
- Improved ObjectOpfamily/ObjectOpclass logic with cleaner pattern matching | ||
|
||
## Architecture Improvements Made | ||
- **Proper separation of concerns**: Parent nodes call `child.to_tokens(e)` | ||
- **Context-aware child formatting**: List node uses EventEmitter context functions | ||
- **Helper functions**: Common string formatting patterns abstracted | ||
- **Consistent patterns**: No hardcoded conditional logic based on lengths or types | ||
|
||
## Documentation Updates | ||
- Updated `agentic/pretty_printer.md` with new forbidden patterns | ||
- Added string formatting helper guidance | ||
- Added manual child node parsing prevention rules | ||
|
||
## Code Quality Status | ||
- All forbidden patterns eliminated ✅ | ||
- Clippy warnings addressed ✅ | ||
- Compilation successful ✅ | ||
- Architecture follows clean separation of concerns ✅ | ||
|
||
## Notes for Resumption | ||
This architectural cleanup phase is complete. All forbidden patterns have been eliminated and the codebase now follows proper parent-child delegation patterns with context-aware formatting. The next phase would be to continue with the main formatting task using the improved, clean architecture. |
Oops, something went wrong.
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.