Skip to content

Commit e4cdebb

Browse files
committed
update
1 parent ab413e8 commit e4cdebb

5 files changed

Lines changed: 15 additions & 20 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import { IChatMessage, IChatResponseFragment, IChatResponseProviderMetadata } fr
5555
import { IChatAgentDetection, IChatDynamicRequest, IChatFollowup, IChatReplyFollowup, IChatResponseErrorDetails, IChatUserActionEvent, InteractiveSessionVoteDirection } from 'vs/workbench/contrib/chat/common/chatService';
5656
import { IChatRequestVariableValue, IChatVariableData } from 'vs/workbench/contrib/chat/common/chatVariables';
5757
import { DebugConfigurationProviderTriggerKind, IAdapterDescriptor, IConfig, IDebugSessionReplMode } from 'vs/workbench/contrib/debug/common/debug';
58-
import { IInlineChatBulkEditResponse, IInlineChatEditResponse, IInlineChatMessageResponse, IInlineChatProgressItem, IInlineChatRequest, IInlineChatSession, InlineChatResponseFeedbackKind, InteractiveEditorReplyFollowup } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
58+
import { IInlineChatBulkEditResponse, IInlineChatEditResponse, IInlineChatMessageResponse, IInlineChatProgressItem, IInlineChatRequest, IInlineChatSession, InlineChatResponseFeedbackKind } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
5959
import * as notebookCommon from 'vs/workbench/contrib/notebook/common/notebookCommon';
6060
import { CellExecutionUpdateType } from 'vs/workbench/contrib/notebook/common/notebookExecutionService';
6161
import { ICellExecutionComplete, ICellExecutionStateUpdate } from 'vs/workbench/contrib/notebook/common/notebookExecutionStateService';
@@ -1206,7 +1206,7 @@ export type IInlineChatResponseDto = Dto<IInlineChatEditResponse | Omit<IInlineC
12061206
export interface ExtHostInlineChatShape {
12071207
$prepareSession(handle: number, uri: UriComponents, range: ISelection, token: CancellationToken): Promise<IInlineChatSession | undefined>;
12081208
$provideResponse(handle: number, session: IInlineChatSession, request: IInlineChatRequest, token: CancellationToken): Promise<IInlineChatResponseDto | undefined>;
1209-
$provideFollowups(handle: number, sessionId: number, responseId: number, token: CancellationToken): Promise<InteractiveEditorReplyFollowup[] | undefined>;
1209+
$provideFollowups(handle: number, sessionId: number, responseId: number, token: CancellationToken): Promise<IChatReplyFollowup[] | undefined>;
12101210
$handleFeedback(handle: number, sessionId: number, responseId: number, kind: InlineChatResponseFeedbackKind): void;
12111211
$releaseSession(handle: number, sessionId: number): void;
12121212
}

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
77
import { toDisposable } from 'vs/base/common/lifecycle';
88
import { URI, UriComponents } from 'vs/base/common/uri';
99
import { ISelection } from 'vs/editor/common/core/selection';
10-
import { IInlineChatSession, IInlineChatRequest, InlineChatResponseFeedbackKind, InlineChatResponseType, InteractiveEditorReplyFollowup } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
10+
import { IInlineChatSession, IInlineChatRequest, InlineChatResponseFeedbackKind, InlineChatResponseType } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
1111
import { IRelaxedExtensionDescription } from 'vs/platform/extensions/common/extensions';
1212
import { ILogService } from 'vs/platform/log/common/log';
1313
import { ExtHostInlineChatShape, IInlineChatResponseDto, IMainContext, MainContext, MainThreadInlineChatShape } from 'vs/workbench/api/common/extHost.protocol';
@@ -19,6 +19,7 @@ import { ApiCommand, ApiCommandArgument, ApiCommandResult, ExtHostCommands } fro
1919
import { IRange } from 'vs/editor/common/core/range';
2020
import { IPosition } from 'vs/editor/common/core/position';
2121
import { raceCancellation } from 'vs/base/common/async';
22+
import { IChatReplyFollowup } from 'vs/workbench/contrib/chat/common/chatService';
2223

2324
class ProviderWrapper {
2425

@@ -223,18 +224,14 @@ export class ExtHostInteractiveEditor implements ExtHostInlineChatShape {
223224
};
224225
}
225226

226-
async $provideFollowups(handle: number, sessionId: number, responseId: number, token: CancellationToken): Promise<InteractiveEditorReplyFollowup[] | undefined> {
227+
async $provideFollowups(handle: number, sessionId: number, responseId: number, token: CancellationToken): Promise<IChatReplyFollowup[] | undefined> {
227228
const entry = this._inputProvider.get(handle);
228229
const sessionData = this._inputSessions.get(sessionId);
229230
const response = sessionData?.responses[responseId];
230-
if (entry && response) {
231-
const task = Promise.resolve(entry.provider.provideFollowups?.(sessionData.session, response, token));
232-
const res = await raceCancellation(task, token);
233-
if (res) {
234-
return res.map(f => ({
235-
message: typeConvert.MarkdownString.from(f.contents),
236-
}));
237-
}
231+
if (entry && response && entry.provider.provideFollowups) {
232+
const task = Promise.resolve(entry.provider.provideFollowups(sessionData.session, response, token));
233+
const followups = await raceCancellation(task, token);
234+
return followups?.map(typeConvert.ChatReplyFollowup.from);
238235
}
239236
return undefined;
240237
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2157,7 +2157,7 @@ export namespace DataTransfer {
21572157
}
21582158

21592159
export namespace ChatReplyFollowup {
2160-
export function from(followup: vscode.InteractiveSessionReplyFollowup): IChatReplyFollowup {
2160+
export function from(followup: vscode.InteractiveSessionReplyFollowup | vscode.InteractiveEditorReplyFollowup): IChatReplyFollowup {
21612161
return {
21622162
kind: 'reply',
21632163
message: followup.message,

src/vs/workbench/contrib/inlineChat/common/inlineChat.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { IProgress } from 'vs/platform/progress/common/progress';
2020
import { Registry } from 'vs/platform/registry/common/platform';
2121
import { diffInserted, diffRemoved, editorHoverHighlight, editorWidgetBackground, editorWidgetBorder, focusBorder, inputBackground, inputPlaceholderForeground, registerColor, transparent, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
2222
import { Extensions as ExtensionsMigration, IConfigurationMigrationRegistry } from 'vs/workbench/common/configuration';
23+
import { IChatReplyFollowup } from 'vs/workbench/contrib/chat/common/chatService';
2324

2425
export interface IInlineChatSlashCommand {
2526
command: string;
@@ -48,11 +49,6 @@ export interface IInlineChatRequest {
4849

4950
export type IInlineChatResponse = IInlineChatEditResponse | IInlineChatBulkEditResponse | IInlineChatMessageResponse;
5051

51-
export interface InteractiveEditorReplyFollowup {
52-
message: IMarkdownString;
53-
}
54-
55-
5652
export const enum InlineChatResponseType {
5753
EditorEdit = 'editorEdit',
5854
BulkEdit = 'bulkEdit',
@@ -115,7 +111,7 @@ export interface IInlineChatSessionProvider {
115111

116112
provideResponse(item: IInlineChatSession, request: IInlineChatRequest, progress: IProgress<IInlineChatProgressItem>, token: CancellationToken): ProviderResult<IInlineChatResponse>;
117113

118-
provideFollowups?(session: IInlineChatSession, response: IInlineChatResponse, token: CancellationToken): ProviderResult<InteractiveEditorReplyFollowup[]>;
114+
provideFollowups?(session: IInlineChatSession, response: IInlineChatResponse, token: CancellationToken): ProviderResult<IChatReplyFollowup[]>;
119115

120116
handleInlineChatResponseFeedback?(session: IInlineChatSession, response: IInlineChatResponse, kind: InlineChatResponseFeedbackKind): void;
121117
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ declare module 'vscode' {
7575
}
7676

7777
export interface InteractiveEditorReplyFollowup {
78-
contents: MarkdownString;
78+
message: string;
79+
tooltip?: string;
80+
title?: string;
7981
}
8082

8183
export interface InteractiveEditorSessionProvider<S extends InteractiveEditorSession = InteractiveEditorSession, R extends InteractiveEditorResponse | InteractiveEditorMessageResponse = InteractiveEditorResponse | InteractiveEditorMessageResponse> {

0 commit comments

Comments
 (0)