-
Notifications
You must be signed in to change notification settings - Fork 440
Remove DiagnosticEngine
#325
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
Merged
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
Simplify `SwiftSyntax` by removing the `DiagnosticEngine`. Instead `SyntaxParser` just takes a lightweight callback to emit diagnostics. rdar://83850489 [SR-15280]
49adeec
to
198582f
Compare
swiftlang/swift-stress-tester#166 @swift-ci Please test |
Looks like CI didn’t pick up the stress tester PR. Let’s try again swiftlang/swift-stress-tester#166 @swift-ci Please test macOS |
allevato
approved these changes
Oct 6, 2021
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.
Looks great, thank you!
akyrtzi
approved these changes
Oct 6, 2021
allevato
added a commit
to allevato/swift-format
that referenced
this pull request
Nov 4, 2021
This change addresses swiftlang/swift-syntax#309 and swiftlang/swift-syntax#325, which split `SwiftSyntaxParser` into its own module and then removed the `DiagnosticEngine` APIs (so only the `Diagnostic` type remains as the way diagnostics from the parser are sent back to the caller). Rather than remain coupled to swift-syntax's `Diagnostic` type, this change creates a similar `Finding` type (and related types) to describe the "lint findings" that tree-based rules, the pretty-printer, and the whitespace linter encounter during formatting/linting. This `Finding` type is the currency type for these kinds of findings/diagnostics emitted by the formatter API layer. The `swift-format` frontend tool now adopts `DiagnosticsEngine` from https://github.com/apple/swift-tools-support-core to manage and print these, but other clients using the API could use something different entirely. Since the usage of `TSC` is limited to the executable, API users don't have to take on a large and mostly unrelated dependency. There are still some opportunities for renaming here -- mainly replacing instances of `diagnose` in the internal code with `emitFinding` or something similar -- but I'll leave that as future cleanup.
dylansturg
pushed a commit
to dylansturg/swift-format
that referenced
this pull request
Apr 16, 2022
This change addresses swiftlang/swift-syntax#309 and swiftlang/swift-syntax#325, which split `SwiftSyntaxParser` into its own module and then removed the `DiagnosticEngine` APIs (so only the `Diagnostic` type remains as the way diagnostics from the parser are sent back to the caller). Rather than remain coupled to swift-syntax's `Diagnostic` type, this change creates a similar `Finding` type (and related types) to describe the "lint findings" that tree-based rules, the pretty-printer, and the whitespace linter encounter during formatting/linting. This `Finding` type is the currency type for these kinds of findings/diagnostics emitted by the formatter API layer. The `swift-format` frontend tool now adopts `DiagnosticsEngine` from https://github.com/apple/swift-tools-support-core to manage and print these, but other clients using the API could use something different entirely. Since the usage of `TSC` is limited to the executable, API users don't have to take on a large and mostly unrelated dependency. There are still some opportunities for renaming here -- mainly replacing instances of `diagnose` in the internal code with `emitFinding` or something similar -- but I'll leave that as future cleanup.
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.
Simplify
SwiftSyntax
by removing theDiagnosticEngine
. InsteadSyntaxParser
just takes a lightweight callback to emit diagnostics.rdar://83850489 [SR-15280]