Skip to content

Commit 277eb6d

Browse files
dibarbetJoeRobich
andauthored
Clear workspace pull state on document close to prevent stale diagnostics (#1674)
* Clear workspace pull state on document close to prevent stale diagnostics * Update client/src/common/diagnostic.ts Co-authored-by: Joey Robichaud <joseph.robichaud@microsoft.com> --------- Co-authored-by: Joey Robichaud <joseph.robichaud@microsoft.com>
1 parent 3412a17 commit 277eb6d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

client/src/common/diagnostic.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,11 @@ class DiagnosticRequestor implements Disposable {
416416
this.forget(PullState.document, document);
417417
});
418418
}
419+
420+
// The previous resultId from the workspace pull state can map to diagnostics we no longer have
421+
// (e.g. they came from a workspace report but were overwritten by a later document pull request).
422+
// Clear the workspace pull state for this document as well to ensure we get fresh diagnostics.
423+
this.forget(PullState.workspace, document);
419424
} else {
420425
// We have normal pull or inter file dependencies. In this case we
421426
// clear the diagnostics (to have the same start as after startup).

0 commit comments

Comments
 (0)