-
Notifications
You must be signed in to change notification settings - Fork 319
Add a subcommand to sourcekit-lsp that automatically reduces sourcekitd issues #1037
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
4d970a1
to
6643411
Compare
@swift-ci Please test Windows |
6643411
to
82c6d21
Compare
…td crashes Essentially, this is adding three pieces of functionality: 1. `sourcekit-lsp run-sourcekitd-request` takes a JSON sourcekitd request and a path to `sourcekitd.framework` and executes that request using that sourcekitd. This is basically equivalent to `sourcekitd-test -json-request-path` but it works even if the toolchain with `sourcekitd.framework` doesn’t have a `sourcekitd-test`. 2. `sourcekit-lsp diagnose --request-file` takes a path to a JSON sourcekitd request, gets the source file’s contents from disk and reduces the source file + compiler arguments to create a reduced reproducer. It then copies all files referenced from the compiler arguments to a temporary folder and asks the user to file an issue with that information. 3. `sourcekit-lsp diagnose` without arguments is similar to (2) but looks in OSLog for the last sourcekitd crash.
…nline `import` statements
82c6d21
to
9415d03
Compare
@swift-ci Please test Windows |
@swift-ci Please test macOS |
@swift-ci Please test Linux |
Merging this as-is so I can iterate on it in-tree. I will address review comments in follow-up PRs. |
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.
Very cool!
|
||
@Option( | ||
name: .customLong("request-file"), | ||
help: "Path to a JSON sourcekitd request" |
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.
Our requests are really yaml aren't they? Why do we keep calling it JSON everywhere?
…comments Address review comments from #1037
Essentially, this is adding three pieces of functionality:
sourcekit-lsp run-sourcekitd-request
takes a JSON sourcekitd request and a path tosourcekitd.framework
and executes that request using that sourcekitd. This is basically equivalent tosourcekitd-test -json-request-path
but it works even if the toolchain withsourcekitd.framework
doesn’t have asourcekitd-test
.sourcekit-lsp diagnose --request-file
takes a path to a JSON sourcekitd request, gets the source file’s contents from disk and reduces the source file + compiler arguments to create a reduced reproducer. It then copies all files referenced from the compiler arguments to a temporary folder and asks the user to file an issue with that information. To reproduce non-crashes anNSPredicate
can be passed via the--predicate
parameter. Any sourcekitd response that satisfies the predicate is considered a reproducer.sourcekit-lsp diagnose
without arguments is similar to (2) but looks in OSLog for the last sourcekitd crash.So far, this tool has been able to automatically reduce a crash I found while working on
sourcekit-lsp
to the following input file and reduced the compiler arguments to only include the input file itself.