Add new API proposal for chat onDidPerformUserAction event (#183140)

* Add new API proposal for chat onDidPerformUserAction event

* Enable API for tests that incidentally touch the getter
This commit is contained in:
Rob Lourens 2023-05-22 11:52:19 -07:00 committed by GitHub
parent d867c0a0f4
commit 05c0ca95ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 74 additions and 62 deletions

View file

@ -45,7 +45,8 @@
"treeViewReveal",
"workspaceTrust",
"telemetry",
"windowActivity"
"windowActivity",
"interactiveUserActions"
],
"private": true,
"activationEvents": [],

View file

@ -1286,6 +1286,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostChat.sendInteractiveRequestToProvider(providerId, message);
},
get onDidPerformUserAction() {
checkProposedApiEnabled(extension, 'interactiveUserActions');
return extHostChat.onDidPerformUserAction;
}
};

View file

@ -50,6 +50,7 @@ export const allApiProposals = Object.freeze({
inlineCompletionsAdditions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts',
interactive: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactive.d.ts',
interactiveSlashCommands: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactiveSlashCommands.d.ts',
interactiveUserActions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactiveUserActions.d.ts',
interactiveWindow: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactiveWindow.d.ts',
ipc: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.ipc.d.ts',
notebookCellExecutionState: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookCellExecutionState.d.ts',

View file

@ -153,65 +153,6 @@ declare module 'vscode' {
provideResponseWithProgress(request: InteractiveRequest, progress: Progress<InteractiveProgress>, token: CancellationToken): ProviderResult<InteractiveResponseForProgress>;
}
export enum InteractiveSessionVoteDirection {
Up = 1,
Down = 2
}
export interface InteractiveSessionVoteAction {
// eslint-disable-next-line local/vscode-dts-string-type-literals
kind: 'vote';
responseId: string;
direction: InteractiveSessionVoteDirection;
}
export enum InteractiveSessionCopyKind {
// Keyboard shortcut or context menu
Action = 1,
Toolbar = 2
}
export interface InteractiveSessionCopyAction {
// eslint-disable-next-line local/vscode-dts-string-type-literals
kind: 'copy';
responseId: string;
codeBlockIndex: number;
copyType: InteractiveSessionCopyKind;
copiedCharacters: number;
totalCharacters: number;
copiedText: string;
}
export interface InteractiveSessionInsertAction {
// eslint-disable-next-line local/vscode-dts-string-type-literals
kind: 'insert';
responseId: string;
codeBlockIndex: number;
totalCharacters: number;
newFile?: boolean;
}
export interface InteractiveSessionTerminalAction {
// eslint-disable-next-line local/vscode-dts-string-type-literals
kind: 'runInTerminal';
responseId: string;
codeBlockIndex: number;
languageId?: string;
}
export interface InteractiveSessionCommandAction {
// eslint-disable-next-line local/vscode-dts-string-type-literals
kind: 'command';
command: InteractiveResponseCommand;
}
export type InteractiveSessionUserAction = InteractiveSessionVoteAction | InteractiveSessionCopyAction | InteractiveSessionInsertAction | InteractiveSessionTerminalAction | InteractiveSessionCommandAction;
export interface InteractiveSessionUserActionEvent {
action: InteractiveSessionUserAction;
providerId: string;
}
export interface InteractiveSessionDynamicRequest {
/**
* The message that will be displayed in the UI
@ -235,7 +176,5 @@ declare module 'vscode' {
export function sendInteractiveRequestToProvider(providerId: string, message: InteractiveSessionDynamicRequest): void;
export function registerInteractiveEditorSessionProvider(provider: InteractiveEditorSessionProvider): Disposable;
export const onDidPerformUserAction: Event<InteractiveSessionUserActionEvent>;
}
}

View file

@ -0,0 +1,70 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'vscode' {
export enum InteractiveSessionVoteDirection {
Up = 1,
Down = 2
}
export interface InteractiveSessionVoteAction {
// eslint-disable-next-line local/vscode-dts-string-type-literals
kind: 'vote';
responseId: string;
direction: InteractiveSessionVoteDirection;
}
export enum InteractiveSessionCopyKind {
// Keyboard shortcut or context menu
Action = 1,
Toolbar = 2
}
export interface InteractiveSessionCopyAction {
// eslint-disable-next-line local/vscode-dts-string-type-literals
kind: 'copy';
responseId: string;
codeBlockIndex: number;
copyType: InteractiveSessionCopyKind;
copiedCharacters: number;
totalCharacters: number;
copiedText: string;
}
export interface InteractiveSessionInsertAction {
// eslint-disable-next-line local/vscode-dts-string-type-literals
kind: 'insert';
responseId: string;
codeBlockIndex: number;
totalCharacters: number;
newFile?: boolean;
}
export interface InteractiveSessionTerminalAction {
// eslint-disable-next-line local/vscode-dts-string-type-literals
kind: 'runInTerminal';
responseId: string;
codeBlockIndex: number;
languageId?: string;
}
export interface InteractiveSessionCommandAction {
// eslint-disable-next-line local/vscode-dts-string-type-literals
kind: 'command';
command: InteractiveResponseCommand;
}
export type InteractiveSessionUserAction = InteractiveSessionVoteAction | InteractiveSessionCopyAction | InteractiveSessionInsertAction | InteractiveSessionTerminalAction | InteractiveSessionCommandAction;
export interface InteractiveSessionUserActionEvent {
action: InteractiveSessionUserAction;
providerId: string;
}
export namespace interactive {
export const onDidPerformUserAction: Event<InteractiveSessionUserActionEvent>;
}
}