Make sure we update js/ts diagnostics when the visible editors change

Changes in one document may cause errors in other, not yet visible docs. Make sure we update the diagnostics when another file becomes visible to handle that case
This commit is contained in:
Matt Bierner
2019-10-23 14:43:28 -07:00
parent 000cff9dd5
commit 611fd60cd4

View File

@@ -349,6 +349,14 @@ export default class BufferSyncSupport extends Disposable {
vscode.workspace.onDidOpenTextDocument(this.openTextDocument, this, this._disposables);
vscode.workspace.onDidCloseTextDocument(this.onDidCloseTextDocument, this, this._disposables);
vscode.workspace.onDidChangeTextDocument(this.onDidChangeTextDocument, this, this._disposables);
vscode.window.onDidChangeVisibleTextEditors(e => {
for (const { document } of e) {
const syncedBuffer = this.syncedBuffers.get(document.uri);
if (syncedBuffer) {
this.requestDiagnostic(syncedBuffer);
}
}
}, this, this._disposables);
vscode.workspace.textDocuments.forEach(this.openTextDocument, this);
}