ensure show() hide() show() hide() emits two didHide events. Fixes #135747

This commit is contained in:
Tyler Leonhardt
2021-10-27 15:23:36 -07:00
parent c0d32634fb
commit 5c0e664fd3
2 changed files with 54 additions and 2 deletions

View File

@@ -420,7 +420,15 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx
_fireDidHide() {
if (this._expectingHide) {
this._expectingHide = false;
// if this._visible is true, it means that .show() was called between
// .hide() and .onDidHide. To ensure the correct number of onDidHide events
// are emitted, we set this._expectingOnDidHide to this value so that
// the next time .hide() is called, we can emit the event again.
// Example:
// .show() -> .hide() -> .show() -> .hide() should emit 2 onDidHide events.
// .show() -> .hide() -> .hide() should emit 1 onDidHide event.
// Fixes #135747
this._expectingHide = this._visible;
this._onDidHideEmitter.fire();
}
}