-
Notifications
You must be signed in to change notification settings - Fork 31
Context/indent #170
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
Merged
Merged
Context/indent #170
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
…method
- Replace parentNodeTypes=[] with new DeparserContext()
- Replace parentNodeTypes=[...context.parentNodeTypes, nodeType] with context.spawn(nodeType)
- Replace {...context, property: true} patterns with context.spawn(methodName, {property: true})
- Fix context propagation issues in IndexElem and CopyStmt methods
- Ensure proper context spawning for GIN index parameters and COPY statement WITH clauses
- All 279 test suites continue to pass with the new context system
Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Change visit method to use context.spawn(nodeType) when calling node methods - Ensures all methods receive properly contextualized calls with nodeType in parentNodeTypes - Makes context spawning more consistent throughout the entire deparser - All 279 test suites continue to pass with this more thorough approach Co-Authored-By: Dan Lynch <pyramation@gmail.com>
…ntext - Ensures RangeVar receives correct objtype context to prevent 'ONLY' keyword - Fixes ALTER TYPE RENAME ATTRIBUTE statements - All 279 test suites now passing Co-Authored-By: Dan Lynch <pyramation@gmail.com>
…better readability
- Group (!context.parentNodeTypes.includes('AlterTypeStmt') && context.objtype !== 'OBJECT_TYPE') conditions
- Improves code semantics by making it clear both conditions relate to preventing ONLY keyword for ALTER TYPE operations
- Remove ternary operator from RenameStmt to maintain universal spawn() flow
- All 279 test suites passing
Co-Authored-By: Dan Lynch <pyramation@gmail.com>
…xt parameters - Update formatWindowFrame method signature to accept DeparserContext parameter - Update deparseOperatorName method signature to accept DeparserContext parameter - Replace all empty context creation with passed context in both methods - Update all call sites to pass properly spawned context instead of creating empty contexts - Ensures consistent context propagation in helper methods that are not actual node types Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Change visit() to pass original context instead of spawning new context - Prevents premature context spawning and gives node methods control - All tests continue to pass (279/279 test suites) - Helper methods already properly use passed context parameters Co-Authored-By: Dan Lynch <pyramation@gmail.com>
…perty - Add SqlFormatter as a property of DeparserContext with default instantiation - Replace all this.formatter references with context.formatter throughout deparser - Remove direct SqlFormatter import and private formatter property from Deparser class - Update deparse() and visit() methods to create context with formatter when not provided - Maintain modular design allowing external formatter instantiation and context passing - Preserve existing formatting logic while improving context-aware formatting - All 279 test suites continue to pass Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Make SqlFormatter private property on DeparserContext - Add public methods: indent(), newline(), parens(), format(), isPretty() - Replace all context.formatter.* references with direct context methods - Fix CREATE TABLE constraint indentation using context.indentLevel - UNIQUE and FOREIGN KEY constraints now properly indented relative to table structure - Context spawning with increased indent levels for table elements - All 279 test suites continue to pass Co-Authored-By: Dan Lynch <pyramation@gmail.com>
… indentLevel - Remove explicit indentLevel increment when spawning table element contexts - Let context.indent() method handle indentation automatically using indentLevel + 1 - UNIQUE and FOREIGN KEY constraints now properly indented relative to columns - Constraints are visually distinct with proper logical grouping indentation - All tests passing including CREATE TABLE pretty printing snapshots Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Replace hardcoded ' AND ' and ' OR ' spacing with context.indent() in BoolExpr - Add proper indentLevel context spawning for GROUP BY and ORDER BY clauses - Boolean expressions now use context-aware indentation for better logical grouping - SELECT clause elements properly track indent levels through context spawning - Consistent indentation management across nested statements and expressions Co-Authored-By: Dan Lynch <pyramation@gmail.com>
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.
No description provided.