-
Notifications
You must be signed in to change notification settings - Fork 276
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
Use new API's from SwiftSyntax SourceEdit #1250
Use new API's from SwiftSyntax SourceEdit #1250
Conversation
e0d540e
to
60856ce
Compare
@swift-ci please test |
7142cd5
to
d520f98
Compare
@swift-ci please test |
@swift-ci please test Windows |
040750f
to
1fc05b9
Compare
@swift-ci please test |
@swift-ci please test windows |
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.
Thanks @kimdv. I think with your changes, the code can now be simplified even further.
1fc05b9
to
9d7f767
Compare
@swift-ci please test |
@swift-ci please test Windows |
9d7f767
to
d17ebf6
Compare
@swift-ci please test |
@swift-ci please test Windows |
d17ebf6
to
5ff6c33
Compare
5ff6c33
to
ed61630
Compare
@swift-ci please test |
@swift-ci please test Windows |
@@ -58,7 +58,7 @@ extension SwiftLanguageService { | |||
if let range = range.flatMap({ snapshot.byteSourceRange(of: $0) }) { | |||
range | |||
} else { | |||
ByteSourceRange(offset: 0, length: await tree.totalLength.utf8Length) | |||
await tree.range |
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.
@ahoppen we await here but also on line 65.
Would it not be best to change async let tree = syntaxTreeManager.syntaxTree(for: snapshot)
-> let tree = await syntaxTreeManager.syntaxTree(for: snapshot)
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.
The benefit of async let
is allow us to compute the syntax tree and semantic highlighting tokens in parallel. If we await syntaxTreeManager.syntaxTree(for:)
, we would wait for the syntax tree to be computed before starting the computation of semantic tokens.
Related to swiftlang/swift-syntax#2604