Make 'enter' a no-op while chat loads instead of sending it to the editor (#237453)

Fix microsoft/vscode-copilot#10718
pull/164479/merge
Rob Lourens 2025-01-07 19:05:34 -08:00 committed by GitHub
parent ade73d22b7
commit cee4706830
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -52,7 +52,7 @@ export class ChatSubmitAction extends SubmitAction {
f1: false,
category: CHAT_CATEGORY,
icon: Codicon.send,
precondition: ContextKeyExpr.and(ChatContextKeys.inputHasText, ChatContextKeys.requestInProgress.negate(), ChatContextKeys.location.notEqualsTo(ChatAgentLocation.EditingSession)),
precondition: ContextKeyExpr.and(ChatContextKeys.inputHasText, ChatContextKeys.location.notEqualsTo(ChatAgentLocation.EditingSession)),
keybinding: {
when: ChatContextKeys.inChatInput,
primary: KeyCode.Enter,
@ -131,7 +131,7 @@ export class ChatEditingSessionSubmitAction extends SubmitAction {
f1: false,
category: CHAT_CATEGORY,
icon: Codicon.send,
precondition: ContextKeyExpr.and(ChatContextKeys.inputHasText, ChatContextKeys.requestInProgress.negate(), ChatContextKeys.location.isEqualTo(ChatAgentLocation.EditingSession), applyingChatEditsContextKey.toNegated()),
precondition: ContextKeyExpr.and(ChatContextKeys.inputHasText, ChatContextKeys.location.isEqualTo(ChatAgentLocation.EditingSession), applyingChatEditsContextKey.toNegated()),
keybinding: {
when: ChatContextKeys.inChatInput,
primary: KeyCode.Enter,

View File

@ -985,6 +985,10 @@ export class ChatWidget extends Disposable implements IChatWidget {
}
private async _acceptInput(query: { query: string } | { prefix: string } | undefined, options?: IChatAcceptInputOptions): Promise<IChatResponseModel | undefined> {
if (this.viewModel?.requestInProgress) {
return;
}
if (this.viewModel) {
this._onDidAcceptInput.fire();
if (!this.viewOptions.autoScroll) {