mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-15 07:28:05 +00:00
use default chat focus input/response actions, rm terminal specific ones (#230125)
This commit is contained in:
@@ -10,8 +10,6 @@ import { RawContextKey } from '../../../../../platform/contextkey/common/context
|
||||
export const enum TerminalChatCommandId {
|
||||
Start = 'workbench.action.terminal.chat.start',
|
||||
Close = 'workbench.action.terminal.chat.close',
|
||||
FocusResponse = 'workbench.action.terminal.chat.focusResponse',
|
||||
FocusInput = 'workbench.action.terminal.chat.focusInput',
|
||||
Discard = 'workbench.action.terminal.chat.discard',
|
||||
MakeRequest = 'workbench.action.terminal.chat.makeRequest',
|
||||
Cancel = 'workbench.action.terminal.chat.cancel',
|
||||
|
||||
@@ -45,8 +45,8 @@ export function getAccessibilityHelpText(accessor: ServicesAccessor): string {
|
||||
const insertCommandKeybinding = keybindingService.lookupKeybinding(TerminalChatCommandId.InsertCommand)?.getAriaLabel();
|
||||
const makeRequestKeybinding = keybindingService.lookupKeybinding(TerminalChatCommandId.MakeRequest)?.getAriaLabel();
|
||||
const startChatKeybinding = keybindingService.lookupKeybinding(TerminalChatCommandId.Start)?.getAriaLabel();
|
||||
const focusResponseKeybinding = keybindingService.lookupKeybinding(TerminalChatCommandId.FocusResponse)?.getAriaLabel();
|
||||
const focusInputKeybinding = keybindingService.lookupKeybinding(TerminalChatCommandId.FocusInput)?.getAriaLabel();
|
||||
const focusResponseKeybinding = keybindingService.lookupKeybinding('chat.action.focus')?.getAriaLabel();
|
||||
const focusInputKeybinding = keybindingService.lookupKeybinding('workbench.action.chat.focusInput')?.getAriaLabel();
|
||||
content.push(localize('inlineChat.overview', "Inline chat occurs within a terminal. It is useful for suggesting terminal commands. Keep in mind that AI generated code may be incorrect."));
|
||||
content.push(localize('inlineChat.access', "It can be activated using the command: Terminal: Start Chat ({0}), which will focus the input box.", startChatKeybinding));
|
||||
content.push(makeRequestKeybinding ? localize('inlineChat.input', "The input box is where the user can type a request and can make the request ({0}). The widget will be closed and all content will be discarded when the Escape key is pressed and the terminal will regain focus.", makeRequestKeybinding) : localize('inlineChat.inputNoKb', "The input box is where the user can type a request and can make the request by tabbing to the Make Request button, which is not currently triggerable via keybindings. The widget will be closed and all content will be discarded when the Escape key is pressed and the terminal will regain focus."));
|
||||
|
||||
@@ -9,7 +9,7 @@ import { localize2 } from '../../../../../nls.js';
|
||||
import { ContextKeyExpr } from '../../../../../platform/contextkey/common/contextkey.js';
|
||||
import { KeybindingWeight } from '../../../../../platform/keybinding/common/keybindingsRegistry.js';
|
||||
import { AbstractInlineChatAction } from '../../../inlineChat/browser/inlineChatActions.js';
|
||||
import { CTX_INLINE_CHAT_EMPTY, CTX_INLINE_CHAT_FOCUSED } from '../../../inlineChat/common/inlineChat.js';
|
||||
import { CTX_INLINE_CHAT_EMPTY } from '../../../inlineChat/common/inlineChat.js';
|
||||
import { isDetachedTerminalInstance } from '../../../terminal/browser/terminal.js';
|
||||
import { registerActiveXtermAction } from '../../../terminal/browser/terminalActions.js';
|
||||
import { TerminalContextKeys } from '../../../terminal/common/terminalContextKey.js';
|
||||
@@ -81,52 +81,6 @@ registerActiveXtermAction({
|
||||
}
|
||||
});
|
||||
|
||||
registerActiveXtermAction({
|
||||
id: TerminalChatCommandId.FocusResponse,
|
||||
title: localize2('focusTerminalResponse', 'Focus Terminal Response'),
|
||||
keybinding: {
|
||||
primary: KeyMod.CtrlCmd | KeyCode.DownArrow,
|
||||
when: TerminalChatContextKeys.focused,
|
||||
weight: KeybindingWeight.WorkbenchContrib,
|
||||
},
|
||||
f1: true,
|
||||
category: AbstractInlineChatAction.category,
|
||||
precondition: ContextKeyExpr.and(
|
||||
TerminalChatContextKeys.focused
|
||||
),
|
||||
run: (_xterm, _accessor, activeInstance) => {
|
||||
if (isDetachedTerminalInstance(activeInstance)) {
|
||||
return;
|
||||
}
|
||||
const contr = TerminalChatController.activeChatController || TerminalChatController.get(activeInstance);
|
||||
contr?.chatWidget?.focusLastMessage();
|
||||
}
|
||||
});
|
||||
|
||||
registerActiveXtermAction({
|
||||
id: TerminalChatCommandId.FocusInput,
|
||||
title: localize2('focusTerminalInput', 'Focus Terminal Input'),
|
||||
keybinding: {
|
||||
primary: KeyMod.CtrlCmd | KeyCode.UpArrow,
|
||||
secondary: [KeyMod.CtrlCmd | KeyCode.KeyI],
|
||||
when: ContextKeyExpr.and(TerminalChatContextKeys.focused, CTX_INLINE_CHAT_FOCUSED.toNegated()),
|
||||
weight: KeybindingWeight.WorkbenchContrib,
|
||||
},
|
||||
f1: true,
|
||||
category: AbstractInlineChatAction.category,
|
||||
precondition: ContextKeyExpr.and(
|
||||
TerminalChatContextKeys.focused
|
||||
),
|
||||
run: (_xterm, _accessor, activeInstance) => {
|
||||
if (isDetachedTerminalInstance(activeInstance)) {
|
||||
return;
|
||||
}
|
||||
const contr = TerminalChatController.activeChatController || TerminalChatController.get(activeInstance);
|
||||
contr?.terminalChatWidget?.focus();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
registerActiveXtermAction({
|
||||
id: TerminalChatCommandId.Discard,
|
||||
title: localize2('discard', 'Discard'),
|
||||
|
||||
Reference in New Issue
Block a user