From 1d4bf32d41749ee26f2d115a365d4c9f64ec57b8 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Mon, 20 Jan 2025 15:12:40 +0100 Subject: [PATCH 01/14] WIP - initial implementation --- .../common/extensionsApiProposals.ts | 3 ++ .../api/browser/mainThreadStatusBar.ts | 24 ++++++++++---- .../api/browser/statusBarExtensionPoint.ts | 10 +++--- .../workbench/api/common/extHost.protocol.ts | 3 +- .../workbench/api/common/extHostStatusBar.ts | 33 +++++++++++++++++-- .../vscode.proposed.statusBarItemTooltip.d.ts | 13 ++++++++ 6 files changed, 73 insertions(+), 13 deletions(-) create mode 100644 src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts diff --git a/src/vs/platform/extensions/common/extensionsApiProposals.ts b/src/vs/platform/extensions/common/extensionsApiProposals.ts index 102841305a432..79fc43225b960 100644 --- a/src/vs/platform/extensions/common/extensionsApiProposals.ts +++ b/src/vs/platform/extensions/common/extensionsApiProposals.ts @@ -322,6 +322,9 @@ const _allApiProposals = { speech: { proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.speech.d.ts', }, + statusBarItemTooltip: { + proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts', + }, tabInputMultiDiff: { proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tabInputMultiDiff.d.ts', }, diff --git a/src/vs/workbench/api/browser/mainThreadStatusBar.ts b/src/vs/workbench/api/browser/mainThreadStatusBar.ts index 4988e519f39d0..c937d1cdb305c 100644 --- a/src/vs/workbench/api/browser/mainThreadStatusBar.ts +++ b/src/vs/workbench/api/browser/mainThreadStatusBar.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { MainThreadStatusBarShape, MainContext, ExtHostContext, StatusBarItemDto } from '../common/extHost.protocol.js'; +import { MainThreadStatusBarShape, MainContext, ExtHostContext, StatusBarItemDto, ExtHostStatusBarShape } from '../common/extHost.protocol.js'; import { ThemeColor } from '../../../base/common/themables.js'; import { extHostNamedCustomer, IExtHostContext } from '../../services/extensions/common/extHostCustomers.js'; import { DisposableStore, toDisposable } from '../../../base/common/lifecycle.js'; @@ -12,17 +12,20 @@ import { IAccessibilityInformation } from '../../../platform/accessibility/commo import { IMarkdownString } from '../../../base/common/htmlContent.js'; import { IExtensionStatusBarItemService, StatusBarUpdateKind } from './statusBarExtensionPoint.js'; import { IStatusbarEntry, StatusbarAlignment } from '../../services/statusbar/browser/statusbar.js'; +import { IManagedHoverTooltipMarkdownString } from '../../../base/browser/ui/hover/hover.js'; +import { CancellationToken } from '../../../base/common/cancellation.js'; @extHostNamedCustomer(MainContext.MainThreadStatusBar) export class MainThreadStatusBar implements MainThreadStatusBarShape { + private readonly _proxy: ExtHostStatusBarShape; private readonly _store = new DisposableStore(); constructor( extHostContext: IExtHostContext, @IExtensionStatusBarItemService private readonly statusbarService: IExtensionStatusBarItemService ) { - const proxy = extHostContext.getProxy(ExtHostContext.ExtHostStatusBar); + this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostStatusBar); // once, at startup read existing items and send them over const entries: StatusBarItemDto[] = []; @@ -30,11 +33,11 @@ export class MainThreadStatusBar implements MainThreadStatusBarShape { entries.push(asDto(entryId, item)); } - proxy.$acceptStaticEntries(entries); + this._proxy.$acceptStaticEntries(entries); this._store.add(statusbarService.onDidChange(e => { if (e.added) { - proxy.$acceptStaticEntries([asDto(e.added[0], e.added[1])]); + this._proxy.$acceptStaticEntries([asDto(e.added[0], e.added[1])]); } })); @@ -56,8 +59,17 @@ export class MainThreadStatusBar implements MainThreadStatusBarShape { this._store.dispose(); } - $setEntry(entryId: string, id: string, extensionId: string | undefined, name: string, text: string, tooltip: IMarkdownString | string | undefined, command: Command | undefined, color: string | ThemeColor | undefined, backgroundColor: ThemeColor | undefined, alignLeft: boolean, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): void { - const kind = this.statusbarService.setOrUpdateEntry(entryId, id, extensionId, name, text, tooltip, command, color, backgroundColor, alignLeft, priority, accessibilityInformation); + $setEntry(entryId: string, id: string, extensionId: string | undefined, name: string, text: string, tooltip: IMarkdownString | string | undefined, hasToolTipProvider: boolean, command: Command | undefined, color: string | ThemeColor | undefined, backgroundColor: ThemeColor | undefined, alignLeft: boolean, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): void { + const tooltipOrTooptipProvider = hasToolTipProvider + ? { + markdown: (cancellation: CancellationToken) => { + return this._proxy.$provideTooltip(entryId, cancellation); + }, + markdownNotSupportedFallback: undefined + } satisfies IManagedHoverTooltipMarkdownString + : tooltip; + + const kind = this.statusbarService.setOrUpdateEntry(entryId, id, extensionId, name, text, tooltipOrTooptipProvider, command, color, backgroundColor, alignLeft, priority, accessibilityInformation); if (kind === StatusBarUpdateKind.DidDefine) { this._store.add(toDisposable(() => this.statusbarService.unsetEntry(entryId))); } diff --git a/src/vs/workbench/api/browser/statusBarExtensionPoint.ts b/src/vs/workbench/api/browser/statusBarExtensionPoint.ts index 8b2c415ab0b45..fa0d7fd2307c2 100644 --- a/src/vs/workbench/api/browser/statusBarExtensionPoint.ts +++ b/src/vs/workbench/api/browser/statusBarExtensionPoint.ts @@ -13,7 +13,7 @@ import { IStatusbarService, StatusbarAlignment as MainThreadStatusBarAlignment, import { ThemeColor } from '../../../base/common/themables.js'; import { Command } from '../../../editor/common/languages.js'; import { IAccessibilityInformation, isAccessibilityInformation } from '../../../platform/accessibility/common/accessibility.js'; -import { IMarkdownString } from '../../../base/common/htmlContent.js'; +import { IMarkdownString, isMarkdownString } from '../../../base/common/htmlContent.js'; import { getCodiconAriaLabel } from '../../../base/common/iconLabels.js'; import { hash } from '../../../base/common/hash.js'; import { Event, Emitter } from '../../../base/common/event.js'; @@ -22,6 +22,7 @@ import { Iterable } from '../../../base/common/iterator.js'; import { ExtensionIdentifier } from '../../../platform/extensions/common/extensions.js'; import { asStatusBarItemIdentifier } from '../common/extHostTypes.js'; import { STATUS_BAR_ERROR_ITEM_BACKGROUND, STATUS_BAR_WARNING_ITEM_BACKGROUND } from '../../common/theme.js'; +import { IManagedHoverTooltipMarkdownString } from '../../../base/browser/ui/hover/hover.js'; // --- service @@ -49,7 +50,7 @@ export interface IExtensionStatusBarItemService { onDidChange: Event; - setOrUpdateEntry(id: string, statusId: string, extensionId: string | undefined, name: string, text: string, tooltip: IMarkdownString | string | undefined, command: Command | undefined, color: string | ThemeColor | undefined, backgroundColor: ThemeColor | undefined, alignLeft: boolean, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): StatusBarUpdateKind; + setOrUpdateEntry(id: string, statusId: string, extensionId: string | undefined, name: string, text: string, tooltip: IMarkdownString | string | undefined | IManagedHoverTooltipMarkdownString, command: Command | undefined, color: string | ThemeColor | undefined, backgroundColor: ThemeColor | undefined, alignLeft: boolean, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): StatusBarUpdateKind; unsetEntry(id: string): void; @@ -75,7 +76,8 @@ class ExtensionStatusBarItemService implements IExtensionStatusBarItemService { } setOrUpdateEntry(entryId: string, - id: string, extensionId: string | undefined, name: string, text: string, tooltip: IMarkdownString | string | undefined, + id: string, extensionId: string | undefined, name: string, text: string, + tooltip: IMarkdownString | string | undefined | IManagedHoverTooltipMarkdownString, command: Command | undefined, color: string | ThemeColor | undefined, backgroundColor: ThemeColor | undefined, alignLeft: boolean, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined ): StatusBarUpdateKind { @@ -87,7 +89,7 @@ class ExtensionStatusBarItemService implements IExtensionStatusBarItemService { role = accessibilityInformation.role; } else { ariaLabel = getCodiconAriaLabel(text); - if (tooltip) { + if (typeof tooltip === 'string' || isMarkdownString(tooltip)) { const tooltipString = typeof tooltip === 'string' ? tooltip : tooltip.value; ariaLabel += `, ${tooltipString}`; } diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 8eee9d953f980..2dfdba50485b8 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -676,7 +676,7 @@ export interface MainThreadQuickOpenShape extends IDisposable { } export interface MainThreadStatusBarShape extends IDisposable { - $setEntry(id: string, statusId: string, extensionId: string | undefined, statusName: string, text: string, tooltip: IMarkdownString | string | undefined, command: ICommandDto | undefined, color: string | ThemeColor | undefined, backgroundColor: string | ThemeColor | undefined, alignLeft: boolean, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): void; + $setEntry(id: string, statusId: string, extensionId: string | undefined, statusName: string, text: string, tooltip: IMarkdownString | string | undefined, hasToolTipProvider: boolean, command: ICommandDto | undefined, color: string | ThemeColor | undefined, backgroundColor: string | ThemeColor | undefined, alignLeft: boolean, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): void; $disposeEntry(id: string): void; } @@ -693,6 +693,7 @@ export type StatusBarItemDto = { export interface ExtHostStatusBarShape { $acceptStaticEntries(added?: StatusBarItemDto[]): void; + $provideTooltip(entryId: string, cancellation: CancellationToken): Promise; } export interface MainThreadStorageShape extends IDisposable { diff --git a/src/vs/workbench/api/common/extHostStatusBar.ts b/src/vs/workbench/api/common/extHostStatusBar.ts index 327d53c5c925a..1000da5e90881 100644 --- a/src/vs/workbench/api/common/extHostStatusBar.ts +++ b/src/vs/workbench/api/common/extHostStatusBar.ts @@ -14,6 +14,7 @@ import { DisposableStore } from '../../../base/common/lifecycle.js'; import { IExtensionDescription } from '../../../platform/extensions/common/extensions.js'; import { MarkdownString } from './extHostTypeConverters.js'; import { isNumber } from '../../../base/common/types.js'; +import { IMarkdownString } from '../../../base/common/htmlContent.js'; export class ExtHostStatusBarEntry implements vscode.StatusBarItem { @@ -43,6 +44,7 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { private _text: string = ''; private _tooltip?: string | vscode.MarkdownString; + private _tooltip2?: (token: vscode.CancellationToken) => Promise; private _name?: string; private _color?: string | ThemeColor; private _backgroundColor?: ThemeColor; @@ -113,6 +115,10 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { return this._id ?? this._extension!.identifier.value; } + public get entryId(): string { + return this._entryId; + } + public get alignment(): vscode.StatusBarAlignment { return this._alignment; } @@ -133,6 +139,10 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { return this._tooltip; } + public get tooltip2(): ((token: vscode.CancellationToken) => Promise) | undefined { + return this._tooltip2; + } + public get color(): string | ThemeColor | undefined { return this._color; } @@ -164,6 +174,11 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { this.update(); } + public set tooltip2(tooltip: any) { + this._tooltip2 = tooltip; + this.update(); + } + public set color(color: string | ThemeColor | undefined) { this._color = color; this.update(); @@ -259,9 +274,10 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { } const tooltip = MarkdownString.fromStrict(this._tooltip); + const hasToolTipProvider = typeof this._tooltip2 === 'function'; // Set to status bar - this.#proxy.$setEntry(this._entryId, id, this._extension?.identifier.value, name, this._text, tooltip, this._command?.internal, color, + this.#proxy.$setEntry(this._entryId, id, this._extension?.identifier.value, name, this._text, tooltip, hasToolTipProvider, this._command?.internal, color, this._backgroundColor, this._alignment === ExtHostStatusBarAlignment.Left, this._priority, this._accessibilityInformation); @@ -320,6 +336,7 @@ export class ExtHostStatusBar implements ExtHostStatusBarShape { private readonly _proxy: MainThreadStatusBarShape; private readonly _commands: CommandsConverter; private readonly _statusMessage: StatusBarMessage; + private readonly _entries = new Map(); private readonly _existingItems = new Map(); constructor(mainContext: IMainContext, commands: CommandsConverter) { @@ -334,10 +351,22 @@ export class ExtHostStatusBar implements ExtHostStatusBarShape { } } + async $provideTooltip(entryId: string, cancellation: vscode.CancellationToken): Promise { + const entry = this._entries.get(entryId); + if (!entry) { + return undefined; + } + + return MarkdownString.fromStrict(await entry.tooltip2?.(cancellation)); + } + createStatusBarEntry(extension: IExtensionDescription | undefined, id: string, alignment?: ExtHostStatusBarAlignment, priority?: number): vscode.StatusBarItem; createStatusBarEntry(extension: IExtensionDescription, id?: string, alignment?: ExtHostStatusBarAlignment, priority?: number): vscode.StatusBarItem; createStatusBarEntry(extension: IExtensionDescription, id: string, alignment?: ExtHostStatusBarAlignment, priority?: number): vscode.StatusBarItem { - return new ExtHostStatusBarEntry(this._proxy, this._commands, this._existingItems, extension, id, alignment, priority); + const entry = new ExtHostStatusBarEntry(this._proxy, this._commands, this._existingItems, extension, id, alignment, priority); + this._entries.set(entry.entryId, entry); + + return entry; } setStatusBarMessage(text: string, timeoutOrThenable?: number | Thenable): Disposable { diff --git a/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts b/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts new file mode 100644 index 0000000000000..699a49d7647ea --- /dev/null +++ b/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +declare module 'vscode' { + + // https://github.com/microsoft/vscode/issues/234339 + + export interface StatusBarItem { + tooltip2?: (token: CancellationToken) => ProviderResult; + } +} From 247d234e3f69c0329862da3341260b7243692589 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Mon, 20 Jan 2025 16:54:25 +0100 Subject: [PATCH 02/14] Update src/vs/workbench/api/browser/mainThreadStatusBar.ts Co-authored-by: Benjamin Pasero --- src/vs/workbench/api/browser/mainThreadStatusBar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/api/browser/mainThreadStatusBar.ts b/src/vs/workbench/api/browser/mainThreadStatusBar.ts index c937d1cdb305c..ced6f25326e3a 100644 --- a/src/vs/workbench/api/browser/mainThreadStatusBar.ts +++ b/src/vs/workbench/api/browser/mainThreadStatusBar.ts @@ -59,7 +59,7 @@ export class MainThreadStatusBar implements MainThreadStatusBarShape { this._store.dispose(); } - $setEntry(entryId: string, id: string, extensionId: string | undefined, name: string, text: string, tooltip: IMarkdownString | string | undefined, hasToolTipProvider: boolean, command: Command | undefined, color: string | ThemeColor | undefined, backgroundColor: ThemeColor | undefined, alignLeft: boolean, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): void { + $setEntry(entryId: string, id: string, extensionId: string | undefined, name: string, text: string, tooltip: IMarkdownString | string | undefined, hasTooltipProvider: boolean, command: Command | undefined, color: string | ThemeColor | undefined, backgroundColor: ThemeColor | undefined, alignLeft: boolean, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): void { const tooltipOrTooptipProvider = hasToolTipProvider ? { markdown: (cancellation: CancellationToken) => { From 8143cd4e284795983b3684a307edaedce9f5740e Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Mon, 20 Jan 2025 16:54:33 +0100 Subject: [PATCH 03/14] Update src/vs/workbench/api/common/extHost.protocol.ts Co-authored-by: Benjamin Pasero --- src/vs/workbench/api/common/extHost.protocol.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 2dfdba50485b8..9fc6326f8ae64 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -676,7 +676,7 @@ export interface MainThreadQuickOpenShape extends IDisposable { } export interface MainThreadStatusBarShape extends IDisposable { - $setEntry(id: string, statusId: string, extensionId: string | undefined, statusName: string, text: string, tooltip: IMarkdownString | string | undefined, hasToolTipProvider: boolean, command: ICommandDto | undefined, color: string | ThemeColor | undefined, backgroundColor: string | ThemeColor | undefined, alignLeft: boolean, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): void; + $setEntry(id: string, statusId: string, extensionId: string | undefined, statusName: string, text: string, tooltip: IMarkdownString | string | undefined, hasTooltipProvider: boolean, command: ICommandDto | undefined, color: string | ThemeColor | undefined, backgroundColor: string | ThemeColor | undefined, alignLeft: boolean, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): void; $disposeEntry(id: string): void; } From 6a7f2d10ef5a4a08acaed638d209680f51620804 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Mon, 20 Jan 2025 16:54:51 +0100 Subject: [PATCH 04/14] Update src/vs/workbench/api/common/extHostStatusBar.ts Co-authored-by: Benjamin Pasero --- src/vs/workbench/api/common/extHostStatusBar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/api/common/extHostStatusBar.ts b/src/vs/workbench/api/common/extHostStatusBar.ts index 1000da5e90881..44ee0137726aa 100644 --- a/src/vs/workbench/api/common/extHostStatusBar.ts +++ b/src/vs/workbench/api/common/extHostStatusBar.ts @@ -274,7 +274,7 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { } const tooltip = MarkdownString.fromStrict(this._tooltip); - const hasToolTipProvider = typeof this._tooltip2 === 'function'; + const hasTooltipProvider = typeof this._tooltip2 === 'function'; // Set to status bar this.#proxy.$setEntry(this._entryId, id, this._extension?.identifier.value, name, this._text, tooltip, hasToolTipProvider, this._command?.internal, color, From 764d881e7a50e22d51bf135d950f47e666371f20 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Mon, 20 Jan 2025 16:55:03 +0100 Subject: [PATCH 05/14] Update src/vs/workbench/api/browser/mainThreadStatusBar.ts Co-authored-by: Benjamin Pasero --- src/vs/workbench/api/browser/mainThreadStatusBar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/api/browser/mainThreadStatusBar.ts b/src/vs/workbench/api/browser/mainThreadStatusBar.ts index ced6f25326e3a..83c3d02f89349 100644 --- a/src/vs/workbench/api/browser/mainThreadStatusBar.ts +++ b/src/vs/workbench/api/browser/mainThreadStatusBar.ts @@ -60,7 +60,7 @@ export class MainThreadStatusBar implements MainThreadStatusBarShape { } $setEntry(entryId: string, id: string, extensionId: string | undefined, name: string, text: string, tooltip: IMarkdownString | string | undefined, hasTooltipProvider: boolean, command: Command | undefined, color: string | ThemeColor | undefined, backgroundColor: ThemeColor | undefined, alignLeft: boolean, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): void { - const tooltipOrTooptipProvider = hasToolTipProvider + const tooltipOrTooltipProvider = hasTooltipProvider ? { markdown: (cancellation: CancellationToken) => { return this._proxy.$provideTooltip(entryId, cancellation); From 640c850f335792bf6d1b348264eac20085bce65c Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Mon, 20 Jan 2025 16:56:38 +0100 Subject: [PATCH 06/14] Fix compilation errors --- src/vs/workbench/api/browser/mainThreadStatusBar.ts | 2 +- src/vs/workbench/api/common/extHostStatusBar.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadStatusBar.ts b/src/vs/workbench/api/browser/mainThreadStatusBar.ts index 83c3d02f89349..96059861a79ae 100644 --- a/src/vs/workbench/api/browser/mainThreadStatusBar.ts +++ b/src/vs/workbench/api/browser/mainThreadStatusBar.ts @@ -69,7 +69,7 @@ export class MainThreadStatusBar implements MainThreadStatusBarShape { } satisfies IManagedHoverTooltipMarkdownString : tooltip; - const kind = this.statusbarService.setOrUpdateEntry(entryId, id, extensionId, name, text, tooltipOrTooptipProvider, command, color, backgroundColor, alignLeft, priority, accessibilityInformation); + const kind = this.statusbarService.setOrUpdateEntry(entryId, id, extensionId, name, text, tooltipOrTooltipProvider, command, color, backgroundColor, alignLeft, priority, accessibilityInformation); if (kind === StatusBarUpdateKind.DidDefine) { this._store.add(toDisposable(() => this.statusbarService.unsetEntry(entryId))); } diff --git a/src/vs/workbench/api/common/extHostStatusBar.ts b/src/vs/workbench/api/common/extHostStatusBar.ts index 44ee0137726aa..15f2049b24a74 100644 --- a/src/vs/workbench/api/common/extHostStatusBar.ts +++ b/src/vs/workbench/api/common/extHostStatusBar.ts @@ -277,7 +277,7 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { const hasTooltipProvider = typeof this._tooltip2 === 'function'; // Set to status bar - this.#proxy.$setEntry(this._entryId, id, this._extension?.identifier.value, name, this._text, tooltip, hasToolTipProvider, this._command?.internal, color, + this.#proxy.$setEntry(this._entryId, id, this._extension?.identifier.value, name, this._text, tooltip, hasTooltipProvider, this._command?.internal, color, this._backgroundColor, this._alignment === ExtHostStatusBarAlignment.Left, this._priority, this._accessibilityInformation); From 6d78411560e0952debc824effa7522eba612265b Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Mon, 20 Jan 2025 17:22:57 +0100 Subject: [PATCH 07/14] Remove items when disposed --- src/vs/workbench/api/common/extHostStatusBar.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/api/common/extHostStatusBar.ts b/src/vs/workbench/api/common/extHostStatusBar.ts index 15f2049b24a74..14040786c98ca 100644 --- a/src/vs/workbench/api/common/extHostStatusBar.ts +++ b/src/vs/workbench/api/common/extHostStatusBar.ts @@ -59,9 +59,9 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { private _timeoutHandle: any; private _accessibilityInformation?: vscode.AccessibilityInformation; - constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, staticItems: ReadonlyMap, extension: IExtensionDescription, id?: string, alignment?: ExtHostStatusBarAlignment, priority?: number); - constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, staticItems: ReadonlyMap, extension: IExtensionDescription | undefined, id: string, alignment?: ExtHostStatusBarAlignment, priority?: number); - constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, staticItems: ReadonlyMap, extension?: IExtensionDescription, id?: string, alignment: ExtHostStatusBarAlignment = ExtHostStatusBarAlignment.Left, priority?: number) { + constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, staticItems: Map, entries: Map, extension: IExtensionDescription, id?: string, alignment?: ExtHostStatusBarAlignment, priority?: number); + constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, staticItems: Map, entries: Map, extension: IExtensionDescription | undefined, id: string, alignment?: ExtHostStatusBarAlignment, priority?: number); + constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, private staticItems: Map, private entries: Map, extension?: IExtensionDescription, id?: string, alignment: ExtHostStatusBarAlignment = ExtHostStatusBarAlignment.Left, priority?: number) { this.#proxy = proxy; this.#commands = commands; @@ -288,6 +288,10 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { public dispose(): void { this.hide(); + + this.staticItems.delete(this._entryId); + this.entries.delete(this._entryId); + this._disposed = true; } } @@ -363,7 +367,7 @@ export class ExtHostStatusBar implements ExtHostStatusBarShape { createStatusBarEntry(extension: IExtensionDescription | undefined, id: string, alignment?: ExtHostStatusBarAlignment, priority?: number): vscode.StatusBarItem; createStatusBarEntry(extension: IExtensionDescription, id?: string, alignment?: ExtHostStatusBarAlignment, priority?: number): vscode.StatusBarItem; createStatusBarEntry(extension: IExtensionDescription, id: string, alignment?: ExtHostStatusBarAlignment, priority?: number): vscode.StatusBarItem { - const entry = new ExtHostStatusBarEntry(this._proxy, this._commands, this._existingItems, extension, id, alignment, priority); + const entry = new ExtHostStatusBarEntry(this._proxy, this._commands, this._existingItems, this._entries, extension, id, alignment, priority); this._entries.set(entry.entryId, entry); return entry; From b05396170b96cf2d14e8b83c783c5f257317a848 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Mon, 20 Jan 2025 20:23:24 +0100 Subject: [PATCH 08/14] Pull request feedback --- .../api/browser/mainThreadStatusBar.ts | 7 ++-- .../workbench/api/common/extHost.protocol.ts | 2 +- .../workbench/api/common/extHostStatusBar.ts | 32 ++++++++++++------- .../vscode.proposed.statusBarItemTooltip.d.ts | 2 +- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadStatusBar.ts b/src/vs/workbench/api/browser/mainThreadStatusBar.ts index 96059861a79ae..df282034d3ff3 100644 --- a/src/vs/workbench/api/browser/mainThreadStatusBar.ts +++ b/src/vs/workbench/api/browser/mainThreadStatusBar.ts @@ -36,9 +36,10 @@ export class MainThreadStatusBar implements MainThreadStatusBarShape { this._proxy.$acceptStaticEntries(entries); this._store.add(statusbarService.onDidChange(e => { - if (e.added) { - this._proxy.$acceptStaticEntries([asDto(e.added[0], e.added[1])]); - } + const added = e.added ? [asDto(e.added[0], e.added[1])] : []; + const removed = e.removed ? [e.removed] : []; + + this._proxy.$acceptStaticEntries(added, removed); })); function asDto(entryId: string, item: { entry: IStatusbarEntry; alignment: StatusbarAlignment; priority: number }): StatusBarItemDto { diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 9fc6326f8ae64..08a1913729f32 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -692,7 +692,7 @@ export type StatusBarItemDto = { }; export interface ExtHostStatusBarShape { - $acceptStaticEntries(added?: StatusBarItemDto[]): void; + $acceptStaticEntries(added?: StatusBarItemDto[], removed?: string[]): void; $provideTooltip(entryId: string, cancellation: CancellationToken): Promise; } diff --git a/src/vs/workbench/api/common/extHostStatusBar.ts b/src/vs/workbench/api/common/extHostStatusBar.ts index 14040786c98ca..87a6c8e4a862f 100644 --- a/src/vs/workbench/api/common/extHostStatusBar.ts +++ b/src/vs/workbench/api/common/extHostStatusBar.ts @@ -15,6 +15,7 @@ import { IExtensionDescription } from '../../../platform/extensions/common/exten import { MarkdownString } from './extHostTypeConverters.js'; import { isNumber } from '../../../base/common/types.js'; import { IMarkdownString } from '../../../base/common/htmlContent.js'; +import { checkProposedApiEnabled } from '../../services/extensions/common/extensions.js'; export class ExtHostStatusBarEntry implements vscode.StatusBarItem { @@ -59,9 +60,9 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { private _timeoutHandle: any; private _accessibilityInformation?: vscode.AccessibilityInformation; - constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, staticItems: Map, entries: Map, extension: IExtensionDescription, id?: string, alignment?: ExtHostStatusBarAlignment, priority?: number); - constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, staticItems: Map, entries: Map, extension: IExtensionDescription | undefined, id: string, alignment?: ExtHostStatusBarAlignment, priority?: number); - constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, private staticItems: Map, private entries: Map, extension?: IExtensionDescription, id?: string, alignment: ExtHostStatusBarAlignment = ExtHostStatusBarAlignment.Left, priority?: number) { + constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, staticItems: ReadonlyMap, extension: IExtensionDescription, id?: string, alignment?: ExtHostStatusBarAlignment, priority?: number); + constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, staticItems: ReadonlyMap, extension: IExtensionDescription | undefined, id: string, alignment?: ExtHostStatusBarAlignment, priority?: number); + constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, staticItems: ReadonlyMap, extension?: IExtensionDescription, id?: string, alignment: ExtHostStatusBarAlignment = ExtHostStatusBarAlignment.Left, priority?: number) { this.#proxy = proxy; this.#commands = commands; @@ -140,6 +141,10 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { } public get tooltip2(): ((token: vscode.CancellationToken) => Promise) | undefined { + if (this._extension) { + checkProposedApiEnabled(this._extension, 'statusBarItemTooltip'); + } + return this._tooltip2; } @@ -174,7 +179,11 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { this.update(); } - public set tooltip2(tooltip: any) { + public set tooltip2(tooltip: ((token: vscode.CancellationToken) => Promise) | undefined) { + if (this._extension) { + checkProposedApiEnabled(this._extension, 'statusBarItemTooltip'); + } + this._tooltip2 = tooltip; this.update(); } @@ -288,10 +297,6 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { public dispose(): void { this.hide(); - - this.staticItems.delete(this._entryId); - this.entries.delete(this._entryId); - this._disposed = true; } } @@ -349,10 +354,14 @@ export class ExtHostStatusBar implements ExtHostStatusBarShape { this._statusMessage = new StatusBarMessage(this); } - $acceptStaticEntries(added: StatusBarItemDto[]): void { + $acceptStaticEntries(added: StatusBarItemDto[], removed: string[] = []): void { for (const item of added) { this._existingItems.set(item.entryId, item); } + + for (const entryId of removed) { + this._entries.delete(entryId); + } } async $provideTooltip(entryId: string, cancellation: vscode.CancellationToken): Promise { @@ -361,13 +370,14 @@ export class ExtHostStatusBar implements ExtHostStatusBarShape { return undefined; } - return MarkdownString.fromStrict(await entry.tooltip2?.(cancellation)); + const tooltip = await entry.tooltip2?.(cancellation); + return !cancellation.isCancellationRequested ? MarkdownString.fromStrict(tooltip) : undefined; } createStatusBarEntry(extension: IExtensionDescription | undefined, id: string, alignment?: ExtHostStatusBarAlignment, priority?: number): vscode.StatusBarItem; createStatusBarEntry(extension: IExtensionDescription, id?: string, alignment?: ExtHostStatusBarAlignment, priority?: number): vscode.StatusBarItem; createStatusBarEntry(extension: IExtensionDescription, id: string, alignment?: ExtHostStatusBarAlignment, priority?: number): vscode.StatusBarItem { - const entry = new ExtHostStatusBarEntry(this._proxy, this._commands, this._existingItems, this._entries, extension, id, alignment, priority); + const entry = new ExtHostStatusBarEntry(this._proxy, this._commands, this._existingItems, extension, id, alignment, priority); this._entries.set(entry.entryId, entry); return entry; diff --git a/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts b/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts index 699a49d7647ea..648f9bf19768f 100644 --- a/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts +++ b/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts @@ -8,6 +8,6 @@ declare module 'vscode' { // https://github.com/microsoft/vscode/issues/234339 export interface StatusBarItem { - tooltip2?: (token: CancellationToken) => ProviderResult; + tooltip: string | MarkdownString | undefined | ((token: CancellationToken) => ProviderResult); } } From 3ae22e3ca4f0125f8ea1836682239ce5ccf2a386 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Mon, 20 Jan 2025 20:26:37 +0100 Subject: [PATCH 09/14] Pull request feedback --- src/vs/workbench/api/browser/mainThreadStatusBar.ts | 4 +--- src/vs/workbench/api/common/extHost.protocol.ts | 2 +- src/vs/workbench/api/common/extHostStatusBar.ts | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadStatusBar.ts b/src/vs/workbench/api/browser/mainThreadStatusBar.ts index df282034d3ff3..92d66d7a2f084 100644 --- a/src/vs/workbench/api/browser/mainThreadStatusBar.ts +++ b/src/vs/workbench/api/browser/mainThreadStatusBar.ts @@ -37,9 +37,7 @@ export class MainThreadStatusBar implements MainThreadStatusBarShape { this._store.add(statusbarService.onDidChange(e => { const added = e.added ? [asDto(e.added[0], e.added[1])] : []; - const removed = e.removed ? [e.removed] : []; - - this._proxy.$acceptStaticEntries(added, removed); + this._proxy.$acceptStaticEntries(added, e.removed); })); function asDto(entryId: string, item: { entry: IStatusbarEntry; alignment: StatusbarAlignment; priority: number }): StatusBarItemDto { diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 08a1913729f32..3f31329b105a5 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -692,7 +692,7 @@ export type StatusBarItemDto = { }; export interface ExtHostStatusBarShape { - $acceptStaticEntries(added?: StatusBarItemDto[], removed?: string[]): void; + $acceptStaticEntries(added?: StatusBarItemDto[], removed?: string): void; $provideTooltip(entryId: string, cancellation: CancellationToken): Promise; } diff --git a/src/vs/workbench/api/common/extHostStatusBar.ts b/src/vs/workbench/api/common/extHostStatusBar.ts index 87a6c8e4a862f..953f832dd36a1 100644 --- a/src/vs/workbench/api/common/extHostStatusBar.ts +++ b/src/vs/workbench/api/common/extHostStatusBar.ts @@ -354,13 +354,13 @@ export class ExtHostStatusBar implements ExtHostStatusBarShape { this._statusMessage = new StatusBarMessage(this); } - $acceptStaticEntries(added: StatusBarItemDto[], removed: string[] = []): void { + $acceptStaticEntries(added: StatusBarItemDto[], removed?: string): void { for (const item of added) { this._existingItems.set(item.entryId, item); } - for (const entryId of removed) { - this._entries.delete(entryId); + if (removed) { + this._entries.delete(removed); } } From 5d3820c18d3d1f5b42aba37992084a052bcb70b0 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Mon, 20 Jan 2025 20:30:35 +0100 Subject: [PATCH 10/14] Fix compilation error --- src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts b/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts index 648f9bf19768f..87f40beb0eb7c 100644 --- a/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts +++ b/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts @@ -8,6 +8,6 @@ declare module 'vscode' { // https://github.com/microsoft/vscode/issues/234339 export interface StatusBarItem { - tooltip: string | MarkdownString | undefined | ((token: CancellationToken) => ProviderResult); + tooltip2: string | MarkdownString | undefined | ((token: CancellationToken) => ProviderResult); } } From e9ce5f5648e2e56a6992e18b8752e4032be4ade1 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 21 Jan 2025 07:36:41 +0100 Subject: [PATCH 11/14] polish `tooltip2` type --- src/vs/workbench/api/common/extHostStatusBar.ts | 8 ++++---- src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/api/common/extHostStatusBar.ts b/src/vs/workbench/api/common/extHostStatusBar.ts index 953f832dd36a1..a321fd16b9a52 100644 --- a/src/vs/workbench/api/common/extHostStatusBar.ts +++ b/src/vs/workbench/api/common/extHostStatusBar.ts @@ -45,7 +45,7 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { private _text: string = ''; private _tooltip?: string | vscode.MarkdownString; - private _tooltip2?: (token: vscode.CancellationToken) => Promise; + private _tooltip2?: string | vscode.MarkdownString | undefined | ((token: vscode.CancellationToken) => Promise); private _name?: string; private _color?: string | ThemeColor; private _backgroundColor?: ThemeColor; @@ -140,7 +140,7 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { return this._tooltip; } - public get tooltip2(): ((token: vscode.CancellationToken) => Promise) | undefined { + public get tooltip2(): vscode.MarkdownString | string | undefined | ((token: vscode.CancellationToken) => Promise) { if (this._extension) { checkProposedApiEnabled(this._extension, 'statusBarItemTooltip'); } @@ -179,7 +179,7 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { this.update(); } - public set tooltip2(tooltip: ((token: vscode.CancellationToken) => Promise) | undefined) { + public set tooltip2(tooltip: vscode.MarkdownString | string | undefined | ((token: vscode.CancellationToken) => Promise)) { if (this._extension) { checkProposedApiEnabled(this._extension, 'statusBarItemTooltip'); } @@ -370,7 +370,7 @@ export class ExtHostStatusBar implements ExtHostStatusBarShape { return undefined; } - const tooltip = await entry.tooltip2?.(cancellation); + const tooltip = typeof entry.tooltip2 === 'function' ? await entry.tooltip2(cancellation) : entry.tooltip2; return !cancellation.isCancellationRequested ? MarkdownString.fromStrict(tooltip) : undefined; } diff --git a/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts b/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts index 87f40beb0eb7c..1f8c2c4bfefb2 100644 --- a/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts +++ b/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts @@ -8,6 +8,6 @@ declare module 'vscode' { // https://github.com/microsoft/vscode/issues/234339 export interface StatusBarItem { - tooltip2: string | MarkdownString | undefined | ((token: CancellationToken) => ProviderResult); + tooltip2: string | MarkdownString | undefined | ((token: CancellationToken) => ProviderResult); } } From e422493e919a4dbff5a7222d7168dd08d5e065f9 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 21 Jan 2025 07:54:08 +0100 Subject: [PATCH 12/14] fix `tooltip2` --- src/vs/workbench/api/common/extHostStatusBar.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/api/common/extHostStatusBar.ts b/src/vs/workbench/api/common/extHostStatusBar.ts index a321fd16b9a52..b82d04c56ea5b 100644 --- a/src/vs/workbench/api/common/extHostStatusBar.ts +++ b/src/vs/workbench/api/common/extHostStatusBar.ts @@ -282,8 +282,15 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { color = ExtHostStatusBarEntry.ALLOWED_BACKGROUND_COLORS.get(this._backgroundColor.id); } - const tooltip = MarkdownString.fromStrict(this._tooltip); - const hasTooltipProvider = typeof this._tooltip2 === 'function'; + let tooltip; + let hasTooltipProvider; + if (typeof this._tooltip2 === 'function') { + tooltip = MarkdownString.fromStrict(this._tooltip); + hasTooltipProvider = true; + } else { + tooltip = this._tooltip2 ?? this._tooltip; + hasTooltipProvider = false; + } // Set to status bar this.#proxy.$setEntry(this._entryId, id, this._extension?.identifier.value, name, this._text, tooltip, hasTooltipProvider, this._command?.internal, color, From 4c111b1efe2149f52d1efc688d0ae501dde0654a Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 21 Jan 2025 08:19:21 +0100 Subject: [PATCH 13/14] fix usage of tooltip --- src/vs/workbench/api/common/extHostStatusBar.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/api/common/extHostStatusBar.ts b/src/vs/workbench/api/common/extHostStatusBar.ts index b82d04c56ea5b..b05a1879f104a 100644 --- a/src/vs/workbench/api/common/extHostStatusBar.ts +++ b/src/vs/workbench/api/common/extHostStatusBar.ts @@ -14,7 +14,7 @@ import { DisposableStore } from '../../../base/common/lifecycle.js'; import { IExtensionDescription } from '../../../platform/extensions/common/extensions.js'; import { MarkdownString } from './extHostTypeConverters.js'; import { isNumber } from '../../../base/common/types.js'; -import { IMarkdownString } from '../../../base/common/htmlContent.js'; +import * as htmlContent from '../../../base/common/htmlContent.js'; import { checkProposedApiEnabled } from '../../services/extensions/common/extensions.js'; @@ -282,13 +282,13 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem { color = ExtHostStatusBarEntry.ALLOWED_BACKGROUND_COLORS.get(this._backgroundColor.id); } - let tooltip; - let hasTooltipProvider; + let tooltip: undefined | string | htmlContent.IMarkdownString; + let hasTooltipProvider: boolean; if (typeof this._tooltip2 === 'function') { tooltip = MarkdownString.fromStrict(this._tooltip); hasTooltipProvider = true; } else { - tooltip = this._tooltip2 ?? this._tooltip; + tooltip = MarkdownString.fromStrict(this._tooltip2 ?? this._tooltip); hasTooltipProvider = false; } @@ -371,7 +371,7 @@ export class ExtHostStatusBar implements ExtHostStatusBarShape { } } - async $provideTooltip(entryId: string, cancellation: vscode.CancellationToken): Promise { + async $provideTooltip(entryId: string, cancellation: vscode.CancellationToken): Promise { const entry = this._entries.get(entryId); if (!entry) { return undefined; From cc3aa1b4c5b7a745e2afd14473d89945934423fb Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 21 Jan 2025 08:22:17 +0100 Subject: [PATCH 14/14] docs --- src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts b/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts index 1f8c2c4bfefb2..5db0495b5a73b 100644 --- a/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts +++ b/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts @@ -8,6 +8,12 @@ declare module 'vscode' { // https://github.com/microsoft/vscode/issues/234339 export interface StatusBarItem { + + /** + * The tooltip text when you hover over this entry. + * + * Can optionally return the tooltip in a thenable if the computation is expensive. + */ tooltip2: string | MarkdownString | undefined | ((token: CancellationToken) => ProviderResult); } }