@codingame/monaco-vscode-chat-service-override 2.0.3 → 2.1.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 -2
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +20 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +14 -59
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +4 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +0 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +11 -16
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +24 -15
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +7 -8
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +106 -115
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +17 -7
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +236 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +210 -0
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditor.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDecorations.js +0 -250
|
@@ -21,7 +21,7 @@ import { CONTEXT_PROVIDER_EXISTS } from 'vscode/vscode/vs/workbench/contrib/chat
|
|
|
21
21
|
import { ChatModel, ChatWelcomeMessageModel, ChatModelInitState } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatModel';
|
|
22
22
|
import { ChatRequestAgentPart, ChatRequestAgentSubcommandPart, ChatRequestSlashCommandPart } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
23
23
|
import { ChatRequestParser } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatRequestParser';
|
|
24
|
-
import { InteractiveSessionVoteDirection,
|
|
24
|
+
import { InteractiveSessionVoteDirection, ChatAgentCopyKind } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService';
|
|
25
25
|
import { IChatSlashCommandService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatSlashCommands';
|
|
26
26
|
import { IChatVariablesService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatVariables';
|
|
27
27
|
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
@@ -105,7 +105,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
105
105
|
else if (action.action.kind === 'copy') {
|
|
106
106
|
this.telemetryService.publicLog2('interactiveSessionCopy', {
|
|
107
107
|
providerId: action.providerId,
|
|
108
|
-
copyKind: action.action.
|
|
108
|
+
copyKind: action.action.copyKind === ChatAgentCopyKind.Action ? 'action' : 'toolbar'
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
else if (action.action.kind === 'insert') {
|
|
@@ -197,6 +197,11 @@ let ChatService = class ChatService extends Disposable {
|
|
|
197
197
|
}
|
|
198
198
|
removeHistoryEntry(sessionId) {
|
|
199
199
|
delete this._persistedSessions[sessionId];
|
|
200
|
+
this.saveState();
|
|
201
|
+
}
|
|
202
|
+
clearAllHistoryEntries() {
|
|
203
|
+
this._persistedSessions = {};
|
|
204
|
+
this.saveState();
|
|
200
205
|
}
|
|
201
206
|
startSession(providerId, token) {
|
|
202
207
|
this.trace('startSession', `providerId=${providerId}`);
|
|
@@ -342,22 +347,26 @@ let ChatService = class ChatService extends Disposable {
|
|
|
342
347
|
if (!request.response) {
|
|
343
348
|
continue;
|
|
344
349
|
}
|
|
345
|
-
|
|
346
|
-
|
|
350
|
+
const historyRequest = {
|
|
351
|
+
sessionId,
|
|
352
|
+
requestId: request.id,
|
|
353
|
+
agentId: request.response.agent?.id ?? '',
|
|
354
|
+
message: request.variableData.message,
|
|
355
|
+
variables: request.variableData.variables,
|
|
356
|
+
command: request.response.slashCommand?.name
|
|
357
|
+
};
|
|
358
|
+
history.push({ request: historyRequest, response: request.response.response.value, result: { errorDetails: request.response.errorDetails } });
|
|
347
359
|
}
|
|
348
|
-
|
|
360
|
+
const variableData = await this.chatVariablesService.resolveVariables(parsedRequest, model, token);
|
|
361
|
+
request = model.addRequest(parsedRequest, variableData, agent, agentSlashCommandPart?.command);
|
|
349
362
|
const requestProps = {
|
|
350
363
|
sessionId,
|
|
351
364
|
requestId: request.id,
|
|
352
|
-
|
|
353
|
-
|
|
365
|
+
agentId: agent.id,
|
|
366
|
+
message: variableData.message,
|
|
367
|
+
variables: variableData.variables,
|
|
354
368
|
command: agentSlashCommandPart?.command.name ?? '',
|
|
355
369
|
};
|
|
356
|
-
if ('parts' in parsedRequest) {
|
|
357
|
-
const varResult = await this.chatVariablesService.resolveVariables(parsedRequest, model, token);
|
|
358
|
-
requestProps.variables = varResult.variables;
|
|
359
|
-
requestProps.message = varResult.prompt;
|
|
360
|
-
}
|
|
361
370
|
const agentResult = await this.chatAgentService.invokeAgent(agent.id, requestProps, progressCallback, history, token);
|
|
362
371
|
rawResponse = {
|
|
363
372
|
session: model.session,
|
|
@@ -368,7 +377,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
368
377
|
this.chatAgentService.getFollowups(agent.id, sessionId, CancellationToken.None);
|
|
369
378
|
}
|
|
370
379
|
else if (commandPart && this.chatSlashCommandService.hasCommand(commandPart.slashCommand.command)) {
|
|
371
|
-
request = model.addRequest(parsedRequest);
|
|
380
|
+
request = model.addRequest(parsedRequest, { message, variables: {} });
|
|
372
381
|
const history = [];
|
|
373
382
|
for (const request of model.getRequests()) {
|
|
374
383
|
if (!request.response) {
|
|
@@ -455,7 +464,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
455
464
|
getProviders() {
|
|
456
465
|
return Array.from(( this._providers.keys()));
|
|
457
466
|
}
|
|
458
|
-
async addCompleteRequest(sessionId, message, response) {
|
|
467
|
+
async addCompleteRequest(sessionId, message, variableData, response) {
|
|
459
468
|
this.trace('addCompleteRequest', `message: ${message}`);
|
|
460
469
|
const model = this._sessionModels.get(sessionId);
|
|
461
470
|
if (!model) {
|
|
@@ -465,7 +474,7 @@ let ChatService = class ChatService extends Disposable {
|
|
|
465
474
|
const parsedRequest = typeof message === 'string' ?
|
|
466
475
|
await this.instantiationService.createInstance(ChatRequestParser).parseChatRequest(sessionId, message) :
|
|
467
476
|
message;
|
|
468
|
-
const request = model.addRequest(parsedRequest);
|
|
477
|
+
const request = model.addRequest(parsedRequest, variableData || { message: parsedRequest.text, variables: {} });
|
|
469
478
|
if (typeof response.message === 'string') {
|
|
470
479
|
model.acceptResponseProgress(request, { content: response.message, kind: 'content' });
|
|
471
480
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
2
1
|
import { registerEditorContribution } from 'vscode/vscode/vs/editor/browser/editorExtensions';
|
|
2
|
+
import { registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
3
|
import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
|
4
|
-
import { InlineAccessibilityHelpContribution,
|
|
5
|
-
import { INLINE_CHAT_ID, INTERACTIVE_EDITOR_ACCESSIBILITY_HELP_ID
|
|
4
|
+
import { InlineAccessibilityHelpContribution, CloseAction, ConfigureInlineChatAction, UnstashSessionAction, MakeRequestAction, StopRequestAction, ReRunRequestAction, DiscardHunkAction, DiscardAction, DiscardToClipboardAction, DiscardUndoToNewFileAction, CancelSessionAction, ArrowOutUpAction, ArrowOutDownAction, FocusInlineChat, PreviousFromHistory, NextFromHistory, ViewInChatAction, ExpandMessageAction, ContractMessageAction, ToggleDiffForChange, FeebackHelpfulCommand, FeebackUnhelpfulCommand, ReportIssueForBugCommand, AcceptChanges, CopyRecordings } from './inlineChatActions.js';
|
|
5
|
+
import { INLINE_CHAT_ID, INTERACTIVE_EDITOR_ACCESSIBILITY_HELP_ID } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
6
6
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
7
7
|
import { InlineChatNotebookContribution } from './inlineChatNotebook.js';
|
|
8
8
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
9
9
|
import { InlineChatAccessibleViewContribution } from './inlineChatAccessibleView.js';
|
|
10
|
-
import { InlineChatDecorationsContribution } from './inlineChatDecorations.js';
|
|
11
10
|
|
|
12
11
|
registerEditorContribution(INLINE_CHAT_ID, InlineChatController, 0 );
|
|
13
12
|
registerEditorContribution(INTERACTIVE_EDITOR_ACCESSIBILITY_HELP_ID, InlineAccessibilityHelpContribution, 3 );
|
|
14
|
-
|
|
15
|
-
registerAction2(
|
|
13
|
+
registerAction2(CloseAction);
|
|
14
|
+
registerAction2(ConfigureInlineChatAction);
|
|
16
15
|
registerAction2(UnstashSessionAction);
|
|
17
16
|
registerAction2(MakeRequestAction);
|
|
18
17
|
registerAction2(StopRequestAction);
|
|
19
18
|
registerAction2(ReRunRequestAction);
|
|
19
|
+
registerAction2(DiscardHunkAction);
|
|
20
20
|
registerAction2(DiscardAction);
|
|
21
21
|
registerAction2(DiscardToClipboardAction);
|
|
22
22
|
registerAction2(DiscardUndoToNewFileAction);
|
|
@@ -29,12 +29,11 @@ registerAction2(NextFromHistory);
|
|
|
29
29
|
registerAction2(ViewInChatAction);
|
|
30
30
|
registerAction2(ExpandMessageAction);
|
|
31
31
|
registerAction2(ContractMessageAction);
|
|
32
|
-
registerAction2(ToggleInlineDiff);
|
|
33
32
|
registerAction2(ToggleDiffForChange);
|
|
34
33
|
registerAction2(FeebackHelpfulCommand);
|
|
35
34
|
registerAction2(FeebackUnhelpfulCommand);
|
|
36
35
|
registerAction2(ReportIssueForBugCommand);
|
|
37
|
-
registerAction2(
|
|
36
|
+
registerAction2(AcceptChanges);
|
|
38
37
|
registerAction2(CopyRecordings);
|
|
39
38
|
const workbenchContributionsRegistry = ( Registry.as(Extensions.Workbench));
|
|
40
39
|
workbenchContributionsRegistry.registerWorkbenchContribution(InlineChatNotebookContribution, 3 );
|
|
@@ -1,75 +1,33 @@
|
|
|
1
1
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
2
|
-
import { KeyChord } from 'vscode/vscode/vs/base/common/keyCodes';
|
|
3
2
|
import { EditorAction2 } from 'vscode/vscode/vs/editor/browser/editorExtensions';
|
|
4
3
|
import { EmbeddedCodeEditorWidget, EmbeddedDiffEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/embeddedCodeEditorWidget';
|
|
5
4
|
import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
|
|
6
|
-
import { InlineChatController
|
|
7
|
-
import { CTX_INLINE_CHAT_HAS_PROVIDER, MENU_INLINE_CHAT_WIDGET_STATUS, MENU_INLINE_CHAT_WIDGET_DISCARD, CTX_INLINE_CHAT_EDIT_MODE, CTX_INLINE_CHAT_RESPONSE_TYPES,
|
|
5
|
+
import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
|
6
|
+
import { ACTION_ACCEPT_CHANGES, CTX_INLINE_CHAT_HAS_PROVIDER, MENU_INLINE_CHAT_WIDGET_STATUS, MENU_INLINE_CHAT_WIDGET_DISCARD, CTX_INLINE_CHAT_EDIT_MODE, CTX_INLINE_CHAT_RESPONSE_TYPES, CTX_INLINE_CHAT_HAS_STASHED_SESSION, CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_EMPTY, CTX_INLINE_CHAT_FOCUSED, MENU_INLINE_CHAT_INPUT, CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST, ACTION_REGENERATE_RESPONSE, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_INNER_CURSOR_START, CTX_INLINE_CHAT_INNER_CURSOR_END, CTX_INLINE_CHAT_USER_DID_EDIT, CTX_INLINE_CHAT_DID_EDIT, CTX_INLINE_CHAT_CHANGE_HAS_DIFF, CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF, MENU_INLINE_CHAT_WIDGET_FEEDBACK, CTX_INLINE_CHAT_LAST_FEEDBACK, CTX_INLINE_CHAT_SUPPORT_ISSUE_REPORTING, MENU_INLINE_CHAT_WIDGET, CTX_INLINE_CHAT_DOCUMENT_CHANGED, ACTION_VIEW_IN_CHAT, MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE, CTX_INLINE_CHAT_MESSAGE_CROP_STATE, CTX_INLINE_CHAT_RESPONSE_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
8
7
|
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
9
|
-
import { MenuRegistry
|
|
8
|
+
import { MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
10
9
|
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService';
|
|
11
10
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
12
11
|
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
13
12
|
import { IEditorService, SIDE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
14
13
|
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
15
14
|
import { fromNow } from 'vscode/vscode/vs/base/common/date';
|
|
16
|
-
import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/
|
|
15
|
+
import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService';
|
|
17
16
|
import { runAccessibilityHelpAction } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp';
|
|
18
17
|
import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vscode/vscode/vs/platform/accessibility/common/accessibility';
|
|
19
18
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
20
19
|
import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
21
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
22
20
|
import { AccessibilityHelpAction } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibleViewActions';
|
|
23
21
|
import { registerIcon } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
|
|
22
|
+
import { IPreferencesService } from 'vscode/vscode/vs/workbench/services/preferences/common/preferences';
|
|
24
23
|
|
|
25
24
|
CommandsRegistry.registerCommandAlias('interactiveEditor.start', 'inlineChat.start');
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
'run',
|
|
29
|
-
'Start Inline Chat'
|
|
30
|
-
));
|
|
31
|
-
const START_INLINE_CHAT = registerIcon('start-inline-chat', Codicon.sparkle, ( localizeWithPath(
|
|
25
|
+
CommandsRegistry.registerCommandAlias('interactive.acceptChanges', ACTION_ACCEPT_CHANGES);
|
|
26
|
+
registerIcon('start-inline-chat', Codicon.sparkle, ( localizeWithPath(
|
|
32
27
|
'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
|
|
33
28
|
'startInlineChat',
|
|
34
29
|
'Icon which spawns the inline chat from the editor toolbar.'
|
|
35
30
|
)));
|
|
36
|
-
class StartSessionAction extends EditorAction2 {
|
|
37
|
-
constructor() {
|
|
38
|
-
super({
|
|
39
|
-
id: 'inlineChat.start',
|
|
40
|
-
title: { value: LOCALIZED_START_INLINE_CHAT_STRING, original: 'Start Inline Chat' },
|
|
41
|
-
category: AbstractInlineChatAction.category,
|
|
42
|
-
f1: true,
|
|
43
|
-
precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_PROVIDER, EditorContextKeys.writable)),
|
|
44
|
-
keybinding: {
|
|
45
|
-
when: EditorContextKeys.focus,
|
|
46
|
-
weight: 200 ,
|
|
47
|
-
primary: 2048 | 39 ,
|
|
48
|
-
secondary: [KeyChord(2048 | 41 , 39 )],
|
|
49
|
-
},
|
|
50
|
-
icon: START_INLINE_CHAT,
|
|
51
|
-
menu: [{
|
|
52
|
-
id: MenuId.EditorTitle,
|
|
53
|
-
when: ( ContextKeyExpr.and(
|
|
54
|
-
CTX_INLINE_CHAT_TOOLBAR_ICON_ENABLED,
|
|
55
|
-
CTX_INLINE_CHAT_HAS_PROVIDER,
|
|
56
|
-
( CTX_INLINE_CHAT_VISIBLE.toNegated()),
|
|
57
|
-
EditorContextKeys.focus
|
|
58
|
-
)),
|
|
59
|
-
group: 'navigation',
|
|
60
|
-
order: -1000000,
|
|
61
|
-
}],
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
runEditorCommand(_accessor, editor, ..._args) {
|
|
65
|
-
let options;
|
|
66
|
-
const arg = _args[0];
|
|
67
|
-
if (arg && InlineChatRunOptions.isInteractiveEditorOptions(arg)) {
|
|
68
|
-
options = arg;
|
|
69
|
-
}
|
|
70
|
-
InlineChatController.get(editor)?.run({ ...options });
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
31
|
class UnstashSessionAction extends EditorAction2 {
|
|
74
32
|
constructor() {
|
|
75
33
|
super({
|
|
@@ -87,7 +45,7 @@ class UnstashSessionAction extends EditorAction2 {
|
|
|
87
45
|
}
|
|
88
46
|
});
|
|
89
47
|
}
|
|
90
|
-
runEditorCommand(_accessor, editor, ..._args) {
|
|
48
|
+
async runEditorCommand(_accessor, editor, ..._args) {
|
|
91
49
|
const ctrl = InlineChatController.get(editor);
|
|
92
50
|
if (ctrl) {
|
|
93
51
|
const session = ctrl.unstashLastSession();
|
|
@@ -148,7 +106,7 @@ class MakeRequestAction extends AbstractInlineChatAction {
|
|
|
148
106
|
primary: 3
|
|
149
107
|
},
|
|
150
108
|
menu: {
|
|
151
|
-
id:
|
|
109
|
+
id: MENU_INLINE_CHAT_INPUT,
|
|
152
110
|
group: 'main',
|
|
153
111
|
order: 1,
|
|
154
112
|
when: ( CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST.isEqualTo(false))
|
|
@@ -174,7 +132,7 @@ class ReRunRequestAction extends AbstractInlineChatAction {
|
|
|
174
132
|
'Regenerate'
|
|
175
133
|
)),
|
|
176
134
|
icon: Codicon.refresh,
|
|
177
|
-
precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( CTX_INLINE_CHAT_EMPTY.negate()),
|
|
135
|
+
precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( CTX_INLINE_CHAT_EMPTY.negate()), ( CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo("empty" )))),
|
|
178
136
|
menu: {
|
|
179
137
|
id: MENU_INLINE_CHAT_WIDGET_STATUS,
|
|
180
138
|
group: '2_feedback',
|
|
@@ -198,7 +156,7 @@ class StopRequestAction extends AbstractInlineChatAction {
|
|
|
198
156
|
icon: Codicon.debugStop,
|
|
199
157
|
precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( CTX_INLINE_CHAT_EMPTY.negate()), CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST)),
|
|
200
158
|
menu: {
|
|
201
|
-
id:
|
|
159
|
+
id: MENU_INLINE_CHAT_INPUT,
|
|
202
160
|
group: 'main',
|
|
203
161
|
order: 1,
|
|
204
162
|
when: CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST
|
|
@@ -325,6 +283,29 @@ class NextFromHistory extends AbstractInlineChatAction {
|
|
|
325
283
|
ctrl.populateHistory(false);
|
|
326
284
|
}
|
|
327
285
|
}
|
|
286
|
+
class DiscardHunkAction extends AbstractInlineChatAction {
|
|
287
|
+
constructor() {
|
|
288
|
+
super({
|
|
289
|
+
id: 'inlineChat.discardHunkChange',
|
|
290
|
+
title: ( localizeWithPath(
|
|
291
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
|
|
292
|
+
'discard',
|
|
293
|
+
'Discard'
|
|
294
|
+
)),
|
|
295
|
+
icon: Codicon.clearAll,
|
|
296
|
+
precondition: CTX_INLINE_CHAT_VISIBLE,
|
|
297
|
+
menu: {
|
|
298
|
+
id: MENU_INLINE_CHAT_WIDGET_STATUS,
|
|
299
|
+
when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo("onlyMessages" )), ( CTX_INLINE_CHAT_EDIT_MODE.isEqualTo("live" )))),
|
|
300
|
+
group: '0_main',
|
|
301
|
+
order: 3
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
async runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
|
|
306
|
+
return ctrl.discardHunk();
|
|
307
|
+
}
|
|
308
|
+
}
|
|
328
309
|
MenuRegistry.appendMenuItem(MENU_INLINE_CHAT_WIDGET_STATUS, {
|
|
329
310
|
submenu: MENU_INLINE_CHAT_WIDGET_DISCARD,
|
|
330
311
|
title: ( localizeWithPath(
|
|
@@ -335,7 +316,7 @@ MenuRegistry.appendMenuItem(MENU_INLINE_CHAT_WIDGET_STATUS, {
|
|
|
335
316
|
icon: Codicon.discard,
|
|
336
317
|
group: '0_main',
|
|
337
318
|
order: 2,
|
|
338
|
-
when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo("preview" )), ( CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo("
|
|
319
|
+
when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo("preview" )), ( CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo("live" )), ( CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo("onlyMessages" )))),
|
|
339
320
|
rememberDefaultAction: true
|
|
340
321
|
});
|
|
341
322
|
class DiscardAction extends AbstractInlineChatAction {
|
|
@@ -420,7 +401,7 @@ class ToggleDiffForChange extends AbstractInlineChatAction {
|
|
|
420
401
|
constructor() {
|
|
421
402
|
super({
|
|
422
403
|
id: 'inlineChat.toggleDiff',
|
|
423
|
-
precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( CTX_INLINE_CHAT_EDIT_MODE.isEqualTo("
|
|
404
|
+
precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( CTX_INLINE_CHAT_EDIT_MODE.isEqualTo("live" )), CTX_INLINE_CHAT_CHANGE_HAS_DIFF)),
|
|
424
405
|
title: ( localize2WithPath(
|
|
425
406
|
'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
|
|
426
407
|
'showChanges',
|
|
@@ -434,7 +415,7 @@ class ToggleDiffForChange extends AbstractInlineChatAction {
|
|
|
434
415
|
{
|
|
435
416
|
id: MENU_INLINE_CHAT_WIDGET_FEEDBACK,
|
|
436
417
|
group: '1_main',
|
|
437
|
-
when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_EDIT_MODE.isEqualTo("
|
|
418
|
+
when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_EDIT_MODE.isEqualTo("live" )), CTX_INLINE_CHAT_CHANGE_HAS_DIFF))
|
|
438
419
|
}
|
|
439
420
|
]
|
|
440
421
|
});
|
|
@@ -457,7 +438,7 @@ class FeebackHelpfulCommand extends AbstractInlineChatAction {
|
|
|
457
438
|
toggled: ( CTX_INLINE_CHAT_LAST_FEEDBACK.isEqualTo('helpful')),
|
|
458
439
|
menu: {
|
|
459
440
|
id: MENU_INLINE_CHAT_WIDGET_FEEDBACK,
|
|
460
|
-
when: (
|
|
441
|
+
when: ( CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo("empty" )),
|
|
461
442
|
group: '2_feedback',
|
|
462
443
|
order: 1
|
|
463
444
|
}
|
|
@@ -481,7 +462,7 @@ class FeebackUnhelpfulCommand extends AbstractInlineChatAction {
|
|
|
481
462
|
toggled: ( CTX_INLINE_CHAT_LAST_FEEDBACK.isEqualTo('unhelpful')),
|
|
482
463
|
menu: {
|
|
483
464
|
id: MENU_INLINE_CHAT_WIDGET_FEEDBACK,
|
|
484
|
-
when: (
|
|
465
|
+
when: ( CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo("empty" )),
|
|
485
466
|
group: '2_feedback',
|
|
486
467
|
order: 2
|
|
487
468
|
}
|
|
@@ -501,62 +482,24 @@ class ReportIssueForBugCommand extends AbstractInlineChatAction {
|
|
|
501
482
|
'Report Issue'
|
|
502
483
|
)),
|
|
503
484
|
icon: Codicon.report,
|
|
504
|
-
precondition: CTX_INLINE_CHAT_VISIBLE,
|
|
505
|
-
menu: {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
485
|
+
precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo("empty" )))),
|
|
486
|
+
menu: [{
|
|
487
|
+
id: MENU_INLINE_CHAT_WIDGET_FEEDBACK,
|
|
488
|
+
when: ( ContextKeyExpr.and(CTX_INLINE_CHAT_SUPPORT_ISSUE_REPORTING, ( CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo("empty" )))),
|
|
489
|
+
group: '2_feedback',
|
|
490
|
+
order: 3
|
|
491
|
+
}, {
|
|
492
|
+
id: MENU_INLINE_CHAT_WIDGET,
|
|
493
|
+
group: 'config',
|
|
494
|
+
order: 3
|
|
495
|
+
}]
|
|
511
496
|
});
|
|
512
497
|
}
|
|
513
498
|
runInlineChatCommand(_accessor, ctrl) {
|
|
514
499
|
ctrl.feedbackLast(4 );
|
|
515
500
|
}
|
|
516
501
|
}
|
|
517
|
-
class
|
|
518
|
-
constructor() {
|
|
519
|
-
super({
|
|
520
|
-
id: 'inlineChat.toggleDiff',
|
|
521
|
-
title: {
|
|
522
|
-
original: 'Show Diff',
|
|
523
|
-
value: ( localizeWithPath(
|
|
524
|
-
'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
|
|
525
|
-
'showDiff',
|
|
526
|
-
'Show Diff'
|
|
527
|
-
)),
|
|
528
|
-
mnemonicTitle: ( localizeWithPath(
|
|
529
|
-
'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
|
|
530
|
-
{ key: 'miShowDiff', comment: ['&& denotes a mnemonic'] },
|
|
531
|
-
"&&Show Diff"
|
|
532
|
-
)),
|
|
533
|
-
},
|
|
534
|
-
toggled: {
|
|
535
|
-
condition: ( ContextKeyExpr.equals('config.inlineChat.showDiff', true)),
|
|
536
|
-
title: ( localizeWithPath(
|
|
537
|
-
'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
|
|
538
|
-
'showDiff2',
|
|
539
|
-
"Show Diff"
|
|
540
|
-
)),
|
|
541
|
-
mnemonicTitle: ( localizeWithPath(
|
|
542
|
-
'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
|
|
543
|
-
{ key: 'miShowDiff2', comment: ['&& denotes a mnemonic'] },
|
|
544
|
-
"&&Show Diff"
|
|
545
|
-
))
|
|
546
|
-
},
|
|
547
|
-
precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( CTX_INLINE_CHAT_EDIT_MODE.isEqualTo("live" )))),
|
|
548
|
-
menu: [
|
|
549
|
-
{ id: MENU_INLINE_CHAT_WIDGET_TOGGLE }
|
|
550
|
-
]
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
runInlineChatCommand(accessor, _ctrl) {
|
|
554
|
-
const configurationService = accessor.get(IConfigurationService);
|
|
555
|
-
const newValue = !configurationService.getValue('inlineChat.showDiff');
|
|
556
|
-
configurationService.updateValue('inlineChat.showDiff', newValue);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
class ApplyPreviewEdits extends AbstractInlineChatAction {
|
|
502
|
+
class AcceptChanges extends AbstractInlineChatAction {
|
|
560
503
|
constructor() {
|
|
561
504
|
super({
|
|
562
505
|
id: ACTION_ACCEPT_CHANGES,
|
|
@@ -582,7 +525,7 @@ class ApplyPreviewEdits extends AbstractInlineChatAction {
|
|
|
582
525
|
when: CTX_INLINE_CHAT_USER_DID_EDIT
|
|
583
526
|
}],
|
|
584
527
|
menu: {
|
|
585
|
-
when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo("onlyMessages" ))
|
|
528
|
+
when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo("onlyMessages" )))),
|
|
586
529
|
id: MENU_INLINE_CHAT_WIDGET_STATUS,
|
|
587
530
|
group: '0_main',
|
|
588
531
|
order: 0
|
|
@@ -590,7 +533,7 @@ class ApplyPreviewEdits extends AbstractInlineChatAction {
|
|
|
590
533
|
});
|
|
591
534
|
}
|
|
592
535
|
async runInlineChatCommand(_accessor, ctrl) {
|
|
593
|
-
ctrl.
|
|
536
|
+
ctrl.acceptHunk();
|
|
594
537
|
}
|
|
595
538
|
}
|
|
596
539
|
class CancelSessionAction extends AbstractInlineChatAction {
|
|
@@ -610,7 +553,7 @@ class CancelSessionAction extends AbstractInlineChatAction {
|
|
|
610
553
|
},
|
|
611
554
|
menu: {
|
|
612
555
|
id: MENU_INLINE_CHAT_WIDGET_STATUS,
|
|
613
|
-
when: (
|
|
556
|
+
when: ( CTX_INLINE_CHAT_EDIT_MODE.isEqualTo("preview" )),
|
|
614
557
|
group: '0_main',
|
|
615
558
|
order: 3
|
|
616
559
|
}
|
|
@@ -620,6 +563,54 @@ class CancelSessionAction extends AbstractInlineChatAction {
|
|
|
620
563
|
ctrl.cancelSession();
|
|
621
564
|
}
|
|
622
565
|
}
|
|
566
|
+
class CloseAction extends AbstractInlineChatAction {
|
|
567
|
+
constructor() {
|
|
568
|
+
super({
|
|
569
|
+
id: 'inlineChat.close',
|
|
570
|
+
title: ( localizeWithPath(
|
|
571
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
|
|
572
|
+
'close',
|
|
573
|
+
'Close'
|
|
574
|
+
)),
|
|
575
|
+
icon: Codicon.close,
|
|
576
|
+
precondition: CTX_INLINE_CHAT_VISIBLE,
|
|
577
|
+
keybinding: {
|
|
578
|
+
weight: 100 - 1,
|
|
579
|
+
primary: 9
|
|
580
|
+
},
|
|
581
|
+
menu: {
|
|
582
|
+
id: MENU_INLINE_CHAT_WIDGET,
|
|
583
|
+
group: 'main',
|
|
584
|
+
order: 0,
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
async runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
|
|
589
|
+
ctrl.finishExistingSession();
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
class ConfigureInlineChatAction extends AbstractInlineChatAction {
|
|
593
|
+
constructor() {
|
|
594
|
+
super({
|
|
595
|
+
id: 'inlineChat.configure',
|
|
596
|
+
title: ( localizeWithPath(
|
|
597
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
|
|
598
|
+
'configure',
|
|
599
|
+
'Configure '
|
|
600
|
+
)),
|
|
601
|
+
icon: Codicon.settingsGear,
|
|
602
|
+
precondition: CTX_INLINE_CHAT_VISIBLE,
|
|
603
|
+
menu: {
|
|
604
|
+
id: MENU_INLINE_CHAT_WIDGET,
|
|
605
|
+
group: 'config',
|
|
606
|
+
order: 1,
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
async runInlineChatCommand(accessor, ctrl, _editor, ..._args) {
|
|
611
|
+
accessor.get(IPreferencesService).openSettings({ query: 'inlineChat' });
|
|
612
|
+
}
|
|
613
|
+
}
|
|
623
614
|
class CopyRecordings extends AbstractInlineChatAction {
|
|
624
615
|
constructor() {
|
|
625
616
|
super({
|
|
@@ -676,7 +667,7 @@ class ViewInChatAction extends AbstractInlineChatAction {
|
|
|
676
667
|
precondition: CTX_INLINE_CHAT_VISIBLE,
|
|
677
668
|
menu: {
|
|
678
669
|
id: MENU_INLINE_CHAT_WIDGET_STATUS,
|
|
679
|
-
when: (
|
|
670
|
+
when: ( CTX_INLINE_CHAT_RESPONSE_TYPES.isEqualTo("onlyMessages" )),
|
|
680
671
|
group: '0_main',
|
|
681
672
|
order: 1
|
|
682
673
|
}
|
|
@@ -699,7 +690,7 @@ class ExpandMessageAction extends AbstractInlineChatAction {
|
|
|
699
690
|
precondition: CTX_INLINE_CHAT_VISIBLE,
|
|
700
691
|
menu: {
|
|
701
692
|
id: MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE,
|
|
702
|
-
when: ( ContextKeyExpr.and((
|
|
693
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.or(( CTX_INLINE_CHAT_RESPONSE_TYPES.isEqualTo("onlyMessages" )), ( CTX_INLINE_CHAT_RESPONSE_TYPES.isEqualTo("mixed" )))), ( CTX_INLINE_CHAT_MESSAGE_CROP_STATE.isEqualTo('cropped')))),
|
|
703
694
|
group: '2_expandOrContract',
|
|
704
695
|
order: 1
|
|
705
696
|
}
|
|
@@ -722,7 +713,7 @@ class ContractMessageAction extends AbstractInlineChatAction {
|
|
|
722
713
|
precondition: CTX_INLINE_CHAT_VISIBLE,
|
|
723
714
|
menu: {
|
|
724
715
|
id: MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE,
|
|
725
|
-
when: ( ContextKeyExpr.and((
|
|
716
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.or(( CTX_INLINE_CHAT_RESPONSE_TYPES.isEqualTo("onlyMessages" )), ( CTX_INLINE_CHAT_RESPONSE_TYPES.isEqualTo("mixed" )))), ( CTX_INLINE_CHAT_MESSAGE_CROP_STATE.isEqualTo('expanded')))),
|
|
726
717
|
group: '2_expandOrContract',
|
|
727
718
|
order: 1
|
|
728
719
|
}
|
|
@@ -745,4 +736,4 @@ class InlineAccessibilityHelpContribution extends Disposable {
|
|
|
745
736
|
}
|
|
746
737
|
}
|
|
747
738
|
|
|
748
|
-
export {
|
|
739
|
+
export { AbstractInlineChatAction, AcceptChanges, ArrowOutDownAction, ArrowOutUpAction, CancelSessionAction, CloseAction, ConfigureInlineChatAction, ContractMessageAction, CopyRecordings, DiscardAction, DiscardHunkAction, DiscardToClipboardAction, DiscardUndoToNewFileAction, ExpandMessageAction, FeebackHelpfulCommand, FeebackUnhelpfulCommand, FocusInlineChat, InlineAccessibilityHelpContribution, MakeRequestAction, NextFromHistory, PreviousFromHistory, ReRunRequestAction, ReportIssueForBugCommand, StopRequestAction, ToggleDiffForChange, UnstashSessionAction, ViewInChatAction };
|
|
@@ -4,7 +4,7 @@ import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
|
4
4
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
5
5
|
import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
6
6
|
import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
|
7
|
-
import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/
|
|
7
|
+
import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService';
|
|
8
8
|
import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService';
|
|
9
9
|
import { CellUri } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
10
10
|
|
|
@@ -12,17 +12,27 @@ let InlineChatNotebookContribution = class InlineChatNotebookContribution {
|
|
|
12
12
|
constructor(sessionService, notebookEditorService) {
|
|
13
13
|
this._store = ( new DisposableStore());
|
|
14
14
|
this._store.add(sessionService.registerSessionKeyComputer(Schemas.vscodeNotebookCell, {
|
|
15
|
-
getComparisonKey: (
|
|
15
|
+
getComparisonKey: (editor, uri) => {
|
|
16
16
|
const data = CellUri.parse(uri);
|
|
17
17
|
if (!data) {
|
|
18
|
-
throw illegalState('Expected notebook');
|
|
18
|
+
throw illegalState('Expected notebook cell uri');
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
let fallback;
|
|
21
|
+
for (const notebookEditor of notebookEditorService.listNotebookEditors()) {
|
|
22
|
+
if (notebookEditor.hasModel() && isEqual(notebookEditor.textModel.uri, data.notebook)) {
|
|
23
|
+
const candidate = `<notebook>${notebookEditor.getId()}#${uri}`;
|
|
24
|
+
if (!fallback) {
|
|
25
|
+
fallback = candidate;
|
|
26
|
+
}
|
|
27
|
+
if (notebookEditor.codeEditors.find((tuple) => tuple[1] === editor)) {
|
|
28
|
+
return candidate;
|
|
29
|
+
}
|
|
23
30
|
}
|
|
24
31
|
}
|
|
25
|
-
|
|
32
|
+
if (fallback) {
|
|
33
|
+
return fallback;
|
|
34
|
+
}
|
|
35
|
+
throw illegalState('Expected notebook editor');
|
|
26
36
|
}
|
|
27
37
|
}));
|
|
28
38
|
this._store.add(sessionService.onWillStartSession(newSessionEditor => {
|