-
Notifications
You must be signed in to change notification settings - Fork 441
Introduce a source accurate and structural view of a SwiftSyntax tree #522
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
Conversation
5eebcdd
to
714ab5e
Compare
swiftlang/swift-stress-tester#181 @swift-ci Please test |
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.
I think it'd be nice if we kept the original API as well and just had it default to .sourceAccurate
. Fewer changes in all the clients that way. But I like the additions in general - I had done the NonNilRawSyntaxChildren
in my own changes 😅.
714ab5e
to
3dd2e2b
Compare
I made two changes to the PR:
|
swiftlang/swift-stress-tester#181 @swift-ci Please test |
3dd2e2b
to
3ef5682
Compare
swiftlang/swift-stress-tester#181 @swift-ci Please test |
`SyntaxTreeViewMode` allows two different views on a SwiftSyntax tree: 1. Either a purely `sourceAccurate` view, which skips over all missing children but traverses garbage syntax (once implemented). This mode is intended for clients that operate at the source code level, like swift-format 2. For clients that don’t care about 100% about source fidelity but would like to view the syntax tree for structural analysis with fixes from the parser applied, there’s the `fixedUp` view. This includes missing nodes (because the user probably meant to write these) and skips over garbage nodes (because the client will likely have a hard time reasoning about these nodes if the parser couldn’t make sense of them)
3ef5682
to
cd7ded2
Compare
@swift-ci Please test |
swiftlang/swift-stress-tester#181 @swift-ci Please test |
I think this PR accidentally reverted the rename from |
SyntaxTreeViewMode
allows two different views on a SwiftSyntax tree:sourceAccurate
view, which skips over all missing children but traverses garbage syntax (once implemented). This mode is intended for clients that operate at the source code level, like swift-formatfixedUp
view. This includes missing nodes (because the user probably meant to write these) and skips over garbage nodes (because the client will likely have a hard time reasoning about these nodes if the parser couldn’t make sense of them)