Skip to content

Commit 03925aa

Browse files
authored
Merge pull request microsoft#257881 from microsoft/osortega/support-icon-data-uri
Support data URI for chat sessions
2 parents 01b30db + ce8cea9 commit 03925aa

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,11 @@ export class MainThreadChatSessions extends Disposable implements MainThreadChat
257257
return iconPath; // ThemeIcon doesn't need conversion
258258
}
259259

260+
// handle single URI
261+
if (typeof iconPath === 'object' && 'scheme' in iconPath) {
262+
return URI.revive(iconPath);
263+
}
264+
260265
// Handle light/dark theme icons
261266
if (typeof iconPath === 'object' && ('light' in iconPath && 'dark' in iconPath)) {
262267
return {

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,10 +611,16 @@ class SessionsRenderer extends Disposable implements ITreeRenderer<IChatSessionI
611611
// Handle different icon types
612612
let iconResource: URI | undefined;
613613
let iconTheme: ThemeIcon | undefined;
614+
let iconUri: URI | undefined;
614615

615616
if (session.iconPath) {
616617
if (session.iconPath instanceof URI) {
617-
iconResource = session.iconPath;
618+
// Check if it's a data URI - if so, use it as icon option instead of resource
619+
if (session.iconPath.scheme === 'data') {
620+
iconUri = session.iconPath;
621+
} else {
622+
iconResource = session.iconPath;
623+
}
618624
} else if (ThemeIcon.isThemeIcon(session.iconPath)) {
619625
iconTheme = session.iconPath;
620626
} else {
@@ -634,7 +640,7 @@ class SessionsRenderer extends Disposable implements ITreeRenderer<IChatSessionI
634640
resource: iconResource
635641
}, {
636642
fileKind: undefined,
637-
icon: iconTheme
643+
icon: iconTheme || iconUri
638644
});
639645
}
640646

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@
1515
.composite.viewlet[id="workbench.view.chat.sessions"] .pane-header.expanded.not-collapsible {
1616
background-color: var(--vscode-sideBarSectionHeader-background) !important;
1717
}
18+
19+
/* Add padding to chat session item icons */
20+
.chat-sessions-tree .chat-session-item .monaco-icon-label-iconpath {
21+
margin-right: 4px;
22+
margin-left: 4px;
23+
}

0 commit comments

Comments
 (0)