Skip to content

Don’t catch CancellationError for document diagnostics #1381

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

ahoppen
Copy link
Member

@ahoppen ahoppen commented May 31, 2024

We were catching errors during diagnostic generation because VS Code will not request diagnostics again if SourceKit-LSP returns an error to any diagnostic request. We were, however, a little over-eager when doing this and also caught cancellation errors, which means that if the user made multiple edits in quick succession (which would cancel the diagnostics request from the first edit), we would return empty diagnostics, clearing the displayed diagnostics.

We were catching errors during diagnostic generation because VS Code will not request diagnostics again if SourceKit-LSP returns an error to any diagnostic request. We were, however, a little over-eager when doing this and also caught cancellation errors, which means that if the user made multiple edits in quick succession (which would cancel the diagnostics request from the first edit), we would return empty diagnostics, clearing the displayed diagnostics.
@ahoppen ahoppen requested review from bnbarham and hamishknight May 31, 2024 15:00
@ahoppen ahoppen requested a review from benlangmuir as a code owner May 31, 2024 15:00
@ahoppen
Copy link
Member Author

ahoppen commented May 31, 2024

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented May 31, 2024

@swift-ci Please test Windows

@ahoppen ahoppen merged commit 936b5b2 into swiftlang:main Jun 1, 2024
3 checks passed
@ahoppen ahoppen deleted the dont-catch-cancellation-error-for-diags-request branch June 1, 2024 04:24
Copy link
Contributor

@hamishknight hamishknight left a comment

Choose a reason for hiding this comment

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

LGTM

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