From 31a88cc9eb221d0aef513bd00cffdb8550176bb9 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sat, 13 May 2023 08:42:33 -0700 Subject: [PATCH] Fix invalid tree icon warning (#23127) --- src/vs/workbench/api/common/extHostTypes.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index a4278406b8..8d089b076c 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -2448,8 +2448,11 @@ export class TreeItem { return false; } if ((treeItemThing.iconPath !== undefined) && !isString(treeItemThing.iconPath) && !URI.isUri(treeItemThing.iconPath) && !isString((treeItemThing.iconPath as vscode.ThemeIcon).id)) { - console.log('INVALID tree item, invalid iconPath', treeItemThing.iconPath); - return false; + const asLightAndDarkThing = treeItemThing.iconPath as { light: string | URI; dark: string | URI }; + if (!isString(asLightAndDarkThing.light) && !URI.isUri(asLightAndDarkThing.light) && !isString(asLightAndDarkThing.dark) && !URI.isUri(asLightAndDarkThing.dark)) { + console.log('INVALID tree item, invalid iconPath', treeItemThing.iconPath); + return false; + } } if ((treeItemThing.description !== undefined) && !isString(treeItemThing.description) && (typeof treeItemThing.description !== 'boolean')) { console.log('INVALID tree item, invalid description', treeItemThing.description);