@codingame/monaco-vscode-chat-service-override 4.5.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chat.js +6 -6
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClear.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +32 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +52 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +35 -72
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +83 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +23 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +3 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/{chatContributionServiceImpl.js → chatParticipantContributions.js} +43 -139
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +33 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +48 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +76 -122
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +131 -0
- package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +7 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChat.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +1 -4
package/chat.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
2
|
-
import './vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js';
|
|
3
2
|
import { IChatWidgetService, IQuickChatService, IChatAccessibilityService, IChatCodeBlockContextProviderService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
4
3
|
import { ChatAccessibilityService } from './vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js';
|
|
5
|
-
import { ChatContributionService } from './vscode/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.js';
|
|
6
4
|
import { QuickChatService } from './vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js';
|
|
7
5
|
import { ChatVariablesService } from './vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js';
|
|
8
6
|
import { ChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatWidget';
|
|
9
7
|
import { ChatCodeBlockContextProviderService } from './vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.js';
|
|
10
8
|
import { ChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
11
9
|
import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
12
|
-
import { IChatContributionService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContributionService.service';
|
|
13
10
|
import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
14
11
|
import { ChatService } from './vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js';
|
|
15
12
|
import { ChatSlashCommandService } from './vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js';
|
|
@@ -17,20 +14,22 @@ import { IChatSlashCommandService } from 'vscode/vscode/vs/workbench/contrib/cha
|
|
|
17
14
|
import { IChatVariablesService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatVariables.service';
|
|
18
15
|
import { ChatWidgetHistoryService } from './vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js';
|
|
19
16
|
import { IChatWidgetHistoryService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatWidgetHistoryService.service';
|
|
17
|
+
import { ILanguageModelStatsService } from 'vscode/vscode/vs/workbench/contrib/chat/common/languageModelStats.service';
|
|
20
18
|
import { LanguageModelsService } from './vscode/src/vs/workbench/contrib/chat/common/languageModels.js';
|
|
21
19
|
import { ILanguageModelsService } from 'vscode/vscode/vs/workbench/contrib/chat/common/languageModels.service';
|
|
22
|
-
import './vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js';
|
|
23
20
|
import { IInlineChatSavingService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSavingService.service';
|
|
24
21
|
import { InlineChatSavingServiceImpl } from './vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js';
|
|
25
22
|
import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.service';
|
|
26
23
|
import { InlineChatSessionServiceImpl } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl';
|
|
27
24
|
import { IInlineChatService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat.service';
|
|
28
25
|
import { InlineChatServiceImpl } from './vscode/src/vs/workbench/contrib/inlineChat/common/inlineChatServiceImpl.js';
|
|
26
|
+
import { LanguageModelStatsService } from './vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js';
|
|
27
|
+
import './vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js';
|
|
28
|
+
import './vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js';
|
|
29
29
|
|
|
30
30
|
function getServiceOverride() {
|
|
31
31
|
return {
|
|
32
32
|
[( IChatService.toString())]: new SyncDescriptor(ChatService, [], true),
|
|
33
|
-
[( IChatContributionService.toString())]: new SyncDescriptor(ChatContributionService, [], true),
|
|
34
33
|
[( IChatWidgetService.toString())]: new SyncDescriptor(ChatWidgetService, [], true),
|
|
35
34
|
[( IQuickChatService.toString())]: new SyncDescriptor(QuickChatService, [], true),
|
|
36
35
|
[( IChatAccessibilityService.toString())]: new SyncDescriptor(ChatAccessibilityService, [], true),
|
|
@@ -42,7 +41,8 @@ function getServiceOverride() {
|
|
|
42
41
|
[( IInlineChatService.toString())]: new SyncDescriptor(InlineChatServiceImpl, [], true),
|
|
43
42
|
[( IInlineChatSessionService.toString())]: new SyncDescriptor(InlineChatSessionServiceImpl, [], true),
|
|
44
43
|
[( IInlineChatSavingService.toString())]: new SyncDescriptor(InlineChatSavingServiceImpl, [], true),
|
|
45
|
-
[( IChatCodeBlockContextProviderService.toString())]: new SyncDescriptor(ChatCodeBlockContextProviderService, [], true)
|
|
44
|
+
[( IChatCodeBlockContextProviderService.toString())]: new SyncDescriptor(ChatCodeBlockContextProviderService, [], true),
|
|
45
|
+
[( ILanguageModelStatsService.toString())]: new SyncDescriptor(LanguageModelStatsService, [], true)
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-chat-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@5.0.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -6,10 +6,10 @@ async function clearChatEditor(accessor) {
|
|
|
6
6
|
const editorService = accessor.get(IEditorService);
|
|
7
7
|
const editorGroupsService = accessor.get(IEditorGroupsService);
|
|
8
8
|
const chatEditorInput = editorService.activeEditor;
|
|
9
|
-
if (chatEditorInput instanceof ChatEditorInput
|
|
9
|
+
if (chatEditorInput instanceof ChatEditorInput) {
|
|
10
10
|
await editorService.replaceEditors([{
|
|
11
11
|
editor: chatEditorInput,
|
|
12
|
-
replacement: { resource: ChatEditorInput.getNewEditorUri(), options: {
|
|
12
|
+
replacement: { resource: ChatEditorInput.getNewEditorUri(), options: { pinned: true } }
|
|
13
13
|
}], editorGroupsService.activeGroup);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
2
2
|
import { localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
-
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
4
3
|
import { AccessibilitySignal } from 'vscode/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService';
|
|
5
4
|
import { IAccessibilitySignalService } from 'vscode/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService.service';
|
|
5
|
+
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
6
6
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
7
|
-
import { ViewAction } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
8
7
|
import { ActiveEditorContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
9
|
-
import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
8
|
+
import { CHAT_CATEGORY, isChatViewTitleActionContext } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
10
9
|
import { clearChatEditor } from './chatClear.js';
|
|
10
|
+
import { CHAT_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
11
11
|
import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
12
12
|
import { ChatEditorInput } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
|
|
13
|
-
import {
|
|
13
|
+
import { CONTEXT_CHAT_ENABLED, CONTEXT_IN_CHAT_SESSION } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
14
14
|
|
|
15
15
|
const _moduleId = "vs/workbench/contrib/chat/browser/actions/chatClearActions";
|
|
16
16
|
const ACTION_ID_NEW_CHAT = `workbench.action.chat.newChat`;
|
|
@@ -22,7 +22,7 @@ function registerNewChatActions() {
|
|
|
22
22
|
title: ( localize2WithPath(_moduleId, 0, "New Chat")),
|
|
23
23
|
icon: Codicon.plus,
|
|
24
24
|
f1: false,
|
|
25
|
-
precondition:
|
|
25
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
26
26
|
menu: [{
|
|
27
27
|
id: MenuId.EditorTitle,
|
|
28
28
|
group: 'navigation',
|
|
@@ -43,7 +43,7 @@ function registerNewChatActions() {
|
|
|
43
43
|
title: ( localize2WithPath(_moduleId, 0, "New Chat")),
|
|
44
44
|
category: CHAT_CATEGORY,
|
|
45
45
|
icon: Codicon.plus,
|
|
46
|
-
precondition:
|
|
46
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
47
47
|
f1: true,
|
|
48
48
|
keybinding: {
|
|
49
49
|
weight: 200 ,
|
|
@@ -53,53 +53,40 @@ function registerNewChatActions() {
|
|
|
53
53
|
},
|
|
54
54
|
when: CONTEXT_IN_CHAT_SESSION
|
|
55
55
|
},
|
|
56
|
-
menu: {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
menu: [{
|
|
57
|
+
id: MenuId.ChatContext,
|
|
58
|
+
group: 'z_clear'
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: MenuId.ViewTitle,
|
|
62
|
+
when: ( (ContextKeyExpr.equals('view', CHAT_VIEW_ID))),
|
|
63
|
+
group: 'navigation',
|
|
64
|
+
order: -1
|
|
65
|
+
}]
|
|
60
66
|
});
|
|
61
67
|
}
|
|
62
68
|
run(accessor, ...args) {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
const context = args[0];
|
|
70
|
+
if (isChatViewTitleActionContext(context)) {
|
|
71
|
+
announceChatCleared(accessor);
|
|
72
|
+
context.chatView.clear();
|
|
73
|
+
context.chatView.widget.focusInput();
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const widgetService = accessor.get(IChatWidgetService);
|
|
77
|
+
const widget = widgetService.lastFocusedWidget;
|
|
78
|
+
if (!widget) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
announceChatCleared(accessor);
|
|
82
|
+
widget.clear();
|
|
83
|
+
widget.focusInput();
|
|
67
84
|
}
|
|
68
|
-
announceChatCleared(accessor);
|
|
69
|
-
widget.clear();
|
|
70
|
-
widget.focusInput();
|
|
71
85
|
}
|
|
72
86
|
});
|
|
73
87
|
}
|
|
74
|
-
const getNewChatActionDescriptorForViewTitle = (viewId, providerId) => ({
|
|
75
|
-
viewId,
|
|
76
|
-
id: `workbench.action.chat.${providerId}.newChat`,
|
|
77
|
-
title: ( localize2WithPath(_moduleId, 0, "New Chat")),
|
|
78
|
-
menu: {
|
|
79
|
-
id: MenuId.ViewTitle,
|
|
80
|
-
when: ( (ContextKeyExpr.equals('view', viewId))),
|
|
81
|
-
group: 'navigation',
|
|
82
|
-
order: -1
|
|
83
|
-
},
|
|
84
|
-
precondition: CONTEXT_PROVIDER_EXISTS,
|
|
85
|
-
category: CHAT_CATEGORY,
|
|
86
|
-
icon: Codicon.plus,
|
|
87
|
-
f1: false
|
|
88
|
-
});
|
|
89
|
-
function getNewChatAction(viewId, providerId) {
|
|
90
|
-
return class NewChatAction extends ViewAction {
|
|
91
|
-
constructor() {
|
|
92
|
-
super(getNewChatActionDescriptorForViewTitle(viewId, providerId));
|
|
93
|
-
}
|
|
94
|
-
async runInView(accessor, view) {
|
|
95
|
-
announceChatCleared(accessor);
|
|
96
|
-
await view.clear();
|
|
97
|
-
view.widget.focusInput();
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
88
|
function announceChatCleared(accessor) {
|
|
102
89
|
accessor.get(IAccessibilitySignalService).playSignal(AccessibilitySignal.clear);
|
|
103
90
|
}
|
|
104
91
|
|
|
105
|
-
export { ACTION_ID_NEW_CHAT,
|
|
92
|
+
export { ACTION_ID_NEW_CHAT, registerNewChatActions };
|
|
@@ -12,11 +12,13 @@ import { localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
|
12
12
|
import { Action2, registerAction2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
13
13
|
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService.service';
|
|
14
14
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
15
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
15
16
|
import { TerminalLocation } from 'vscode/vscode/vs/platform/terminal/common/terminal';
|
|
16
17
|
import { accessibleViewInCodeBlock } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
|
|
17
18
|
import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
18
19
|
import { IChatWidgetService, IChatCodeBlockContextProviderService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
19
|
-
import {
|
|
20
|
+
import { DefaultChatTextEditor } from 'vscode/vscode/vs/workbench/contrib/chat/browser/codeBlockPart';
|
|
21
|
+
import { CONTEXT_CHAT_ENABLED, CONTEXT_IN_CHAT_SESSION, CONTEXT_IN_CHAT_INPUT, CONTEXT_CHAT_EDIT_APPLIED } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
20
22
|
import { ChatCopyKind } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService';
|
|
21
23
|
import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
22
24
|
import { isResponseVM } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatViewModel';
|
|
@@ -30,6 +32,9 @@ const _moduleId = "vs/workbench/contrib/chat/browser/actions/chatCodeblockAction
|
|
|
30
32
|
function isCodeBlockActionContext(thing) {
|
|
31
33
|
return typeof thing === 'object' && thing !== null && 'code' in thing && 'element' in thing;
|
|
32
34
|
}
|
|
35
|
+
function isCodeCompareBlockActionContext(thing) {
|
|
36
|
+
return typeof thing === 'object' && thing !== null && 'element' in thing;
|
|
37
|
+
}
|
|
33
38
|
function isResponseFiltered(context) {
|
|
34
39
|
return isResponseVM(context.element) && context.element.errorDetails?.responseIsFiltered;
|
|
35
40
|
}
|
|
@@ -78,7 +83,6 @@ function registerChatCodeBlockActions() {
|
|
|
78
83
|
if (isResponseVM(context.element)) {
|
|
79
84
|
const chatService = accessor.get(IChatService);
|
|
80
85
|
chatService.notifyUserAction({
|
|
81
|
-
providerId: context.element.providerId,
|
|
82
86
|
agentId: context.element.agent?.id,
|
|
83
87
|
sessionId: context.element.sessionId,
|
|
84
88
|
requestId: context.element.requestId,
|
|
@@ -117,7 +121,6 @@ function registerChatCodeBlockActions() {
|
|
|
117
121
|
const element = context.element;
|
|
118
122
|
if (element) {
|
|
119
123
|
chatService.notifyUserAction({
|
|
120
|
-
providerId: element.providerId,
|
|
121
124
|
agentId: element.agent?.id,
|
|
122
125
|
sessionId: element.sessionId,
|
|
123
126
|
requestId: element.requestId,
|
|
@@ -143,7 +146,7 @@ function registerChatCodeBlockActions() {
|
|
|
143
146
|
super({
|
|
144
147
|
id: 'workbench.action.chat.insertCodeBlock',
|
|
145
148
|
title: ( localize2WithPath(_moduleId, 1, "Insert at Cursor")),
|
|
146
|
-
precondition:
|
|
149
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
147
150
|
f1: true,
|
|
148
151
|
category: CHAT_CATEGORY,
|
|
149
152
|
icon: Codicon.insert,
|
|
@@ -258,7 +261,6 @@ function registerChatCodeBlockActions() {
|
|
|
258
261
|
if (isResponseVM(context.element)) {
|
|
259
262
|
const chatService = accessor.get(IChatService);
|
|
260
263
|
chatService.notifyUserAction({
|
|
261
|
-
providerId: context.element.providerId,
|
|
262
264
|
agentId: context.element.agent?.id,
|
|
263
265
|
sessionId: context.element.sessionId,
|
|
264
266
|
requestId: context.element.requestId,
|
|
@@ -277,7 +279,7 @@ function registerChatCodeBlockActions() {
|
|
|
277
279
|
super({
|
|
278
280
|
id: 'workbench.action.chat.insertIntoNewFile',
|
|
279
281
|
title: ( localize2WithPath(_moduleId, 2, "Insert into New File")),
|
|
280
|
-
precondition:
|
|
282
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
281
283
|
f1: true,
|
|
282
284
|
category: CHAT_CATEGORY,
|
|
283
285
|
icon: Codicon.newFile,
|
|
@@ -297,7 +299,6 @@ function registerChatCodeBlockActions() {
|
|
|
297
299
|
editorService.openEditor({ contents: context.code, languageId: context.languageId, resource: undefined });
|
|
298
300
|
if (isResponseVM(context.element)) {
|
|
299
301
|
chatService.notifyUserAction({
|
|
300
|
-
providerId: context.element.providerId,
|
|
301
302
|
agentId: context.element.agent?.id,
|
|
302
303
|
sessionId: context.element.sessionId,
|
|
303
304
|
requestId: context.element.requestId,
|
|
@@ -326,7 +327,7 @@ function registerChatCodeBlockActions() {
|
|
|
326
327
|
super({
|
|
327
328
|
id: 'workbench.action.chat.runInTerminal',
|
|
328
329
|
title: ( localize2WithPath(_moduleId, 3, "Insert into Terminal")),
|
|
329
|
-
precondition:
|
|
330
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
330
331
|
f1: true,
|
|
331
332
|
category: CHAT_CATEGORY,
|
|
332
333
|
icon: Codicon.terminal,
|
|
@@ -382,7 +383,6 @@ function registerChatCodeBlockActions() {
|
|
|
382
383
|
terminal.runCommand(context.code, false);
|
|
383
384
|
if (isResponseVM(context.element)) {
|
|
384
385
|
chatService.notifyUserAction({
|
|
385
|
-
providerId: context.element.providerId,
|
|
386
386
|
agentId: context.element.agent?.id,
|
|
387
387
|
sessionId: context.element.sessionId,
|
|
388
388
|
requestId: context.element.requestId,
|
|
@@ -432,7 +432,7 @@ function registerChatCodeBlockActions() {
|
|
|
432
432
|
weight: 200 ,
|
|
433
433
|
when: CONTEXT_IN_CHAT_SESSION,
|
|
434
434
|
},
|
|
435
|
-
precondition:
|
|
435
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
436
436
|
f1: true,
|
|
437
437
|
category: CHAT_CATEGORY,
|
|
438
438
|
});
|
|
@@ -452,7 +452,7 @@ function registerChatCodeBlockActions() {
|
|
|
452
452
|
weight: 200 ,
|
|
453
453
|
when: CONTEXT_IN_CHAT_SESSION,
|
|
454
454
|
},
|
|
455
|
-
precondition:
|
|
455
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
456
456
|
f1: true,
|
|
457
457
|
category: CHAT_CATEGORY,
|
|
458
458
|
});
|
|
@@ -487,5 +487,45 @@ function getContextFromEditor(editor, accessor) {
|
|
|
487
487
|
languageId: editor.getModel().getLanguageId(),
|
|
488
488
|
};
|
|
489
489
|
}
|
|
490
|
+
function registerChatCodeCompareBlockActions() {
|
|
491
|
+
class ChatCompareCodeBlockAction extends Action2 {
|
|
492
|
+
run(accessor, ...args) {
|
|
493
|
+
const context = args[0];
|
|
494
|
+
if (!isCodeCompareBlockActionContext(context)) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
return this.runWithContext(accessor, context);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
registerAction2(class ApplyEditsCompareBlockAction extends ChatCompareCodeBlockAction {
|
|
501
|
+
constructor() {
|
|
502
|
+
super({
|
|
503
|
+
id: 'workbench.action.chat.applyCompareEdits',
|
|
504
|
+
title: ( localize2WithPath(_moduleId, 6, "Apply Edits")),
|
|
505
|
+
f1: false,
|
|
506
|
+
category: CHAT_CATEGORY,
|
|
507
|
+
icon: Codicon.check,
|
|
508
|
+
precondition: ( (ContextKeyExpr.and(
|
|
509
|
+
EditorContextKeys.hasChanges,
|
|
510
|
+
(CONTEXT_CHAT_EDIT_APPLIED.negate())
|
|
511
|
+
))),
|
|
512
|
+
menu: {
|
|
513
|
+
id: MenuId.ChatCompareBlock,
|
|
514
|
+
group: 'navigation'
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
async runWithContext(accessor, context) {
|
|
519
|
+
const editorService = accessor.get(IEditorService);
|
|
520
|
+
const instaService = accessor.get(IInstantiationService);
|
|
521
|
+
const editor = instaService.createInstance(DefaultChatTextEditor);
|
|
522
|
+
await editor.apply(context.element, context.edit);
|
|
523
|
+
await editorService.openEditor({
|
|
524
|
+
resource: context.edit.uri,
|
|
525
|
+
options: { revealIfVisible: true },
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
}
|
|
490
530
|
|
|
491
|
-
export { isCodeBlockActionContext, registerChatCodeBlockActions };
|
|
531
|
+
export { isCodeBlockActionContext, isCodeCompareBlockActionContext, registerChatCodeBlockActions, registerChatCodeCompareBlockActions };
|
|
@@ -2,7 +2,7 @@ import { localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
|
2
2
|
import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
3
|
import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
4
4
|
import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
5
|
-
import { CONTEXT_IN_CHAT_SESSION,
|
|
5
|
+
import { CONTEXT_IN_CHAT_SESSION, CONTEXT_CHAT_ENABLED } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
6
6
|
import { isResponseVM } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatViewModel';
|
|
7
7
|
|
|
8
8
|
const _moduleId = "vs/workbench/contrib/chat/browser/actions/chatFileTreeActions";
|
|
@@ -17,7 +17,7 @@ function registerChatFileTreeActions() {
|
|
|
17
17
|
weight: 200 ,
|
|
18
18
|
when: CONTEXT_IN_CHAT_SESSION,
|
|
19
19
|
},
|
|
20
|
-
precondition:
|
|
20
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
21
21
|
f1: true,
|
|
22
22
|
category: CHAT_CATEGORY,
|
|
23
23
|
});
|
|
@@ -36,7 +36,7 @@ function registerChatFileTreeActions() {
|
|
|
36
36
|
weight: 200 ,
|
|
37
37
|
when: CONTEXT_IN_CHAT_SESSION,
|
|
38
38
|
},
|
|
39
|
-
precondition:
|
|
39
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
40
40
|
f1: true,
|
|
41
41
|
category: CHAT_CATEGORY,
|
|
42
42
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
2
2
|
import { joinPath } from 'vscode/vscode/vs/base/common/resources';
|
|
3
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
+
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
4
4
|
import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
5
5
|
import { IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
6
6
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
7
7
|
import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
8
8
|
import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
9
9
|
import { ChatEditorInput } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
|
|
10
|
-
import {
|
|
10
|
+
import { CONTEXT_CHAT_ENABLED } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
11
11
|
import { isExportableSessionData } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatModel';
|
|
12
12
|
import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
13
13
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
@@ -21,11 +21,8 @@ function registerChatExportActions() {
|
|
|
21
21
|
super({
|
|
22
22
|
id: 'workbench.action.chat.export',
|
|
23
23
|
category: CHAT_CATEGORY,
|
|
24
|
-
title:
|
|
25
|
-
|
|
26
|
-
original: 'Export Session...'
|
|
27
|
-
},
|
|
28
|
-
precondition: CONTEXT_PROVIDER_EXISTS,
|
|
24
|
+
title: ( localize2WithPath(_moduleId, 1, "Export Chat...")),
|
|
25
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
29
26
|
f1: true,
|
|
30
27
|
});
|
|
31
28
|
}
|
|
@@ -58,12 +55,9 @@ function registerChatExportActions() {
|
|
|
58
55
|
constructor() {
|
|
59
56
|
super({
|
|
60
57
|
id: 'workbench.action.chat.import',
|
|
61
|
-
title:
|
|
62
|
-
value: ( localizeWithPath(_moduleId, 2, "Import Session")) + '...',
|
|
63
|
-
original: 'Import Session...'
|
|
64
|
-
},
|
|
58
|
+
title: ( localize2WithPath(_moduleId, 2, "Import Chat...")),
|
|
65
59
|
category: CHAT_CATEGORY,
|
|
66
|
-
precondition:
|
|
60
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
67
61
|
f1: true,
|
|
68
62
|
});
|
|
69
63
|
}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
2
|
+
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
3
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
4
|
-
import { ViewAction } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
5
4
|
import { ActiveEditorContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { CHAT_CATEGORY, isChatViewTitleActionContext } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
6
|
+
import { CHAT_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
8
7
|
import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
9
8
|
import { ChatEditorInput } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
|
|
10
|
-
import {
|
|
11
|
-
import { IChatContributionService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContributionService.service';
|
|
12
|
-
import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
9
|
+
import { CONTEXT_CHAT_ENABLED } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
13
10
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
14
11
|
import { AUX_WINDOW_GROUP, ACTIVE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
15
12
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
13
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
16
14
|
|
|
17
15
|
const _moduleId = "vs/workbench/contrib/chat/browser/actions/chatMoveActions";
|
|
18
16
|
var MoveToNewLocation;
|
|
@@ -20,82 +18,54 @@ var MoveToNewLocation;
|
|
|
20
18
|
MoveToNewLocation["Editor"] = "Editor";
|
|
21
19
|
MoveToNewLocation["Window"] = "Window";
|
|
22
20
|
})(MoveToNewLocation || (MoveToNewLocation = {}))));
|
|
23
|
-
const getMoveToChatActionDescriptorForViewTitle = (viewId, providerId, moveTo) => ({
|
|
24
|
-
id: `workbench.action.chat.${providerId}.openIn${moveTo}`,
|
|
25
|
-
title: {
|
|
26
|
-
value: moveTo === MoveToNewLocation.Editor ? ( localizeWithPath(_moduleId, 0, "Open Chat in Editor")) : ( localizeWithPath(_moduleId, 1, "Open Chat in New Window")),
|
|
27
|
-
original: moveTo === MoveToNewLocation.Editor ? 'Open Chat in Editor' : 'Open Chat in New Window',
|
|
28
|
-
},
|
|
29
|
-
category: CHAT_CATEGORY,
|
|
30
|
-
precondition: CONTEXT_PROVIDER_EXISTS,
|
|
31
|
-
f1: false,
|
|
32
|
-
viewId,
|
|
33
|
-
menu: {
|
|
34
|
-
id: MenuId.ViewTitle,
|
|
35
|
-
when: ( (ContextKeyExpr.equals('view', viewId))),
|
|
36
|
-
order: 0
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
function getMoveToEditorAction(viewId, providerId) {
|
|
40
|
-
return getMoveToAction(viewId, providerId, MoveToNewLocation.Editor);
|
|
41
|
-
}
|
|
42
|
-
function getMoveToNewWindowAction(viewId, providerId) {
|
|
43
|
-
return getMoveToAction(viewId, providerId, MoveToNewLocation.Window);
|
|
44
|
-
}
|
|
45
|
-
function getMoveToAction(viewId, providerId, moveTo) {
|
|
46
|
-
return class MoveToAction extends ViewAction {
|
|
47
|
-
constructor() {
|
|
48
|
-
super(getMoveToChatActionDescriptorForViewTitle(viewId, providerId, moveTo));
|
|
49
|
-
}
|
|
50
|
-
async runInView(accessor, view) {
|
|
51
|
-
const viewModel = view.widget.viewModel;
|
|
52
|
-
if (!viewModel) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const editorService = accessor.get(IEditorService);
|
|
56
|
-
const sessionId = viewModel.sessionId;
|
|
57
|
-
const viewState = view.widget.getViewState();
|
|
58
|
-
view.clear();
|
|
59
|
-
await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { target: { sessionId }, pinned: true, viewState: viewState } }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
21
|
function registerMoveActions() {
|
|
64
22
|
registerAction2(class GlobalMoveToEditorAction extends Action2 {
|
|
65
23
|
constructor() {
|
|
66
24
|
super({
|
|
67
25
|
id: `workbench.action.chat.openInEditor`,
|
|
68
|
-
title: ( localize2WithPath(_moduleId,
|
|
26
|
+
title: ( localize2WithPath(_moduleId, 0, "Open Chat in Editor")),
|
|
69
27
|
category: CHAT_CATEGORY,
|
|
70
|
-
precondition:
|
|
71
|
-
f1: true
|
|
28
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
29
|
+
f1: true,
|
|
30
|
+
menu: {
|
|
31
|
+
id: MenuId.ViewTitle,
|
|
32
|
+
when: ( (ContextKeyExpr.equals('view', CHAT_VIEW_ID))),
|
|
33
|
+
order: 0
|
|
34
|
+
},
|
|
72
35
|
});
|
|
73
36
|
}
|
|
74
37
|
async run(accessor, ...args) {
|
|
75
|
-
|
|
38
|
+
const context = args[0];
|
|
39
|
+
executeMoveToAction(accessor, MoveToNewLocation.Editor, isChatViewTitleActionContext(context) ? context.chatView : undefined);
|
|
76
40
|
}
|
|
77
41
|
});
|
|
78
42
|
registerAction2(class GlobalMoveToNewWindowAction extends Action2 {
|
|
79
43
|
constructor() {
|
|
80
44
|
super({
|
|
81
45
|
id: `workbench.action.chat.openInNewWindow`,
|
|
82
|
-
title: ( localize2WithPath(_moduleId,
|
|
46
|
+
title: ( localize2WithPath(_moduleId, 1, "Open Chat in New Window")),
|
|
83
47
|
category: CHAT_CATEGORY,
|
|
84
|
-
precondition:
|
|
85
|
-
f1: true
|
|
48
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
49
|
+
f1: true,
|
|
50
|
+
menu: {
|
|
51
|
+
id: MenuId.ViewTitle,
|
|
52
|
+
when: ( (ContextKeyExpr.equals('view', CHAT_VIEW_ID))),
|
|
53
|
+
order: 0
|
|
54
|
+
},
|
|
86
55
|
});
|
|
87
56
|
}
|
|
88
57
|
async run(accessor, ...args) {
|
|
89
|
-
|
|
58
|
+
const context = args[0];
|
|
59
|
+
executeMoveToAction(accessor, MoveToNewLocation.Window, isChatViewTitleActionContext(context) ? context.chatView : undefined);
|
|
90
60
|
}
|
|
91
61
|
});
|
|
92
62
|
registerAction2(class GlobalMoveToSidebarAction extends Action2 {
|
|
93
63
|
constructor() {
|
|
94
64
|
super({
|
|
95
65
|
id: `workbench.action.chat.openInSidebar`,
|
|
96
|
-
title: ( localize2WithPath(_moduleId,
|
|
66
|
+
title: ( localize2WithPath(_moduleId, 2, "Open Chat in Side Bar")),
|
|
97
67
|
category: CHAT_CATEGORY,
|
|
98
|
-
precondition:
|
|
68
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
99
69
|
f1: true,
|
|
100
70
|
menu: [{
|
|
101
71
|
id: MenuId.EditorTitle,
|
|
@@ -109,15 +79,13 @@ function registerMoveActions() {
|
|
|
109
79
|
}
|
|
110
80
|
});
|
|
111
81
|
}
|
|
112
|
-
async function executeMoveToAction(accessor, moveTo) {
|
|
82
|
+
async function executeMoveToAction(accessor, moveTo, chatView) {
|
|
113
83
|
const widgetService = accessor.get(IChatWidgetService);
|
|
114
84
|
const viewService = accessor.get(IViewsService);
|
|
115
|
-
const chatService = accessor.get(IChatService);
|
|
116
85
|
const editorService = accessor.get(IEditorService);
|
|
117
|
-
const widget = widgetService.lastFocusedWidget;
|
|
86
|
+
const widget = chatView?.widget ?? widgetService.lastFocusedWidget;
|
|
118
87
|
if (!widget || !('viewId' in widget.viewContext)) {
|
|
119
|
-
|
|
120
|
-
await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { target: { providerId }, pinned: true } }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP);
|
|
88
|
+
await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { pinned: true } }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP);
|
|
121
89
|
return;
|
|
122
90
|
}
|
|
123
91
|
const viewModel = widget.viewModel;
|
|
@@ -133,21 +101,16 @@ async function executeMoveToAction(accessor, moveTo) {
|
|
|
133
101
|
async function moveToSidebar(accessor) {
|
|
134
102
|
const viewsService = accessor.get(IViewsService);
|
|
135
103
|
const editorService = accessor.get(IEditorService);
|
|
136
|
-
const chatContribService = accessor.get(IChatContributionService);
|
|
137
104
|
const editorGroupService = accessor.get(IEditorGroupsService);
|
|
138
105
|
const chatEditorInput = editorService.activeEditor;
|
|
139
|
-
if (chatEditorInput instanceof ChatEditorInput && chatEditorInput.sessionId
|
|
106
|
+
if (chatEditorInput instanceof ChatEditorInput && chatEditorInput.sessionId) {
|
|
140
107
|
await editorService.closeEditor({ editor: chatEditorInput, groupId: editorGroupService.activeGroup.id });
|
|
141
|
-
const
|
|
142
|
-
const view = await viewsService.openView(viewId);
|
|
108
|
+
const view = await viewsService.openView(CHAT_VIEW_ID);
|
|
143
109
|
view.loadSession(chatEditorInput.sessionId);
|
|
144
110
|
}
|
|
145
111
|
else {
|
|
146
|
-
|
|
147
|
-
const providerId = chatService.getProviderInfos()[0].id;
|
|
148
|
-
const viewId = chatContribService.getViewIdForProvider(providerId);
|
|
149
|
-
await viewsService.openView(viewId);
|
|
112
|
+
await viewsService.openView(CHAT_VIEW_ID);
|
|
150
113
|
}
|
|
151
114
|
}
|
|
152
115
|
|
|
153
|
-
export {
|
|
116
|
+
export { registerMoveActions };
|