Skip to content

Commit 99eca05

Browse files
committed
Change chat session icons (#263446)
1 parent 4f01daf commit 99eca05

File tree

6 files changed

+32
-54
lines changed

6 files changed

+32
-54
lines changed

src/vs/workbench/api/browser/mainThreadChatSessions.ts

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { IMarkdownString, MarkdownString } from '../../../base/common/htmlConten
1010
import { Disposable, DisposableMap, DisposableStore, IDisposable } from '../../../base/common/lifecycle.js';
1111
import { revive } from '../../../base/common/marshalling.js';
1212
import { IObservable, observableValue, autorun } from '../../../base/common/observable.js';
13-
import { URI, UriComponents } from '../../../base/common/uri.js';
1413
import { localize } from '../../../nls.js';
1514
import { IDialogService } from '../../../platform/dialogs/common/dialogs.js';
1615
import { ILogService } from '../../../platform/log/common/log.js';
@@ -346,7 +345,7 @@ export class MainThreadChatSessions extends Disposable implements MainThreadChat
346345
return sessions.map(session => ({
347346
...session,
348347
id: session.id,
349-
iconPath: session.iconPath ? this._reviveIconPath(session.iconPath) : undefined,
348+
iconPath: session.iconPath,
350349
tooltip: session.tooltip ? this._reviveTooltip(session.tooltip) : undefined
351350
}));
352351
} catch (error) {
@@ -364,7 +363,7 @@ export class MainThreadChatSessions extends Disposable implements MainThreadChat
364363
return {
365364
...chatSessionItem,
366365
id: chatSessionItem.id,
367-
iconPath: chatSessionItem.iconPath ? this._reviveIconPath(chatSessionItem.iconPath) : undefined,
366+
iconPath: chatSessionItem.iconPath,
368367
tooltip: chatSessionItem.tooltip ? this._reviveTooltip(chatSessionItem.tooltip) : undefined,
369368
};
370369
} catch (error) {
@@ -472,33 +471,6 @@ export class MainThreadChatSessions extends Disposable implements MainThreadChat
472471
super.dispose();
473472
}
474473

475-
private _reviveIconPath(
476-
iconPath: UriComponents | { light: UriComponents; dark: UriComponents } | { id: string; color?: { id: string } | undefined })
477-
: IChatSessionItem['iconPath'] {
478-
if (!iconPath) {
479-
return undefined;
480-
}
481-
482-
// Handle ThemeIcon (has id property)
483-
if (typeof iconPath === 'object' && 'id' in iconPath) {
484-
return iconPath; // ThemeIcon doesn't need conversion
485-
}
486-
487-
// handle single URI
488-
if (typeof iconPath === 'object' && 'scheme' in iconPath) {
489-
return URI.revive(iconPath);
490-
}
491-
492-
// Handle light/dark theme icons
493-
if (typeof iconPath === 'object' && ('light' in iconPath && 'dark' in iconPath)) {
494-
return {
495-
light: URI.revive(iconPath.light),
496-
dark: URI.revive(iconPath.dark)
497-
};
498-
}
499-
return undefined;
500-
}
501-
502474
private _reviveTooltip(tooltip: string | IMarkdownString | undefined): string | MarkdownString | undefined {
503475
if (!tooltip) {
504476
return undefined;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ export class ExtHostChatSessions extends Disposable implements ExtHostChatSessio
148148
return {
149149
id: sessionContent.id,
150150
label: sessionContent.label,
151-
iconPath: sessionContent.iconPath,
152151
description: sessionContent.description,
153152
status: this.convertChatSessionStatus(sessionContent.status),
154153
tooltip: typeConvert.MarkdownString.fromStrict(sessionContent.tooltip),

src/vs/workbench/contrib/chat/browser/chatSessions.contribution.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ
262262
override: ChatEditorInput.EditorID,
263263
pinned: true,
264264
chatSessionType: type, // This will 'lock' the UI of the new, unattached editor to our chat session type
265+
ignoreInView: true,
265266
};
266267
await editorService.openEditor({
267268
resource: ChatEditorInput.getNewEditorUri(),

src/vs/workbench/contrib/chat/browser/chatSessions.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,20 @@ class SessionsRenderer extends Disposable implements ITreeRenderer<IChatSessionI
972972
};
973973
}
974974

975+
statusToIcon(status?: ChatSessionStatus) {
976+
switch (status) {
977+
case ChatSessionStatus.InProgress:
978+
return Codicon.loading;
979+
case ChatSessionStatus.Completed:
980+
return Codicon.pass;
981+
case ChatSessionStatus.Failed:
982+
return Codicon.error;
983+
default:
984+
return Codicon.circleOutline;
985+
}
986+
987+
}
988+
975989
renderElement(element: ITreeNode<IChatSessionItem, FuzzyScore>, index: number, templateData: ISessionTemplateData): void {
976990
const session = element.element;
977991
const sessionWithProvider = session as ChatSessionItemWithProvider;
@@ -1017,24 +1031,12 @@ class SessionsRenderer extends Disposable implements ITreeRenderer<IChatSessionI
10171031
// Handle different icon types
10181032
let iconResource: URI | undefined;
10191033
let iconTheme: ThemeIcon | undefined;
1020-
let iconUri: URI | undefined;
1021-
1022-
if (session.iconPath) {
1023-
if (session.iconPath instanceof URI) {
1024-
// Check if it's a data URI - if so, use it as icon option instead of resource
1025-
if (session.iconPath.scheme === 'data') {
1026-
iconUri = session.iconPath;
1027-
} else {
1028-
iconResource = session.iconPath;
1029-
}
1030-
} else if (ThemeIcon.isThemeIcon(session.iconPath)) {
1031-
iconTheme = session.iconPath;
1032-
} else {
1033-
// Handle {light, dark} structure
1034-
iconResource = session.iconPath.light;
1035-
}
1034+
if (!session.iconPath && session.id !== 'show-history') {
1035+
iconTheme = this.statusToIcon(session.status);
1036+
} else {
1037+
iconTheme = session.iconPath;
10361038
}
1037-
// Apply color styling if specified
1039+
10381040
if (iconTheme?.color?.id) {
10391041
this.applyIconColorStyle(iconTheme.id, iconTheme.color.id);
10401042
}
@@ -1046,7 +1048,7 @@ class SessionsRenderer extends Disposable implements ITreeRenderer<IChatSessionI
10461048
resource: iconResource
10471049
}, {
10481050
fileKind: undefined,
1049-
icon: iconTheme || iconUri,
1051+
icon: iconTheme,
10501052
title: 'tooltip' in session && session.tooltip ?
10511053
(typeof session.tooltip === 'string' ? session.tooltip :
10521054
isMarkdownString(session.tooltip) ? {

src/vs/workbench/contrib/chat/browser/media/chatSessions.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@
9696
overflow: hidden;
9797
}
9898

99+
.chat-sessions-tree-container .chat-session-item .monaco-icon-label::before {
100+
text-align: center;
101+
}
102+
103+
.chat-sessions-tree-container .chat-session-item .monaco-icon-label.codicon-loading::before {
104+
animation: codicon-spin 1.5s steps(30) infinite;
105+
}
106+
99107
/* Timestamp styling - similar to timeline pane */
100108
.chat-sessions-tree-container .chat-session-item .timestamp-container {
101109
margin-left: auto;

src/vs/workbench/contrib/chat/common/chatSessionsService.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { CancellationToken } from '../../../../base/common/cancellation.js';
88
import { Event } from '../../../../base/common/event.js';
99
import { IObservable } from '../../../../base/common/observable.js';
1010
import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
11-
import { URI } from '../../../../base/common/uri.js';
1211
import { ThemeIcon } from '../../../../base/common/themables.js';
1312
import { IChatProgress } from './chatService.js';
1413
import { IChatAgentRequest } from './chatAgents.js';
@@ -34,10 +33,7 @@ export interface IChatSessionsExtensionPoint {
3433
export interface IChatSessionItem {
3534
id: string;
3635
label: string;
37-
iconPath?: URI | {
38-
light: URI;
39-
dark: URI;
40-
} | ThemeIcon;
36+
iconPath?: ThemeIcon;
4137
description?: string | IMarkdownString;
4238
status?: ChatSessionStatus;
4339
tooltip?: string | IMarkdownString;

0 commit comments

Comments
 (0)