Skip to content

Commit b296d37

Browse files
authored
Merge pull request microsoft#256616 from microsoft/osortega/fix-import
Fix import
2 parents b74e4ab + c7c2253 commit b296d37

File tree

4 files changed

+43
-7
lines changed

4 files changed

+43
-7
lines changed

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

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { CancellationToken } from '../../../base/common/cancellation.js';
77
import { Disposable, DisposableMap } from '../../../base/common/lifecycle.js';
8+
import { URI, UriComponents } from '../../../base/common/uri.js';
89
import { ILogService } from '../../../platform/log/common/log.js';
910
import { IChatSessionContent, IChatSessionsProvider, IChatSessionsService } from '../../contrib/chat/common/chatSessionsService.js';
1011
import { extHostNamedCustomer, IExtHostContext } from '../../services/extensions/common/extHostCustomers.js';
@@ -35,7 +36,12 @@ export class MainThreadChatSessions extends Disposable implements MainThreadChat
3536

3637
try {
3738
// 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+
}));
3945
} catch (error) {
4046
this._logService.error('Error providing chat sessions:', error);
4147
}
@@ -45,4 +51,27 @@ export class MainThreadChatSessions extends Disposable implements MainThreadChat
4551
$unregisterChatSessionsProvider(handle: number): void {
4652
this._registrations.deleteAndDispose(handle);
4753
}
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+
}
4877
}

src/vs/workbench/api/common/extHost.protocol.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { ChatSessionContent } from 'vscode';
76
import { VSBuffer } from '../../../base/common/buffer.js';
87
import { CancellationToken } from '../../../base/common/cancellation.js';
98
import { IRemoteConsoleLog } from '../../../base/common/console.js';
@@ -59,6 +58,7 @@ import { ICodeMapperRequest, ICodeMapperResult } from '../../contrib/chat/common
5958
import { IChatRelatedFile, IChatRelatedFileProviderMetadata as IChatRelatedFilesProviderMetadata, IChatRequestDraft } from '../../contrib/chat/common/chatEditingService.js';
6059
import { IChatProgressHistoryResponseContent } from '../../contrib/chat/common/chatModel.js';
6160
import { IChatContentInlineReference, IChatFollowup, IChatNotebookEdit, IChatProgress, IChatTask, IChatTaskDto, IChatUserActionEvent, IChatVoteAction } from '../../contrib/chat/common/chatService.js';
61+
import { IChatSessionContent } from '../../contrib/chat/common/chatSessionsService.js';
6262
import { IChatRequestVariableValue } from '../../contrib/chat/common/chatVariables.js';
6363
import { ChatAgentLocation } from '../../contrib/chat/common/constants.js';
6464
import { IChatMessage, IChatResponseFragment, ILanguageModelChatMetadata, ILanguageModelChatSelector, ILanguageModelsChangeEvent } from '../../contrib/chat/common/languageModels.js';
@@ -3107,7 +3107,7 @@ export interface MainThreadChatSessionsShape extends IDisposable {
31073107
}
31083108

31093109
export interface ExtHostChatSessionsShape {
3110-
$provideChatSessions(handle: number, token: CancellationToken): Promise<ChatSessionContent[]>;
3110+
$provideChatSessions(handle: number, token: CancellationToken): Promise<IChatSessionContent[]>;
31113111
}
31123112

31133113
// --- proxy identifiers

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ import { CancellationToken } from '../../../../base/common/cancellation.js';
88
import { ILogService } from '../../../../platform/log/common/log.js';
99
import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
1010
import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js';
11-
import { IconPath } from '../../../../editor/common/languages.js';
12-
import { UriComponents } from '../../../../base/common/uri.js';
11+
import { URI } from '../../../../base/common/uri.js';
12+
import { ThemeIcon } from '../../../../base/common/themables.js';
1313

1414
export interface IChatSessionContent {
15-
uri: UriComponents;
15+
uri: URI;
1616
label: string;
17-
iconPath?: IconPath;
17+
iconPath?: URI | {
18+
light: URI;
19+
dark: URI;
20+
} | ThemeIcon;
1821
}
1922

2023
export interface IChatSessionsProvider {

src/vscode-dts/vscode.proposed.chatSessionsProvider.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ declare module 'vscode' {
88
* Provides a list of chat sessions
99
*/
1010
export interface ChatSessionsProvider extends Disposable {
11+
/**
12+
* Type to identify providers.
13+
*/
14+
readonly chatSessionType: string;
1115

1216
/**
1317
* Fired when chat sessions change.

0 commit comments

Comments
 (0)