mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
Introduce chat.experimental.defaultMode to decide default chat experience (#188429)
This commit is contained in:
committed by
GitHub
parent
28e972e496
commit
696f9682f3
+12
-2
@@ -3,11 +3,13 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Codicon } from 'vs/base/common/codicons';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import { Lazy } from 'vs/base/common/lazy';
|
||||
import { localize } from 'vs/nls';
|
||||
import { Action2 } from 'vs/platform/actions/common/actions';
|
||||
import { Action2, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { CHAT_CATEGORY } from 'vs/workbench/contrib/chat/browser/actions/chatActions';
|
||||
@@ -25,6 +27,7 @@ export interface IQuickQuestionMode {
|
||||
run(accessor: ServicesAccessor, query: string): void;
|
||||
}
|
||||
|
||||
// TODO: This should be registered per chat-provider probably.
|
||||
export class AskQuickQuestionAction extends Action2 {
|
||||
|
||||
private static readonly modeRegistry: Map<QuickQuestionMode, Lazy<IQuickQuestionMode>> = new Map();
|
||||
@@ -35,8 +38,9 @@ export class AskQuickQuestionAction extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: ASK_QUICK_QUESTION_ACTION_ID,
|
||||
title: { value: localize('askQuickQuestion', "Ask Quick Question"), original: 'Ask Quick Question' },
|
||||
title: { value: localize('chat', "Chat"), original: 'Chat' },
|
||||
precondition: CONTEXT_PROVIDER_EXISTS,
|
||||
icon: Codicon.commentDiscussion,
|
||||
f1: false,
|
||||
category: CHAT_CATEGORY,
|
||||
keybinding: {
|
||||
@@ -46,6 +50,12 @@ export class AskQuickQuestionAction extends Action2 {
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyCode.KeyI
|
||||
}
|
||||
},
|
||||
menu: {
|
||||
id: MenuId.LayoutControlMenu,
|
||||
group: '0_workbench_toggles',
|
||||
when: ContextKeyExpr.equals('config.chat.experimental.defaultMode', 'quickQuestion'),
|
||||
order: 0
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,13 @@ configurationRegistry.registerConfiguration({
|
||||
description: nls.localize('interactiveSession.editor.lineHeight', "Controls the line height in pixels in chat codeblocks. Use 0 to compute the line height from the font size."),
|
||||
default: 0
|
||||
},
|
||||
'chat.experimental.defaultMode': {
|
||||
type: 'string',
|
||||
tags: ['experimental'],
|
||||
enum: ['chatView', 'quickQuestion'],
|
||||
description: nls.localize('interactiveSession.defaultMode', "Controls the default mode of the chat experience."),
|
||||
default: 'chatView'
|
||||
},
|
||||
'chat.experimental.quickQuestion.mode': {
|
||||
type: 'string',
|
||||
tags: ['experimental'],
|
||||
|
||||
@@ -125,7 +125,10 @@ export class ChatContributionService implements IChatContributionService {
|
||||
canToggleVisibility: false,
|
||||
canMoveView: true,
|
||||
ctorDescriptor: new SyncDescriptor(ChatViewPane, [<IChatViewOptions>{ providerId: providerDescriptor.id }]),
|
||||
when: ContextKeyExpr.deserialize(providerDescriptor.when),
|
||||
when: ContextKeyExpr.and(
|
||||
ContextKeyExpr.deserialize(providerDescriptor.when),
|
||||
ContextKeyExpr.equals('config.chat.experimental.defaultMode', 'chatView')
|
||||
)
|
||||
}];
|
||||
Registry.as<IViewsRegistry>(ViewExtensions.ViewsRegistry).registerViews(viewDescriptor, viewContainer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user