diff --git a/src/vs/workbench/api/browser/mainThreadQuickOpen.ts b/src/vs/workbench/api/browser/mainThreadQuickOpen.ts index 78f8439bf22..30e3d7bca23 100644 --- a/src/vs/workbench/api/browser/mainThreadQuickOpen.ts +++ b/src/vs/workbench/api/browser/mainThreadQuickOpen.ts @@ -8,6 +8,7 @@ import { ExtHostContext, MainThreadQuickOpenShape, ExtHostQuickOpenShape, Transf import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers'; import { URI } from 'vs/base/common/uri'; import { CancellationToken } from 'vs/base/common/cancellation'; +import { ThemeIcon } from 'vs/platform/theme/common/themeService'; interface QuickInputSession { input: IQuickInput; @@ -185,14 +186,22 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape { return this._quickInputService.backButton; } const { iconPath, tooltip, handle } = button; - return { - iconPath: iconPath && { - dark: URI.revive(iconPath.dark), - light: iconPath.light && URI.revive(iconPath.light) - }, - tooltip, - handle - }; + if ('id' in iconPath) { + return { + iconClass: ThemeIcon.asClassName(iconPath), + tooltip, + handle + }; + } else { + return { + iconPath: { + dark: URI.revive(iconPath.dark), + light: iconPath.light && URI.revive(iconPath.light) + }, + tooltip, + handle + }; + } }); } else { (input as any)[param] = params[param]; diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 19564877215..045e8ce561c 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -439,8 +439,10 @@ export interface TransferQuickPickItems extends quickInput.IQuickPickItem { handle: number; } -export interface TransferQuickInputButton extends quickInput.IQuickInputButton { +export interface TransferQuickInputButton { handle: number; + iconPath: { dark: URI; light?: URI; } | { id: string; }; + tooltip?: string; } export type TransferQuickInput = TransferQuickPick | TransferInputBox; diff --git a/src/vs/workbench/api/common/extHostQuickOpen.ts b/src/vs/workbench/api/common/extHostQuickOpen.ts index aa41e81b660..fa1aca30a20 100644 --- a/src/vs/workbench/api/common/extHostQuickOpen.ts +++ b/src/vs/workbench/api/common/extHostQuickOpen.ts @@ -443,31 +443,21 @@ class ExtHostQuickInput implements QuickInput { } } -function getIconUris(iconPath: QuickInputButton['iconPath']): { dark: URI, light?: URI } | undefined { - const dark = getDarkIconUri(iconPath); - const light = getLightIconUri(iconPath); - if (!light && !dark) { - return undefined; +function getIconUris(iconPath: QuickInputButton['iconPath']): { dark: URI, light?: URI } | { id: string } { + if (iconPath instanceof ThemeIcon) { + return { id: iconPath.id }; } - return { dark: (dark || light)!, light }; + const dark = getDarkIconUri(iconPath as any); + const light = getLightIconUri(iconPath as any); + return { dark, light }; } -function getLightIconUri(iconPath: QuickInputButton['iconPath']) { - if (iconPath && !(iconPath instanceof ThemeIcon)) { - if (typeof iconPath === 'string' - || URI.isUri(iconPath)) { - return getIconUri(iconPath); - } - return getIconUri((iconPath as any).light); - } - return undefined; +function getLightIconUri(iconPath: string | URI | { light: URI; dark: URI; }) { + return getIconUri(typeof iconPath === 'object' && 'light' in iconPath ? iconPath.light : iconPath); } -function getDarkIconUri(iconPath: QuickInputButton['iconPath']) { - if (iconPath && !(iconPath instanceof ThemeIcon) && (iconPath as any).dark) { - return getIconUri((iconPath as any).dark); - } - return undefined; +function getDarkIconUri(iconPath: string | URI | { light: URI; dark: URI; }) { + return getIconUri(typeof iconPath === 'object' && 'dark' in iconPath ? iconPath.dark : iconPath); } function getIconUri(iconPath: string | URI) {