Skip to content

Add Swift: Capture VSCode Swift Diagnostic Logs command #830

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 18 commits into from
Jun 20, 2024

Conversation

plemarquand
Copy link
Contributor

@plemarquand plemarquand commented May 30, 2024

Adds a new command that users can use to help generate bug reports for the extension itself. The Capture VSCode Swift Diagnostic Logs command will create a new folder in a temporary directory that contains:

  • Swift version and path information
  • Extension logs
  • Any diagnostics in the Problems pane

Users can copy the folder path or, if they're on macOS, open it in Finder. From there they can zip and attach these files to a GitHub issue. We'll want to update the New Issue Template with instructions on how to capture and attach these logs.

Fixes #842

@plemarquand plemarquand force-pushed the capture-diagnostics branch from e1a0d24 to efef4df Compare May 30, 2024 19:59
@plemarquand plemarquand marked this pull request as ready for review May 31, 2024 01:15
@adam-fowler
Copy link
Contributor

I have virtually never needed the diagnostics in the problems page when someone is submitting an issue. Things that are useful are swift log (which already includes swift version and paths), sourcekit-lsp log, user settings.

@plemarquand plemarquand force-pushed the capture-diagnostics branch 2 times, most recently from adc0356 to db4d1b8 Compare June 5, 2024 14:41
@plemarquand
Copy link
Contributor Author

@adam-fowler I've added sourcekit-lsp logs and user settings to the diagnostics. Sourcekit-lsp logs will only be captured if the user has the trace level turned on in their settings.

@plemarquand plemarquand force-pushed the capture-diagnostics branch 2 times, most recently from 953bbae to f1245e6 Compare June 6, 2024 20:22
@plemarquand plemarquand requested review from ahoppen and award999 June 10, 2024 14:35
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! I expect this will really help us diagnose issues more quickly. Do you want to add instructions to run the diagnose command to the GitHub issue template as well? We should probably only do that once a version of the extension with the diagnose command has been released.

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more question. Do you think the following from #842 would be possible to implement?

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 plemarquand force-pushed the capture-diagnostics branch from f1245e6 to 6322a02 Compare June 11, 2024 16:03
@plemarquand
Copy link
Contributor Author

@ahoppen it looks like it should be pretty straightforward to watch the work done progress events. However, there is only title and message on the work progress messages, meaning I'd have to check if title === 'SourceKit-LSP: Restoring functionality', which seems brittle. I guess we can use it if we can guarantee that string wont change

@plemarquand plemarquand requested a review from ahoppen June 11, 2024 17:42
@ahoppen
Copy link
Member

ahoppen commented Jun 12, 2024

I can totally add an ID for this to the work done progress that we can check for. Just wanted to verify that it’s possible on the VS Code side before I extend LSP. Let’s do this in a follow-up PR.

@plemarquand plemarquand requested a review from ahoppen June 12, 2024 14:30
@plemarquand
Copy link
Contributor Author

@swift-server-bot test this please

@plemarquand plemarquand force-pushed the capture-diagnostics branch 2 times, most recently from bc86a08 to e923a90 Compare June 14, 2024 17:50
@plemarquand plemarquand force-pushed the capture-diagnostics branch from e923a90 to 923af4e Compare June 14, 2024 19:07
@plemarquand plemarquand force-pushed the capture-diagnostics branch from 923af4e to b2f195c Compare June 19, 2024 13:32
Adds a new command that users can use to help generate bug reports for
the extension itself. The Capture VSCode Swift Diagnostic Logs command
will create a new folder in a temporary directory that contains:

- Swift version and path information
- Extension logs
- Any diagnostics in the Problems pane

Users can copy the folder path or, if they're on macOS, open it in
Finder. From there they can zip and attach these files to a GitHub
issue. We'll want to update the New Issue Template with instructions on
how to capture and attach these logs.
@plemarquand plemarquand force-pushed the capture-diagnostics branch from b2f195c to 60979e2 Compare June 20, 2024 16:54
@plemarquand plemarquand requested a review from 0xTim as a code owner June 20, 2024 16:54
@plemarquand plemarquand merged commit 3843201 into swiftlang:main Jun 20, 2024
8 checks passed
@plemarquand plemarquand deleted the capture-diagnostics branch June 20, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add command to the command palette to run sourcekit-lsp diagnose
4 participants