diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index e99a1dc0d7b..fa7c935586a 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -2872,4 +2872,16 @@ declare module 'vscode' { } //#endregion + + //#region https://github.com/microsoft/vscode/issues/126258 @aeschli + + export interface StatusBarItem { + + /** + * Will be merged into StatusBarItem#tooltip + */ + tooltip2: string | MarkdownString | undefined; + + } + } diff --git a/src/vs/workbench/api/browser/mainThreadStatusBar.ts b/src/vs/workbench/api/browser/mainThreadStatusBar.ts index 69f8d2cf92a..e69dae81fd7 100644 --- a/src/vs/workbench/api/browser/mainThreadStatusBar.ts +++ b/src/vs/workbench/api/browser/mainThreadStatusBar.ts @@ -11,6 +11,7 @@ import { dispose } from 'vs/base/common/lifecycle'; import { Command } from 'vs/editor/common/modes'; import { IAccessibilityInformation } from 'vs/platform/accessibility/common/accessibility'; import { getCodiconAriaLabel } from 'vs/base/common/codicons'; +import { IMarkdownString } from 'vs/base/common/htmlContent'; @extHostNamedCustomer(MainContext.MainThreadStatusBar) export class MainThreadStatusBar implements MainThreadStatusBarShape { @@ -27,7 +28,7 @@ export class MainThreadStatusBar implements MainThreadStatusBarShape { this.entries.clear(); } - $setEntry(entryId: number, id: string, name: string, text: string, tooltip: string | undefined, command: Command | undefined, color: string | ThemeColor | undefined, backgroundColor: string | ThemeColor | undefined, alignment: MainThreadStatusBarAlignment, priority: number | undefined, accessibilityInformation: IAccessibilityInformation): void { + $setEntry(entryId: number, id: string, name: string, text: string, tooltip: IMarkdownString | string | undefined, command: Command | undefined, color: string | ThemeColor | undefined, backgroundColor: string | ThemeColor | undefined, alignment: MainThreadStatusBarAlignment, priority: number | undefined, accessibilityInformation: IAccessibilityInformation): void { // if there are icons in the text use the tooltip for the aria label let ariaLabel: string; let role: string | undefined = undefined; diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 333888d4a87..071ededcafe 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -595,7 +595,7 @@ export interface MainThreadQuickOpenShape extends IDisposable { } export interface MainThreadStatusBarShape extends IDisposable { - $setEntry(id: number, statusId: string, statusName: string, text: string, tooltip: string | undefined, command: ICommandDto | undefined, color: string | ThemeColor | undefined, backgroundColor: string | ThemeColor | undefined, alignment: statusbar.StatusbarAlignment, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): void; + $setEntry(id: number, statusId: string, statusName: string, text: string, tooltip: IMarkdownString | string | undefined, command: ICommandDto | undefined, color: string | ThemeColor | undefined, backgroundColor: string | ThemeColor | undefined, alignment: statusbar.StatusbarAlignment, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): void; $dispose(id: number): void; } diff --git a/src/vs/workbench/api/common/extHostStatusBar.ts b/src/vs/workbench/api/common/extHostStatusBar.ts index f85f182011e..50df9fab6e7 100644 --- a/src/vs/workbench/api/common/extHostStatusBar.ts +++ b/src/vs/workbench/api/common/extHostStatusBar.ts @@ -11,6 +11,7 @@ import { localize } from 'vs/nls'; import { CommandsConverter } from 'vs/workbench/api/common/extHostCommands'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; +import { MarkdownString } from 'vs/workbench/api/common/extHostTypeConverters'; export class ExtHostStatusBarEntry implements vscode.StatusBarItem { @@ -36,6 +37,7 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { private _text: string = ''; private _tooltip?: string; + private _tooltip2?: vscode.MarkdownString | string; private _name?: string; private _color?: string | ThemeColor; private _backgroundColor?: ThemeColor; @@ -87,6 +89,10 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { return this._tooltip; } + public get tooltip2(): string | vscode.MarkdownString | undefined { + return this._tooltip2; + } + public get color(): string | ThemeColor | undefined { return this._color; } @@ -118,6 +124,11 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { this.update(); } + public set tooltip2(tooltip: vscode.MarkdownString | string | undefined) { + this._tooltip2 = tooltip; + this.update(); + } + public set color(color: string | ThemeColor | undefined) { this._color = color; this.update(); @@ -209,8 +220,10 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { color = ExtHostStatusBarEntry.ALLOWED_BACKGROUND_COLORS.get(this._backgroundColor.id); } + const tooltip = this._tooltip2 !== undefined ? MarkdownString.fromStrict(this._tooltip2) : this.tooltip; + // Set to status bar - this.#proxy.$setEntry(this._entryId, id, name, this._text, this._tooltip, this._command?.internal, color, + this.#proxy.$setEntry(this._entryId, id, name, this._text, tooltip, this._command?.internal, color, this._backgroundColor, this._alignment === ExtHostStatusBarAlignment.Left ? MainThreadStatusBarAlignment.LEFT : MainThreadStatusBarAlignment.RIGHT, this._priority, this._accessibilityInformation); }, 0);