Make sure buffer sync reset clears pending diagnostics

This commit is contained in:
Matt Bierner 2019-11-08 14:46:51 -08:00
parent 7218d47251
commit 21fd94b70c
2 changed files with 8 additions and 5 deletions

View file

@ -394,7 +394,10 @@ export default class BufferSyncSupport extends Disposable {
return vscode.Uri.file(filePath);
}
public reOpenDocuments(): void {
public reset(): void {
this.pendingGetErr?.cancel();
this.pendingDiagnostics.clear();
for (const buffer of this.syncedBuffers.allBuffers) {
buffer.open();
}
@ -523,9 +526,9 @@ export default class BufferSyncSupport extends Disposable {
if (this.pendingGetErr) {
this.pendingGetErr.cancel();
for (const file of this.pendingGetErr.files.entries) {
if (this.syncedBuffers.get(file.resource)) {
orderedFileSet.set(file.resource, undefined);
for (const { resource } of this.pendingGetErr.files.entries) {
if (this.syncedBuffers.get(resource)) {
orderedFileSet.set(resource, undefined);
}
}
}

View file

@ -182,7 +182,7 @@ export default class TypeScriptServiceClientHost extends Disposable {
private populateService(): void {
this.fileConfigurationManager.reset();
this.client.bufferSyncSupport.reOpenDocuments();
this.client.bufferSyncSupport.reset();
this.client.bufferSyncSupport.requestAllDiagnostics();
// See https://github.com/Microsoft/TypeScript/issues/5530