diff --git a/src/vs/workbench/contrib/chat/browser/chatEditorInput.ts b/src/vs/workbench/contrib/chat/browser/chatEditorInput.ts index 184718d2283e6..1fb1cf6f96c1f 100644 --- a/src/vs/workbench/contrib/chat/browser/chatEditorInput.ts +++ b/src/vs/workbench/contrib/chat/browser/chatEditorInput.ts @@ -206,12 +206,6 @@ export class ChatEditorInput extends EditorInput implements IEditorCloseHandler } override getIcon(): ThemeIcon | URI | undefined { - // Return cached icon if available - if (this.cachedIcon) { - return this.cachedIcon; - } - - // Try to resolve icon and cache it const resolvedIcon = this.resolveIcon(); if (resolvedIcon) { this.cachedIcon = resolvedIcon; diff --git a/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.ts b/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.ts index 182e940ed30dc..9fbe7e2dccac9 100644 --- a/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.ts +++ b/src/vs/workbench/contrib/chat/browser/chatSessions.contribution.ts @@ -19,6 +19,8 @@ import { ContextKeyExpr, IContextKeyService } from '../../../../platform/context import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js'; import { ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js'; import { ILogService } from '../../../../platform/log/common/log.js'; +import { isDark } from '../../../../platform/theme/common/theme.js'; +import { IThemeService } from '../../../../platform/theme/common/themeService.js'; import { IEditableData } from '../../../common/views.js'; import { IEditorService } from '../../../services/editor/common/editorService.js'; import { IExtensionService, isProposedApiEnabled } from '../../../services/extensions/common/extensions.js'; @@ -64,7 +66,22 @@ const extensionPoint = ExtensionsRegistry.registerExtensionPoint = new Map(); private readonly _sessionTypeOptions: Map = new Map(); - private readonly _sessionTypeIcons: Map = new Map(); + private readonly _sessionTypeIcons: Map = new Map(); private readonly _sessionTypeWelcomeTitles: Map = new Map(); private readonly _sessionTypeWelcomeMessages: Map = new Map(); private readonly _sessionTypeWelcomeTips: Map = new Map(); @@ -250,6 +267,7 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ @IContextKeyService private readonly _contextKeyService: IContextKeyService, @IMenuService private readonly _menuService: IMenuService, @IConfigurationService private readonly _configurationService: IConfigurationService, + @IThemeService private readonly _themeService: IThemeService ) { super(); this._register(extensionPoint.setHandler(extensions => { @@ -357,12 +375,20 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ } // Store icon mapping if provided - let icon: ThemeIcon | URI | undefined; + let icon: ThemeIcon | { dark: URI; light: URI } | undefined; if (contribution.icon) { // Parse icon string - support ThemeIcon format or file path from extension - const themeIcon = ThemeIcon.fromString(contribution.icon); - icon = themeIcon || resources.joinPath(contribution.extensionDescription.extensionLocation, contribution.icon); + if (typeof contribution.icon === 'string') { + icon = contribution.icon.startsWith('$(') && contribution.icon.endsWith(')') + ? ThemeIcon.fromString(contribution.icon) + : ThemeIcon.fromId(contribution.icon); + } else { + icon = { + dark: resources.joinPath(contribution.extensionDescription.extensionLocation, contribution.icon.dark), + light: resources.joinPath(contribution.extensionDescription.extensionLocation, contribution.icon.light) + }; + } } if (icon) { @@ -880,7 +906,17 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ * Get the icon for a specific session type */ public getIconForSessionType(chatSessionType: string): ThemeIcon | URI | undefined { - return this._sessionTypeIcons.get(chatSessionType); + const sessionTypeIcon = this._sessionTypeIcons.get(chatSessionType); + + if (ThemeIcon.isThemeIcon(sessionTypeIcon)) { + return sessionTypeIcon; + } + + if (isDark(this._themeService.getColorTheme().type)) { + return sessionTypeIcon?.dark; + } else { + return sessionTypeIcon?.light; + } } /** diff --git a/src/vs/workbench/contrib/chat/common/chatSessionsService.ts b/src/vs/workbench/contrib/chat/common/chatSessionsService.ts index 4d5270ae1f6b9..f4430b9ee87fe 100644 --- a/src/vs/workbench/contrib/chat/common/chatSessionsService.ts +++ b/src/vs/workbench/contrib/chat/common/chatSessionsService.ts @@ -49,7 +49,7 @@ export interface IChatSessionsExtensionPoint { readonly description: string; readonly extensionDescription: IRelaxedExtensionDescription; readonly when?: string; - readonly icon?: string; + readonly icon?: string | { light: string; dark: string }; readonly order?: number; readonly alternativeIds?: string[]; readonly welcomeTitle?: string; diff --git a/src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts b/src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts index 04390f038f3dc..1aeae970f069b 100644 --- a/src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts +++ b/src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts @@ -83,7 +83,7 @@ export class MockChatSessionsService implements IChatSessionsService { getIconForSessionType(chatSessionType: string): ThemeIcon | URI | undefined { const contribution = this.contributions.find(c => c.type === chatSessionType); - return contribution?.icon ? ThemeIcon.fromId(contribution.icon) : undefined; + return contribution?.icon && typeof contribution.icon === 'string' ? ThemeIcon.fromId(contribution.icon) : undefined; } getWelcomeTitleForSessionType(chatSessionType: string): string | undefined {