diff --git a/extensions/vscode-api-tests/package.json b/extensions/vscode-api-tests/package.json index fb79a5a2c53..63a3e7bf194 100644 --- a/extensions/vscode-api-tests/package.json +++ b/extensions/vscode-api-tests/package.json @@ -45,7 +45,8 @@ "treeViewReveal", "workspaceTrust", "telemetry", - "windowActivity" + "windowActivity", + "interactiveUserActions" ], "private": true, "activationEvents": [], diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 26b89254bc6..a690fa7d58e 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -1286,6 +1286,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I return extHostChat.sendInteractiveRequestToProvider(providerId, message); }, get onDidPerformUserAction() { + checkProposedApiEnabled(extension, 'interactiveUserActions'); return extHostChat.onDidPerformUserAction; } }; diff --git a/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts b/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts index 0facecce253..8e56592a04c 100644 --- a/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts +++ b/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts @@ -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', diff --git a/src/vscode-dts/vscode.proposed.interactive.d.ts b/src/vscode-dts/vscode.proposed.interactive.d.ts index 7d29f7eead5..c09be287b81 100644 --- a/src/vscode-dts/vscode.proposed.interactive.d.ts +++ b/src/vscode-dts/vscode.proposed.interactive.d.ts @@ -153,65 +153,6 @@ declare module 'vscode' { provideResponseWithProgress(request: InteractiveRequest, progress: Progress, token: CancellationToken): ProviderResult; } - 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; } } diff --git a/src/vscode-dts/vscode.proposed.interactiveUserActions.d.ts b/src/vscode-dts/vscode.proposed.interactiveUserActions.d.ts new file mode 100644 index 00000000000..2e6bfe31f99 --- /dev/null +++ b/src/vscode-dts/vscode.proposed.interactiveUserActions.d.ts @@ -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; + } +}