Making status bar items for images more reliable

Fixes #81738
This commit is contained in:
Matt Bierner
2019-10-01 15:05:10 -07:00
parent 47ac64a019
commit c241e1d5e4
3 changed files with 47 additions and 28 deletions

View File

@@ -12,6 +12,8 @@ const localize = nls.loadMessageBundle();
export class SizeStatusBarEntry extends Disposable {
private readonly _entry: vscode.StatusBarItem;
private _showingOwner: string | undefined;
constructor() {
super();
this._entry = this._register(vscode.window.createStatusBarItem({
@@ -22,15 +24,16 @@ export class SizeStatusBarEntry extends Disposable {
}));
}
public show() {
public show(owner: string, text: string) {
this._showingOwner = owner;
this._entry.text = text;
this._entry.show();
}
public hide() {
this._entry.hide();
}
public update(text: string) {
this._entry.text = text;
public hide(owner: string) {
if (owner === this._showingOwner) {
this._entry.hide();
this._showingOwner = undefined;
}
}
}