swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
708 stars 47 forks source link

Add command to the command palette to run `sourcekit-lsp diagnose` #842

Closed ahoppen closed 2 weeks ago

ahoppen commented 4 weeks ago

Starting with Swift 6, the sourcekit-lsp diagnose terminal command generates a bundle that helps SourceKit-LSP developers diagnose issues. I think it would be great if we could make that more accessible in VS Code by adding a command to the command palette that runs sourcekit-lsp diagnose --toolchain /path/to/toolchain in the integrated terminal. In particular, this could ensure that you run the command with the toolchain that is selected in VS Code, which yields more actionable bugs.

As an added bonus, when sourcekitd crashes and SourceKit-LSP shows the SourceKit-LSP: Restoring functionality: Please run 'sourcekit-lsp diagnose' to file an issue status (you can reproduce this by running killall SourceKitService when having a project open), it would be great if there was a button to run sourcekit-lsp diagnose. I can add some indication to the work done progress that SourceKit-LSP sends for this.

plemarquand commented 4 weeks ago

@ahoppen I have this PR in progress which captures sourcekit-lsp output and includes it in a diagnostic bundle. How about I adapt it to use sourcekit-lsp diagnose instead so we just have the one command? Using sourcekit-lsp diagnose has the added benefit that if the user has sourcekit-lsp tracing turned off in the extension they'll still get the output.

I'll keep the current functionality in the PR for 5.10 and lower.

award999 commented 1 week ago

Verified with 3843201 on macOS and Linux