-
Notifications
You must be signed in to change notification settings - Fork 440
Improve debug description of syntax nodes #1503
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
ahoppen
merged 1 commit into
swiftlang:main
from
ahoppen:ahoppen/better-debug-description
Apr 13, 2023
Merged
Improve debug description of syntax nodes #1503
ahoppen
merged 1 commit into
swiftlang:main
from
ahoppen:ahoppen/better-debug-description
Apr 13, 2023
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
Beautiful! |
DougGregor
approved these changes
Apr 7, 2023
bnbarham
approved these changes
Apr 7, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
−3,206
Aw yeah, that's what I like to see!
2836eec
to
4eb805c
Compare
@swift-ci Please test |
kimdv
approved these changes
Apr 8, 2023
kimdv
approved these changes
Apr 8, 2023
@swift-ci Please test |
rintaro
approved these changes
Apr 9, 2023
ahoppen
added a commit
to ahoppen/swift
that referenced
this pull request
Apr 12, 2023
…favor of debugDescription Companion of swiftlang/swift-syntax#1503
4eb805c
to
7a02b13
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
This improves the description generated by the `debugDescription` function to something like the following which is easier to read IMO ``` SourceFileSyntax ├─CodeBlockItemListSyntax │ ╰─CodeBlockItemSyntax │ ╰─MacroExpansionExprSyntax │ ├─pound │ ├─identifier("stringify") │ ├─leftParen │ ├─TupleExprElementListSyntax │ │ ╰─TupleExprElementSyntax │ │ ╰─InfixOperatorExprSyntax │ │ ├─IntegerLiteralExprSyntax │ │ │ ╰─integerLiteral("2") │ │ ├─BinaryOperatorExprSyntax │ │ │ ╰─binaryOperator("+") │ │ ╰─IntegerLiteralExprSyntax │ │ ╰─integerLiteral("3") │ ╰─rightParen ╰─eof ``` Since we now have this nice representation, it also removes the conformances to `CustomReflectable` (deleting 3000 lines of code :hooray:) and doing some new `CustomReflectable` hackery to make the debugger just print `debugDescription` and not try to print the node’s children itself. This way you an now do `po node` in the debugger to get the debug description from above, instead of having to do `e print(node.recursiveDescription)`
7a02b13
to
e618702
Compare
@swift-ci please test |
@swift-ci Please test macOS |
@swift-ci Please test Windows |
meg-gupta
pushed a commit
to meg-gupta/swift
that referenced
this pull request
Apr 14, 2023
…favor of debugDescription Companion of swiftlang/swift-syntax#1503
ahoppen
added a commit
to ahoppen/swift-syntax
that referenced
this pull request
Apr 18, 2023
…escription Improve debug description of syntax nodes
ahoppen
added a commit
to ahoppen/swift-syntax
that referenced
this pull request
Apr 18, 2023
…escription Improve debug description of syntax nodes
ahoppen
added a commit
to ahoppen/swift
that referenced
this pull request
Apr 19, 2023
…favor of debugDescription Companion of swiftlang/swift-syntax#1503
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.
This improves the description generated by the
debugDescription
function to something like the following which is easier to read IMOSince we now have this nice representation, it also removes the conformances to
CustomReflectable
(deleting 3000 lines of code 🎉 ) and doing some newCustomReflectable
hackery to make the debugger just printdebugDescription
and not try to print the node’s children itself. This way you an now dopo node
in the debugger to get the debug description from above, instead of having to doe print(node.recursiveDescription)