From 335dc7d1b658a73d530fab525652b6561b50828b Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Thu, 22 Feb 2024 02:35:31 +0000 Subject: [PATCH] API adoption for chat sample (#963) --- chat-agent-sample/src/extension.ts | 1 - .../src/vscode.proposed.chatParticipant.d.ts | 25 +++++++------------ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/chat-agent-sample/src/extension.ts b/chat-agent-sample/src/extension.ts index 0eb69716..09c179d3 100644 --- a/chat-agent-sample/src/extension.ts +++ b/chat-agent-sample/src/extension.ts @@ -68,7 +68,6 @@ export function activate(context: vscode.ExtensionContext) { const agent = vscode.chat.createChatParticipant('cat', handler); agent.iconPath = vscode.Uri.joinPath(context.extensionUri, 'cat.jpeg'); agent.description = vscode.l10n.t('Meow! What can I help you with?'); - agent.fullName = vscode.l10n.t('Cat'); agent.commandProvider = { provideCommands(token) { return [ diff --git a/chat-agent-sample/src/vscode.proposed.chatParticipant.d.ts b/chat-agent-sample/src/vscode.proposed.chatParticipant.d.ts index 468f12ae..5fcc77cb 100644 --- a/chat-agent-sample/src/vscode.proposed.chatParticipant.d.ts +++ b/chat-agent-sample/src/vscode.proposed.chatParticipant.d.ts @@ -23,7 +23,7 @@ declare module 'vscode' { /** * The name of the chat participant and contributing extension to which this request was directed. */ - readonly participant: { readonly extensionId: string; readonly participant: string }; + readonly participant: { readonly extensionId: string; readonly name: string }; /** * The name of the {@link ChatCommand command} that was selected for this request. @@ -35,7 +35,7 @@ declare module 'vscode' { */ readonly variables: ChatResolvedVariable[]; - private constructor(prompt: string, command: string | undefined, variables: ChatResolvedVariable[], participant: { extensionId: string; participant: string }); + private constructor(prompt: string, command: string | undefined, variables: ChatResolvedVariable[], participant: { extensionId: string; name: string }); } /** @@ -56,14 +56,14 @@ declare module 'vscode' { /** * The name of the chat participant and contributing extension that this response came from. */ - readonly participant: { readonly extensionId: string; readonly participant: string }; + readonly participant: { readonly extensionId: string; readonly name: string }; /** * The name of the command that this response came from. */ readonly command?: string; - private constructor(response: ReadonlyArray, result: ChatResult, participant: { extensionId: string; participant: string }); + private constructor(response: ReadonlyArray, result: ChatResult, participant: { extensionId: string; name: string }); } export interface ChatContext { @@ -83,7 +83,7 @@ declare module 'vscode' { message: string; /** - * If partial markdown content was sent over the `progress` callback before the response terminated, then this flag + * If partial markdown content was sent over the {@link ChatRequestHandler handler}'s response stream before the response terminated, then this flag * can be set to true and it will be rendered with incomplete markdown features patched up. * * For example, if the response terminated after sending part of a triple-backtick code block, then the editor will @@ -183,8 +183,7 @@ declare module 'vscode' { * @returns A list of commands. The lack of a result can be signaled by returning `undefined`, `null`, or * an empty array. */ - // TODO@API Q: should we provide the current history or last results for extra context? - provideCommands(token: CancellationToken): ProviderResult; + provideCommands(context: ChatContext, token: CancellationToken): ProviderResult; } /** @@ -240,16 +239,10 @@ declare module 'vscode' { */ readonly name: string; - /** - * The full name of this participant. - * TODO@API This is only used for the default participant, but it seems useful, so should we keep it so we can use it in the future? - */ - fullName: string; - /** * A human-readable description explaining what this participant does. */ - description: string; + description?: string; /** * Icon for the participant shown in UI. @@ -281,7 +274,7 @@ declare module 'vscode' { followupProvider?: ChatFollowupProvider; /** - * When the user clicks this participant in `/help`, this text will be submitted to this command + * When the user clicks this participant in `/help`, this text will be submitted to this participant. */ sampleRequest?: string; @@ -408,7 +401,7 @@ declare module 'vscode' { * Push a progress part to this stream. Short-hand for * `push(new ChatResponseProgressPart(value))`. * - * @param value + * @param value A progress message * @returns This stream. */ progress(value: string): ChatResponseStream;