Skip to content

Improve error reporting when SourceKit-LSP fails to start #982

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 2 commits into from
Jul 25, 2024

Conversation

plemarquand
Copy link
Contributor

If SourceKit-LSP fails to initialize, typically because of unrecognized launch arguments, don't attempt to restart it and limit the number of erorr dialogs to just one descriptive one. Clicking the "Go to Output" button on this dialog takes you to the SourceKit-LSP Output panel which now shows the SourceKit-LSP launch error.

@plemarquand
Copy link
Contributor Author

Here is a screen recording of the current behaviour when SourceKit-LSP fails to start due to a bad argument.
https://github.com/user-attachments/assets/ec00dd8e-08f1-4929-bc5c-e5a4a4b8bb1e

@plemarquand plemarquand force-pushed the better-sourcekit-init-error branch from 33efc2a to c1eff30 Compare July 22, 2024 12:49
@plemarquand
Copy link
Contributor Author

Here is the new dialog (well, same as the old dialog, except it sticks around and you can read it).

NewSourceKitErrorMessage

Here is the output you see when you click "Go to Output". The error is not automatically highlighted, that is just to show that the error is now properly reported.

NewSourceKitErrorLogs

@plemarquand plemarquand marked this pull request as draft July 22, 2024 12:53
@plemarquand plemarquand force-pushed the better-sourcekit-init-error branch from c1eff30 to 1fffbb6 Compare July 22, 2024 14:06
@plemarquand plemarquand marked this pull request as ready for review July 22, 2024 14:23
If SourceKit-LSP fails to initialize, typically because of unrecognized
launch arguments, don't attempt to restart it and limit the number of
erorr dialogs to just one descriptive one. Clicking the "Go to Output"
button on this dialog takes you to the SourceKit-LSP Output panel which
now shows the SourceKit-LSP launch error.

Issue: swiftlang#976
Copy link
Contributor

@adam-fowler adam-fowler left a comment

Choose a reason for hiding this comment

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

The bits of this PR that work seem to be about ensuring the error handler doesn't try to restart the server if initialisation failed. Which already makes things clearer as you get a dialog saying there was an issue go to the LSP output to find out what it was.

The parts which attempt to parse the log don't seem to get called. Maybe you could move them to the error handler instead of in the catch block.

@plemarquand plemarquand force-pushed the better-sourcekit-init-error branch from 1fffbb6 to 06af591 Compare July 23, 2024 13:05
@plemarquand plemarquand merged commit 058e1a6 into swiftlang:main Jul 25, 2024
8 checks passed
@plemarquand plemarquand deleted the better-sourcekit-init-error branch July 25, 2024 14:28
@award999
Copy link
Contributor

award999 commented Aug 8, 2024

Verified

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.

3 participants