Skip to content
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

Fix restoration of problems (from watch task) when closing a file #183172

Conversation

russelldavis
Copy link
Contributor

@russelldavis russelldavis commented May 23, 2023

Fixes #47386

Logic was added in df97bc3 to add a watcher's problems back to the problems view after closing a file.

It doesn't work quite right though because of how processLineInternal batches up changes, only sending them to markerService when it gets called on subsequent lines with a different owner or resource.

Because of that, the current behavior is that when you close a file with errors, the errors will disappear and only end up getting restored the next time a different file being watched gets saved.

This PR fixes that (restoring the errors right after the file is closed) by calling forceDelivery().

cc @alexr00

Fixes microsoft#47386

Logic was added in microsoft@df97bc3
to add a watcher's problems back to the problems view after closing a
file.

It doesn't work quite right though because of how `processLineInternal`
batches up changes, only sending them to `markerService` when it gets
called on subsequent lines with a different owner or resource.

Because of that, the current behavior is that when you close a file with
errors, the errors will disappear and only end up getting restored the
next time a different file being watched gets saved.

This PR fixes that (restoring the errors right after the file is closed)
by calling `forceDelivery()`.
@russelldavis
Copy link
Contributor Author

Welp, I'm pretty sure my explanation above is wrong, and thus this PR is also the wrong fix. There is indeed a problem with restoring the problems when closing a file, but it looks like the actual cause is a race condition between the debounce timeout at

Event.debounce(this.markerService.onMarkerChanged, (last: readonly URI[] | undefined, e: readonly URI[]) => {
return (last ?? []).concat(e);
}, 500)(async (markerEvent) => {
and the cleanup timeout at
setTimeout(async () => {
markerChanged?.dispose();
markerChanged = undefined;
}, 600);

Sorry for the confusion. Will follow up later with a proper fix.

@russelldavis
Copy link
Contributor Author

The proper fix for this is now at #183271

@github-actions github-actions bot locked and limited conversation to collaborators Jul 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Task: Typescript errors disappear after document closed
3 participants