Adopt buttonConfigProvider for terminal chat actions

Fixes microsoft/vscode-copilot#4288
This commit is contained in:
Daniel Imms
2024-03-18 16:18:59 -07:00
parent 85421b6a3b
commit 7084cf9ff1
2 changed files with 13 additions and 3 deletions
@@ -164,7 +164,6 @@ registerActiveXtermAction({
primary: KeyMod.CtrlCmd | KeyCode.Enter,
},
menu: {
// TODO: Allow action to be made primary, the action list is hardcoded within InlineChatWidget
id: MENU_TERMINAL_CHAT_WIDGET_STATUS,
group: '0_main',
order: 0,
@@ -13,7 +13,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IChatProgress } from 'vs/workbench/contrib/chat/common/chatService';
import { InlineChatWidget } from 'vs/workbench/contrib/inlineChat/browser/inlineChatWidget';
import { ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal';
import { MENU_TERMINAL_CHAT_INPUT, MENU_TERMINAL_CHAT_WIDGET, MENU_TERMINAL_CHAT_WIDGET_FEEDBACK, MENU_TERMINAL_CHAT_WIDGET_STATUS, TerminalChatContextKeys } from 'vs/workbench/contrib/terminalContrib/chat/browser/terminalChat';
import { MENU_TERMINAL_CHAT_INPUT, MENU_TERMINAL_CHAT_WIDGET, MENU_TERMINAL_CHAT_WIDGET_FEEDBACK, MENU_TERMINAL_CHAT_WIDGET_STATUS, TerminalChatCommandId, TerminalChatContextKeys } from 'vs/workbench/contrib/terminalContrib/chat/browser/terminalChat';
const enum Constants {
HorizontalMargin = 10
@@ -51,7 +51,18 @@ export class TerminalChatWidget extends Disposable {
{
inputMenuId: MENU_TERMINAL_CHAT_INPUT,
widgetMenuId: MENU_TERMINAL_CHAT_WIDGET,
statusMenuId: MENU_TERMINAL_CHAT_WIDGET_STATUS,
statusMenuId: {
menu: MENU_TERMINAL_CHAT_WIDGET_STATUS,
options: {
buttonConfigProvider: action => {
if (action.id === TerminalChatCommandId.ViewInChat || action.id === TerminalChatCommandId.RunCommand) {
return { isSecondary: false };
} else {
return { isSecondary: true };
}
}
}
},
feedbackMenuId: MENU_TERMINAL_CHAT_WIDGET_FEEDBACK,
telemetrySource: 'terminal-inline-chat'
}