-
Notifications
You must be signed in to change notification settings - Fork 419
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
Automatically generate leading/trailing space trivia for tokens in SyntaxFactory
#473
Conversation
@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.
A few notes on the implementation below. The open
keyword also still needs an explicit trailing trivia call (in TokensFile.swift:100
) since contextual keywords as generated in makeContextualKeyword
apparently do not require a trailing space.
@swift-ci please test |
@swift-ci please test |
1 similar comment
@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.
Wow, this is so much simpler than what we had before 😍
Additionally, remove redundant trivia generation from TokensFile and no longer needed leading/trailing space info from Tokens in SwiftSyntaxBuilderGeneration. Since SyntaxFactory now takes care of leading/trailing spaces, we no longer need these helpers (that were previously required by the TokensFile template).
@swift-ci please test |
In an effort to clean up the
TokensFile
template inSwiftSyntaxBuilderGeneration
, this branch moves the generation of leading/trailing space trivia around tokens intoSyntaxFactory
. In other words, calls likewill now automatically generate a trailing space (although this is still overridable by explicitly passing
trailingTrivia: []
as a parameter).cc @ahoppen