Skip to content

Commit 8cb6def

Browse files
authored
Finalize quick pick icon API (microsoft#188157)
* [FR] Ability to provide custom icons in QuickPickItem Fixes microsoft#176049 * Remove warning
1 parent 56aee64 commit 8cb6def

File tree

4 files changed

+9
-28
lines changed

4 files changed

+9
-28
lines changed

src/vs/workbench/api/common/extHostQuickOpen.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx
8686
}
8787

8888
const allowedTooltips = isProposedApiEnabled(extension, 'quickPickItemTooltip');
89-
const allowedIcons = isProposedApiEnabled(extension, 'quickPickItemIcon');
9089

9190
return itemsPromise.then(items => {
9291

@@ -101,10 +100,8 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx
101100
if (item.tooltip && !allowedTooltips) {
102101
console.warn(`Extension '${extension.identifier.value}' uses a tooltip which is proposed API that is only available when running out of dev or with the following command line switch: --enable-proposed-api ${extension.identifier.value}`);
103102
}
104-
if (item.iconPath && !allowedIcons) {
105-
console.warn(`Extension '${extension.identifier.value}' uses an icon which is proposed API that is only available when running out of dev or with the following command line switch: --enable-proposed-api ${extension.identifier.value}`);
106-
}
107-
const icon = (item.iconPath && allowedIcons) ? getIconPathOrClass(item.iconPath) : undefined;
103+
104+
const icon = (item.iconPath) ? getIconPathOrClass(item.iconPath) : undefined;
108105
pickItems.push({
109106
label: item.label,
110107
iconPath: icon?.iconPath,
@@ -573,7 +570,6 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx
573570
});
574571

575572
const allowedTooltips = isProposedApiEnabled(this.extension, 'quickPickItemTooltip');
576-
const allowedIcons = isProposedApiEnabled(this.extension, 'quickPickItemIcon');
577573

578574
const pickItems: TransferQuickPickItemOrSeparator[] = [];
579575
for (let handle = 0; handle < items.length; handle++) {
@@ -584,10 +580,8 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx
584580
if (item.tooltip && !allowedTooltips) {
585581
console.warn(`Extension '${this.extension.identifier.value}' uses a tooltip which is proposed API that is only available when running out of dev or with the following command line switch: --enable-proposed-api ${this.extension.identifier.value}`);
586582
}
587-
if (item.iconPath && !allowedIcons) {
588-
console.warn(`Extension '${this.extension.identifier.value}' uses an icon which is proposed API that is only available when running out of dev or with the following command line switch: --enable-proposed-api ${this.extension.identifier.value}`);
589-
}
590-
const icon = (item.iconPath && allowedIcons) ? getIconPathOrClass(item.iconPath) : undefined;
583+
584+
const icon = (item.iconPath) ? getIconPathOrClass(item.iconPath) : undefined;
591585
pickItems.push({
592586
handle,
593587
label: item.label,

src/vs/workbench/services/extensions/common/extensionsApiProposals.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ export const allApiProposals = Object.freeze({
6767
portsAttributes: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.portsAttributes.d.ts',
6868
profileContentHandlers: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.profileContentHandlers.d.ts',
6969
quickDiffProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickDiffProvider.d.ts',
70-
quickPickItemIcon: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickItemIcon.d.ts',
7170
quickPickItemTooltip: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickItemTooltip.d.ts',
7271
quickPickSortByLabel: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts',
7372
readonlyMessage: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.readonlyMessage.d.ts',

src/vscode-dts/vscode.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,11 @@ declare module 'vscode' {
17331733
*/
17341734
kind?: QuickPickItemKind;
17351735

1736+
/**
1737+
* The icon path or {@link ThemeIcon} for the QuickPickItem.
1738+
*/
1739+
iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
1740+
17361741
/**
17371742
* A human-readable string which is rendered less prominent in the same line. Supports rendering of
17381743
* {@link ThemeIcon theme icons} via the `$(<name>)`-syntax.

src/vscode-dts/vscode.proposed.quickPickItemIcon.d.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)