5
5
6
6
import { CancellationToken } from '../../../base/common/cancellation.js' ;
7
7
import { Disposable , DisposableMap } from '../../../base/common/lifecycle.js' ;
8
+ import { URI , UriComponents } from '../../../base/common/uri.js' ;
8
9
import { ILogService } from '../../../platform/log/common/log.js' ;
9
10
import { IChatSessionContent , IChatSessionsProvider , IChatSessionsService } from '../../contrib/chat/common/chatSessionsService.js' ;
10
11
import { extHostNamedCustomer , IExtHostContext } from '../../services/extensions/common/extHostCustomers.js' ;
@@ -35,7 +36,12 @@ export class MainThreadChatSessions extends Disposable implements MainThreadChat
35
36
36
37
try {
37
38
// Get all results as an array from the RPC call
38
- return await proxy . $provideChatSessions ( handle , token ) ;
39
+ const sessions = await proxy . $provideChatSessions ( handle , token ) ;
40
+ return sessions . map ( session => ( {
41
+ ...session ,
42
+ uri : URI . revive ( session . uri ) ,
43
+ iconPath : session . iconPath ? this . _reviveIconPath ( session . iconPath ) : undefined
44
+ } ) ) ;
39
45
} catch ( error ) {
40
46
this . _logService . error ( 'Error providing chat sessions:' , error ) ;
41
47
}
@@ -45,4 +51,27 @@ export class MainThreadChatSessions extends Disposable implements MainThreadChat
45
51
$unregisterChatSessionsProvider ( handle : number ) : void {
46
52
this . _registrations . deleteAndDispose ( handle ) ;
47
53
}
54
+
55
+
56
+ private _reviveIconPath (
57
+ iconPath : UriComponents | { light : UriComponents ; dark : UriComponents } | { id : string ; color ?: { id : string } | undefined } )
58
+ : IChatSessionContent [ 'iconPath' ] {
59
+ if ( ! iconPath ) {
60
+ return undefined ;
61
+ }
62
+
63
+ // Handle ThemeIcon (has id property)
64
+ if ( typeof iconPath === 'object' && 'id' in iconPath ) {
65
+ return iconPath ; // ThemeIcon doesn't need conversion
66
+ }
67
+
68
+ // Handle light/dark theme icons
69
+ if ( typeof iconPath === 'object' && ( 'light' in iconPath && 'dark' in iconPath ) ) {
70
+ return {
71
+ light : URI . revive ( iconPath . light ) ,
72
+ dark : URI . revive ( iconPath . dark )
73
+ } ;
74
+ }
75
+ return undefined ;
76
+ }
48
77
}
0 commit comments