From a09a079aabfd25d3c261c8934429104a86bd0173 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Oct 2023 18:29:02 +0200 Subject: [PATCH] Allow to disable progressive edits per progress chunk (#196424) --- src/vs/workbench/api/common/extHostInlineChat.ts | 1 + .../contrib/inlineChat/browser/inlineChatController.ts | 5 ++++- src/vs/workbench/contrib/inlineChat/common/inlineChat.ts | 1 + src/vscode-dts/vscode.proposed.interactive.d.ts | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/api/common/extHostInlineChat.ts b/src/vs/workbench/api/common/extHostInlineChat.ts index 5612bac33fd2a..6e96c04a73f1f 100644 --- a/src/vs/workbench/api/common/extHostInlineChat.ts +++ b/src/vs/workbench/api/common/extHostInlineChat.ts @@ -165,6 +165,7 @@ export class ExtHostInteractiveEditor implements ExtHostInlineChatShape { await this._proxy.$handleProgressChunk(request.requestId, { message: value.message, edits: value.edits?.map(typeConvert.TextEdit.from), + editsShouldBeInstant: value.editsShouldBeInstant, slashCommand: value.slashCommand?.command, markdownFragment: extHostTypes.MarkdownString.isMarkdownString(value.content) ? value.content.value : value.content }); diff --git a/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts b/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts index 755d572394a0a..96151e916c0bd 100644 --- a/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts +++ b/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts @@ -582,7 +582,10 @@ export class InlineChatController implements IEditorContribution { // making changes goes into a queue because otherwise the async-progress time will // influence the time it takes to receive the changes and progressive typing will // become infinitely fast - await this._makeChanges(data.edits!, { duration: progressiveEditsAvgDuration.value, round: round++, token: requestCts.token }); + await this._makeChanges(data.edits!, data.editsShouldBeInstant + ? undefined + : { duration: progressiveEditsAvgDuration.value, round: round++, token: requestCts.token } + ); this._showWidget(false); }); } diff --git a/src/vs/workbench/contrib/inlineChat/common/inlineChat.ts b/src/vs/workbench/contrib/inlineChat/common/inlineChat.ts index 73ed2a1334025..70f2171b83c75 100644 --- a/src/vs/workbench/contrib/inlineChat/common/inlineChat.ts +++ b/src/vs/workbench/contrib/inlineChat/common/inlineChat.ts @@ -87,6 +87,7 @@ export interface IInlineChatMessageResponse { export interface IInlineChatProgressItem { markdownFragment?: string; edits?: TextEdit[]; + editsShouldBeInstant?: boolean; message?: string; slashCommand?: string; } diff --git a/src/vscode-dts/vscode.proposed.interactive.d.ts b/src/vscode-dts/vscode.proposed.interactive.d.ts index 4e7ae1d99de2c..8f4259b230c12 100644 --- a/src/vscode-dts/vscode.proposed.interactive.d.ts +++ b/src/vscode-dts/vscode.proposed.interactive.d.ts @@ -52,6 +52,7 @@ declare module 'vscode' { export interface InteractiveEditorProgressItem { message?: string; edits?: TextEdit[]; + editsShouldBeInstant?: boolean; slashCommand?: InteractiveEditorSlashCommand; content?: string | MarkdownString; }