refactor(formatter): improve printing of parentheses for TSTypeOperator#17792
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR refactors the printing of parentheses for TSTypeOperator to follow the established pattern used by similar TypeScript AST nodes in the formatter.
Key changes:
- Added
TSTypeOperatorto the list of AST nodes that need parentheses generation - Moved parentheses printing logic from the
write()method to thefmt()method - Added
format_type_cast_comment_nodehandling for proper comment formatting
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tasks/ast_tools/src/generators/formatter/format.rs | Adds "TSTypeOperator" to AST_NODE_NEEDS_PARENTHESES constant |
| crates/oxc_formatter/src/write/mod.rs | Removes parentheses logic from TSTypeOperator::write() method, simplifying it to only write the operator and type annotation |
| crates/oxc_formatter/src/ast_nodes/generated/format.rs | Adds parentheses handling, type cast comment support, and proper formatting structure to TSTypeOperator::fmt() method |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
…or (#17792) Parenthesis printing should be generated by AST tools.
3166319 to
89da592
Compare

Parenthesis printing should be generated by AST tools.