Skip to content

Commit 39ca06b

Browse files
Add "open mode picker" action (microsoft#253965)
* Add "open mode picker" action * poke ci --------- Co-authored-by: Josh Spicer <[email protected]>
1 parent 9d9234f commit 39ca06b

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,28 @@ class OpenModelPickerAction extends Action2 {
377377
}
378378
}
379379

380+
class OpenModePickerAction extends Action2 {
381+
static readonly ID = 'workbench.action.chat.openModePicker';
382+
383+
constructor() {
384+
super({
385+
id: OpenModePickerAction.ID,
386+
title: localize2('interactive.openModePicker.label', "Open Mode Picker"),
387+
category: CHAT_CATEGORY,
388+
f1: false,
389+
precondition: ChatContextKeys.enabled,
390+
});
391+
}
392+
393+
override async run(accessor: ServicesAccessor, ...args: any[]): Promise<void> {
394+
const widgetService = accessor.get(IChatWidgetService);
395+
const widget = widgetService.lastFocusedWidget;
396+
if (widget) {
397+
widget.input.openModePicker();
398+
}
399+
}
400+
}
401+
380402
export const ChangeChatModelActionId = 'workbench.action.chat.changeModel';
381403
class ChangeChatModelAction extends Action2 {
382404
static readonly ID = ChangeChatModelActionId;
@@ -868,6 +890,7 @@ export function registerChatExecuteActions() {
868890
registerAction2(ToggleRequestPausedAction);
869891
registerAction2(SwitchToNextModelAction);
870892
registerAction2(OpenModelPickerAction);
893+
registerAction2(OpenModePickerAction);
871894
registerAction2(ChangeChatModelAction);
872895
registerAction2(CancelEdit);
873896
}

src/vs/workbench/contrib/chat/browser/chatInputPart.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
271271
private chatModeKindKey: IContextKey<ChatModeKind>;
272272

273273
private modelWidget: ModelPickerActionItem | undefined;
274+
private modeWidget: ModePickerActionItem | undefined;
274275
private readonly _waitForPersistedLanguageModel: MutableDisposable<IDisposable>;
275276
private _onDidChangeCurrentLanguageModel: Emitter<ILanguageModelChatMetadataAndIdentifier>;
276277

@@ -540,6 +541,10 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
540541
this.modelWidget?.show();
541542
}
542543

544+
public openModePicker(): void {
545+
this.modeWidget?.show();
546+
}
547+
543548
private checkModelSupported(): void {
544549
if (this._currentLanguageModel && !this.modelSupportedForDefaultAgent(this._currentLanguageModel)) {
545550
this.setCurrentLanguageModelToDefault();
@@ -1149,7 +1154,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
11491154
const delegate: IModePickerDelegate = {
11501155
currentMode: this._currentModeObservable
11511156
};
1152-
return this.instantiationService.createInstance(ModePickerActionItem, action, delegate);
1157+
return this.modeWidget = this.instantiationService.createInstance(ModePickerActionItem, action, delegate);
11531158
}
11541159

11551160
return undefined;

0 commit comments

Comments
 (0)