diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/rpc.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/rpc.test.ts index 4cf5f1e0767..2b336f09718 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/rpc.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/rpc.test.ts @@ -50,7 +50,6 @@ suite('vscode', function () { }); test('no rpc, createStatusBarItem(...)', function () { - this.skip(); const item = vscode.window.createStatusBarItem(); dispo.push(item); assertNoRpcFromEntry([item, 'StatusBarItem']); diff --git a/src/vs/workbench/api/common/extHostStatusBar.ts b/src/vs/workbench/api/common/extHostStatusBar.ts index da040c1084b..ba9c5b184ae 100644 --- a/src/vs/workbench/api/common/extHostStatusBar.ts +++ b/src/vs/workbench/api/common/extHostStatusBar.ts @@ -18,6 +18,9 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { [['statusBarItem.errorBackground', new ThemeColor('statusBarItem.errorForeground')]] ); + #proxy: MainThreadStatusBarShape; + #commands: CommandsConverter; + private _id: number; private _alignment: number; private _priority?: number; @@ -38,14 +41,13 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { }; private _timeoutHandle: any; - private _proxy: MainThreadStatusBarShape; - private _commands: CommandsConverter; private _accessibilityInformation?: vscode.AccessibilityInformation; constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, id: string, name: string, alignment: ExtHostStatusBarAlignment = ExtHostStatusBarAlignment.Left, priority?: number, accessibilityInformation?: vscode.AccessibilityInformation) { + this.#proxy = proxy; + this.#commands = commands; + this._id = ExtHostStatusBarEntry.ID_GEN++; - this._proxy = proxy; - this._commands = commands; this._statusId = id; this._statusName = name; this._alignment = alignment; @@ -122,12 +124,12 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { if (typeof command === 'string') { this._command = { fromApi: command, - internal: this._commands.toInternal({ title: '', command }, this._internalCommandRegistration), + internal: this.#commands.toInternal({ title: '', command }, this._internalCommandRegistration), }; } else if (command) { this._command = { fromApi: command, - internal: this._commands.toInternal(command, this._internalCommandRegistration), + internal: this.#commands.toInternal(command, this._internalCommandRegistration), }; } else { this._command = undefined; @@ -148,7 +150,7 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { public hide(): void { clearTimeout(this._timeoutHandle); this._visible = false; - this._proxy.$dispose(this.id); + this.#proxy.$dispose(this.id); } private update(): void { @@ -169,7 +171,7 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { } // Set to status bar - this._proxy.$setEntry(this.id, this._statusId, this._statusName, this._text, this._tooltip, this._command?.internal, color, + this.#proxy.$setEntry(this.id, this._statusId, this._statusName, this._text, this._tooltip, this._command?.internal, color, this._backgroundColor, this._alignment === ExtHostStatusBarAlignment.Left ? MainThreadStatusBarAlignment.LEFT : MainThreadStatusBarAlignment.RIGHT, this._priority, this._accessibilityInformation); }, 0);