@codingame/monaco-vscode-chat-service-override 10.1.3 → 11.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 -3
- package/package.json +6 -2
- package/vscode/src/vs/editor/common/diff/documentDiffProvider.js +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +84 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +265 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +20 -39
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +373 -216
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +54 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +12 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +14 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +82 -50
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +326 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +448 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +507 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +76 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorActions.js +109 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorController.js +284 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipantContributions.js +116 -77
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +100 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +7 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +61 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/{common → browser}/languageModelToolsService.js +28 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeContributions.js +75 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.js +120 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +10 -8
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +33 -18
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/ignoredFiles.js +21 -0
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +68 -47
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js +250 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +7 -8
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +3 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +65 -128
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +0 -170
- package/vscode/src/vs/workbench/contrib/chat/browser/chatGettingStarted.js +0 -131
package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { Extensions } from 'vscode/vscode/vs/platform/jsonschemas/common/jsonContributionRegistry';
|
|
2
|
+
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
3
|
+
|
|
4
|
+
const toolsParametersSchemaSchemaId = 'vscode://schemas/toolsParameters';
|
|
5
|
+
const toolsParametersSchemaSchema = {
|
|
6
|
+
definitions: {
|
|
7
|
+
schemaArray: {
|
|
8
|
+
type: 'array',
|
|
9
|
+
minItems: 1,
|
|
10
|
+
items: {
|
|
11
|
+
$ref: '#'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
nonNegativeInteger: {
|
|
15
|
+
type: 'integer',
|
|
16
|
+
minimum: 0
|
|
17
|
+
},
|
|
18
|
+
nonNegativeIntegerDefault0: {
|
|
19
|
+
allOf: [
|
|
20
|
+
{
|
|
21
|
+
$ref: '#/definitions/nonNegativeInteger'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
default: 0
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
simpleTypes: {
|
|
29
|
+
enum: [
|
|
30
|
+
'array',
|
|
31
|
+
'boolean',
|
|
32
|
+
'integer',
|
|
33
|
+
'null',
|
|
34
|
+
'number',
|
|
35
|
+
'object',
|
|
36
|
+
'string'
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
stringArray: {
|
|
40
|
+
type: 'array',
|
|
41
|
+
items: {
|
|
42
|
+
type: 'string'
|
|
43
|
+
},
|
|
44
|
+
uniqueItems: true,
|
|
45
|
+
default: []
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
type: ['object'],
|
|
49
|
+
properties: {
|
|
50
|
+
$id: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
format: 'uri-reference'
|
|
53
|
+
},
|
|
54
|
+
$schema: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
format: 'uri'
|
|
57
|
+
},
|
|
58
|
+
$ref: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
format: 'uri-reference'
|
|
61
|
+
},
|
|
62
|
+
$comment: {
|
|
63
|
+
type: 'string'
|
|
64
|
+
},
|
|
65
|
+
title: {
|
|
66
|
+
type: 'string'
|
|
67
|
+
},
|
|
68
|
+
description: {
|
|
69
|
+
type: 'string'
|
|
70
|
+
},
|
|
71
|
+
readOnly: {
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
default: false
|
|
74
|
+
},
|
|
75
|
+
writeOnly: {
|
|
76
|
+
type: 'boolean',
|
|
77
|
+
default: false
|
|
78
|
+
},
|
|
79
|
+
multipleOf: {
|
|
80
|
+
type: 'number',
|
|
81
|
+
exclusiveMinimum: 0
|
|
82
|
+
},
|
|
83
|
+
maximum: {
|
|
84
|
+
type: 'number'
|
|
85
|
+
},
|
|
86
|
+
exclusiveMaximum: {
|
|
87
|
+
type: 'number'
|
|
88
|
+
},
|
|
89
|
+
minimum: {
|
|
90
|
+
type: 'number'
|
|
91
|
+
},
|
|
92
|
+
exclusiveMinimum: {
|
|
93
|
+
type: 'number'
|
|
94
|
+
},
|
|
95
|
+
maxLength: {
|
|
96
|
+
$ref: '#/definitions/nonNegativeInteger'
|
|
97
|
+
},
|
|
98
|
+
minLength: {
|
|
99
|
+
$ref: '#/definitions/nonNegativeIntegerDefault0'
|
|
100
|
+
},
|
|
101
|
+
pattern: {
|
|
102
|
+
type: 'string',
|
|
103
|
+
format: 'regex'
|
|
104
|
+
},
|
|
105
|
+
additionalItems: {
|
|
106
|
+
$ref: '#'
|
|
107
|
+
},
|
|
108
|
+
items: {
|
|
109
|
+
anyOf: [
|
|
110
|
+
{
|
|
111
|
+
$ref: '#'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
$ref: '#/definitions/schemaArray'
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
default: true
|
|
118
|
+
},
|
|
119
|
+
maxItems: {
|
|
120
|
+
$ref: '#/definitions/nonNegativeInteger'
|
|
121
|
+
},
|
|
122
|
+
minItems: {
|
|
123
|
+
$ref: '#/definitions/nonNegativeIntegerDefault0'
|
|
124
|
+
},
|
|
125
|
+
uniqueItems: {
|
|
126
|
+
type: 'boolean',
|
|
127
|
+
default: false
|
|
128
|
+
},
|
|
129
|
+
contains: {
|
|
130
|
+
$ref: '#'
|
|
131
|
+
},
|
|
132
|
+
maxProperties: {
|
|
133
|
+
$ref: '#/definitions/nonNegativeInteger'
|
|
134
|
+
},
|
|
135
|
+
minProperties: {
|
|
136
|
+
$ref: '#/definitions/nonNegativeIntegerDefault0'
|
|
137
|
+
},
|
|
138
|
+
required: {
|
|
139
|
+
$ref: '#/definitions/stringArray'
|
|
140
|
+
},
|
|
141
|
+
additionalProperties: {
|
|
142
|
+
$ref: '#'
|
|
143
|
+
},
|
|
144
|
+
definitions: {
|
|
145
|
+
type: 'object',
|
|
146
|
+
additionalProperties: {
|
|
147
|
+
$ref: '#'
|
|
148
|
+
},
|
|
149
|
+
default: {}
|
|
150
|
+
},
|
|
151
|
+
properties: {
|
|
152
|
+
type: 'object',
|
|
153
|
+
additionalProperties: {
|
|
154
|
+
$ref: '#'
|
|
155
|
+
},
|
|
156
|
+
default: {}
|
|
157
|
+
},
|
|
158
|
+
patternProperties: {
|
|
159
|
+
type: 'object',
|
|
160
|
+
additionalProperties: {
|
|
161
|
+
$ref: '#'
|
|
162
|
+
},
|
|
163
|
+
propertyNames: {
|
|
164
|
+
format: 'regex'
|
|
165
|
+
},
|
|
166
|
+
default: {}
|
|
167
|
+
},
|
|
168
|
+
dependencies: {
|
|
169
|
+
type: 'object',
|
|
170
|
+
additionalProperties: {
|
|
171
|
+
anyOf: [
|
|
172
|
+
{
|
|
173
|
+
$ref: '#'
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
$ref: '#/definitions/stringArray'
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
propertyNames: {
|
|
182
|
+
$ref: '#'
|
|
183
|
+
},
|
|
184
|
+
enum: {
|
|
185
|
+
type: 'array',
|
|
186
|
+
minItems: 1,
|
|
187
|
+
uniqueItems: true
|
|
188
|
+
},
|
|
189
|
+
type: {
|
|
190
|
+
anyOf: [
|
|
191
|
+
{
|
|
192
|
+
$ref: '#/definitions/simpleTypes'
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
type: 'array',
|
|
196
|
+
items: {
|
|
197
|
+
$ref: '#/definitions/simpleTypes'
|
|
198
|
+
},
|
|
199
|
+
minItems: 1,
|
|
200
|
+
uniqueItems: true
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
format: {
|
|
205
|
+
type: 'string'
|
|
206
|
+
},
|
|
207
|
+
contentMediaType: {
|
|
208
|
+
type: 'string'
|
|
209
|
+
},
|
|
210
|
+
contentEncoding: {
|
|
211
|
+
type: 'string'
|
|
212
|
+
},
|
|
213
|
+
if: {
|
|
214
|
+
$ref: '#'
|
|
215
|
+
},
|
|
216
|
+
then: {
|
|
217
|
+
$ref: '#'
|
|
218
|
+
},
|
|
219
|
+
else: {
|
|
220
|
+
$ref: '#'
|
|
221
|
+
},
|
|
222
|
+
allOf: {
|
|
223
|
+
$ref: '#/definitions/schemaArray'
|
|
224
|
+
},
|
|
225
|
+
anyOf: {
|
|
226
|
+
$ref: '#/definitions/schemaArray'
|
|
227
|
+
},
|
|
228
|
+
oneOf: {
|
|
229
|
+
$ref: '#/definitions/schemaArray'
|
|
230
|
+
},
|
|
231
|
+
not: {
|
|
232
|
+
$ref: '#'
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
defaultSnippets: [{
|
|
236
|
+
body: {
|
|
237
|
+
type: 'object',
|
|
238
|
+
properties: {
|
|
239
|
+
'${1:paramName}': {
|
|
240
|
+
type: 'string',
|
|
241
|
+
description: '${2:description}'
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
}],
|
|
246
|
+
};
|
|
247
|
+
const contributionRegistry = ( Registry.as(Extensions.JSONContribution));
|
|
248
|
+
contributionRegistry.registerSchema(toolsParametersSchemaSchemaId, toolsParametersSchemaSchema);
|
|
249
|
+
|
|
250
|
+
export { toolsParametersSchemaSchemaId };
|
|
@@ -6,7 +6,7 @@ import { rtrim } from 'vscode/vscode/vs/base/common/strings';
|
|
|
6
6
|
import { RawContextKey } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
7
7
|
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
8
8
|
import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
9
|
-
import { chatAgentLeader, chatSubcommandLeader } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
9
|
+
import { chatAgentLeader, chatSubcommandLeader } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
10
10
|
import { SpeechToTextStatus } from 'vscode/vscode/vs/workbench/contrib/speech/common/speechService';
|
|
11
11
|
import { ISpeechService } from 'vscode/vscode/vs/workbench/contrib/speech/common/speechService.service';
|
|
12
12
|
|
|
@@ -20,7 +20,7 @@ var PhraseTextType;
|
|
|
20
20
|
const VoiceChatInProgress = ( (new RawContextKey(
|
|
21
21
|
'voiceChatInProgress',
|
|
22
22
|
false,
|
|
23
|
-
{ type: 'boolean', description: ( localize(
|
|
23
|
+
{ type: 'boolean', description: ( localize(7493, "A speech-to-text session is in progress for chat.")) }
|
|
24
24
|
)));
|
|
25
25
|
let VoiceChatService = class VoiceChatService extends Disposable {
|
|
26
26
|
static { VoiceChatService_1 = this; }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { registerEditorContribution } from 'vscode/vscode/vs/editor/browser/editorExtensions';
|
|
2
2
|
import { registerAction2, MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
3
|
import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
|
4
|
-
import { StartSessionAction, CloseAction, ConfigureInlineChatAction, UnstashSessionAction, DiscardHunkAction,
|
|
5
|
-
import { INLINE_CHAT_ID, CTX_INLINE_CHAT_REQUEST_IN_PROGRESS, CTX_INLINE_CHAT_EDITING, MENU_INLINE_CHAT_WIDGET_STATUS } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
4
|
+
import { StartSessionAction, CloseAction, ConfigureInlineChatAction, UnstashSessionAction, DiscardHunkAction, RerunAction, MoveToNextHunk, MoveToPreviousHunk, ArrowOutUpAction, ArrowOutDownAction, FocusInlineChat, ViewInChatAction, ToggleDiffForChange, AcceptChanges } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatActions';
|
|
5
|
+
import { INLINE_CHAT_ID, CTX_INLINE_CHAT_REQUEST_IN_PROGRESS, CTX_INLINE_CHAT_EDITING, MENU_INLINE_CHAT_WIDGET_STATUS } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/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, registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
@@ -11,7 +11,7 @@ import { InlineChatAccessibleView } from './inlineChatAccessibleView.js';
|
|
|
11
11
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
12
12
|
import { InlineChatEnabler } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl';
|
|
13
13
|
import { AccessibleViewRegistry } from 'vscode/vscode/vs/platform/accessibility/browser/accessibleViewRegistry';
|
|
14
|
-
import { SubmitAction, CancelAction } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatExecuteActions';
|
|
14
|
+
import { SubmitAction, CancelAction } from '@codingame/monaco-vscode-chat-extensions-notebook-common/vscode/vs/workbench/contrib/chat/browser/actions/chatExecuteActions';
|
|
15
15
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
16
16
|
import { CONTEXT_CHAT_INPUT_HAS_TEXT } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
17
17
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
@@ -26,7 +26,7 @@ const editActionMenuItem = {
|
|
|
26
26
|
order: 0,
|
|
27
27
|
command: {
|
|
28
28
|
id: SubmitAction.ID,
|
|
29
|
-
title: ( localize(
|
|
29
|
+
title: ( localize(2729, "Edit Code")),
|
|
30
30
|
},
|
|
31
31
|
when: ( (ContextKeyExpr.and(
|
|
32
32
|
CONTEXT_CHAT_INPUT_HAS_TEXT,
|
|
@@ -39,7 +39,7 @@ const generateActionMenuItem = {
|
|
|
39
39
|
order: 0,
|
|
40
40
|
command: {
|
|
41
41
|
id: SubmitAction.ID,
|
|
42
|
-
title: ( localize(
|
|
42
|
+
title: ( localize(2730, "Generate")),
|
|
43
43
|
},
|
|
44
44
|
when: ( (ContextKeyExpr.and(
|
|
45
45
|
CONTEXT_CHAT_INPUT_HAS_TEXT,
|
|
@@ -54,8 +54,8 @@ const cancelActionMenuItem = {
|
|
|
54
54
|
order: 0,
|
|
55
55
|
command: {
|
|
56
56
|
id: CancelAction.ID,
|
|
57
|
-
title: ( localize(
|
|
58
|
-
shortTitle: ( localize(
|
|
57
|
+
title: ( localize(2731, "Cancel Request")),
|
|
58
|
+
shortTitle: ( localize(2732, "Cancel")),
|
|
59
59
|
},
|
|
60
60
|
when: ( (ContextKeyExpr.and(CTX_INLINE_CHAT_REQUEST_IN_PROGRESS))),
|
|
61
61
|
};
|
|
@@ -65,7 +65,6 @@ registerAction2(CloseAction);
|
|
|
65
65
|
registerAction2(ConfigureInlineChatAction);
|
|
66
66
|
registerAction2(UnstashSessionAction);
|
|
67
67
|
registerAction2(DiscardHunkAction);
|
|
68
|
-
registerAction2(DiscardAction);
|
|
69
68
|
registerAction2(RerunAction);
|
|
70
69
|
registerAction2(MoveToNextHunk);
|
|
71
70
|
registerAction2(MoveToPreviousHunk);
|
|
@@ -2,7 +2,7 @@ import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/cod
|
|
|
2
2
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
3
3
|
import { getChatAccessibilityHelpProvider } from '../../chat/browser/actions/chatAccessibilityHelp.js';
|
|
4
4
|
import { CONTEXT_CHAT_INPUT_HAS_FOCUS } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
5
|
-
import { CTX_INLINE_CHAT_RESPONSE_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
5
|
+
import { CTX_INLINE_CHAT_RESPONSE_FOCUSED } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
6
6
|
|
|
7
7
|
class InlineChatAccessibilityHelp {
|
|
8
8
|
constructor() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
|
2
|
-
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_RESPONSE_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
2
|
+
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_RESPONSE_FOCUSED } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
3
3
|
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
4
4
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
5
5
|
import { AccessibleContentProvider } from 'vscode/vscode/vs/platform/accessibility/browser/accessibleView';
|
|
@@ -5,7 +5,7 @@ import { RawContextKey, ContextKeyExpr } from 'vscode/vscode/vs/platform/context
|
|
|
5
5
|
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
6
6
|
import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
7
7
|
import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
|
8
|
-
import { CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_HAS_AGENT } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
8
|
+
import { CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_HAS_AGENT } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
9
9
|
import { EditorAction2 } from 'vscode/vscode/vs/editor/browser/editorExtensions';
|
|
10
10
|
import { EditOperation } from 'vscode/vscode/vs/editor/common/core/editOperation';
|
|
11
11
|
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
@@ -14,7 +14,7 @@ import { AbstractInlineChatAction } from 'vscode/vscode/vs/workbench/contrib/inl
|
|
|
14
14
|
import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
|
|
15
15
|
|
|
16
16
|
const CTX_INLINE_CHAT_EXPANSION = ( (new RawContextKey('inlineChatExpansion', false, ( localize(
|
|
17
|
-
|
|
17
|
+
7662,
|
|
18
18
|
"Whether the inline chat expansion is enabled when at the end of a just-typed line"
|
|
19
19
|
)))));
|
|
20
20
|
let InlineChatExansionContextKey = class InlineChatExansionContextKey {
|
|
@@ -84,7 +84,7 @@ class InlineChatExpandLineAction extends EditorAction2 {
|
|
|
84
84
|
super({
|
|
85
85
|
id: 'inlineChat.startWithCurrentLine',
|
|
86
86
|
category: AbstractInlineChatAction.category,
|
|
87
|
-
title: ( localize2(
|
|
87
|
+
title: ( localize2(7663, "Start in Editor with Current Line")),
|
|
88
88
|
f1: true,
|
|
89
89
|
precondition: ( (ContextKeyExpr.and(
|
|
90
90
|
(CTX_INLINE_CHAT_VISIBLE.negate()),
|
|
@@ -8,8 +8,8 @@ import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/in
|
|
|
8
8
|
import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
|
|
9
9
|
import { CellUri } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
10
10
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
11
|
-
import { NotebookTextDiffEditor } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor';
|
|
12
|
-
import { NotebookMultiTextDiffEditor } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor';
|
|
11
|
+
import { NotebookTextDiffEditor } from '@codingame/monaco-vscode-chat-notebook-common/vscode/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor';
|
|
12
|
+
import { NotebookMultiTextDiffEditor } from '@codingame/monaco-vscode-chat-notebook-common/vscode/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor';
|
|
13
13
|
|
|
14
14
|
let InlineChatNotebookContribution = class InlineChatNotebookContribution {
|
|
15
15
|
constructor(sessionService, editorService, notebookEditorService) {
|
|
@@ -1,46 +1,55 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { Queue
|
|
2
|
+
import { Queue } from 'vscode/vscode/vs/base/common/async';
|
|
3
3
|
import { DisposableStore, MutableDisposable, dispose, combinedDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
-
import { isCodeEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
|
|
5
4
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
6
5
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
7
6
|
import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.service';
|
|
8
7
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
9
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
10
8
|
import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service';
|
|
11
9
|
import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles.service';
|
|
12
10
|
import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
13
11
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
14
12
|
import { CellUri } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
15
|
-
import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
16
|
-
import { compare } from 'vscode/vscode/vs/base/common/strings';
|
|
17
13
|
import { IWorkingCopyFileService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service';
|
|
18
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
19
14
|
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
20
|
-
import {
|
|
15
|
+
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
16
|
+
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
|
|
17
|
+
import { CancellationError } from 'vscode/vscode/vs/base/common/errors';
|
|
21
18
|
|
|
19
|
+
const key = 'chat.editing.alwaysSaveWithGeneratedChanges';
|
|
22
20
|
let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
23
|
-
constructor(_fileConfigService, _editorGroupService, _textFileService,
|
|
21
|
+
constructor(_fileConfigService, _editorGroupService, _textFileService, _inlineChatSessionService, _configService, _workingCopyFileService, _dialogService, _labelService) {
|
|
24
22
|
this._fileConfigService = _fileConfigService;
|
|
25
23
|
this._editorGroupService = _editorGroupService;
|
|
26
24
|
this._textFileService = _textFileService;
|
|
27
|
-
this._editorService = _editorService;
|
|
28
|
-
this._inlineChatSessionService = _inlineChatSessionService;
|
|
29
25
|
this._configService = _configService;
|
|
30
26
|
this._workingCopyFileService = _workingCopyFileService;
|
|
31
|
-
this.
|
|
27
|
+
this._dialogService = _dialogService;
|
|
28
|
+
this._labelService = _labelService;
|
|
32
29
|
this._store = ( (new DisposableStore()));
|
|
33
30
|
this._saveParticipant = this._store.add(( (new MutableDisposable())));
|
|
34
31
|
this._sessionData = ( (new Map()));
|
|
35
32
|
this._store.add(Event.any(_inlineChatSessionService.onDidEndSession, _inlineChatSessionService.onDidStashSession)(e => {
|
|
36
33
|
this._sessionData.get(e.session)?.dispose();
|
|
37
34
|
}));
|
|
35
|
+
this._store.add(_configService.onDidChangeConfiguration(e => {
|
|
36
|
+
if (!e.affectsConfiguration(key) && !e.affectsConfiguration("inlineChat.acceptedOrDiscardBeforeSave" )) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (this._isDisabled()) {
|
|
40
|
+
dispose(( (this._sessionData.values())));
|
|
41
|
+
this._sessionData.clear();
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
38
44
|
}
|
|
39
45
|
dispose() {
|
|
40
46
|
this._store.dispose();
|
|
41
47
|
dispose(( (this._sessionData.values())));
|
|
42
48
|
}
|
|
43
49
|
markChanged(session) {
|
|
50
|
+
if (this._isDisabled()) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
44
53
|
if (!( (this._sessionData.has(session)))) {
|
|
45
54
|
let uri = session.targetUri;
|
|
46
55
|
if (uri.scheme === Schemas.vscodeNotebookCell) {
|
|
@@ -86,7 +95,7 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
86
95
|
if (reason !== 1 ) {
|
|
87
96
|
return;
|
|
88
97
|
}
|
|
89
|
-
if (
|
|
98
|
+
if (this._isDisabled()) {
|
|
90
99
|
return;
|
|
91
100
|
}
|
|
92
101
|
const sessions = ( (new Map()));
|
|
@@ -98,134 +107,62 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
98
107
|
if (sessions.size === 0) {
|
|
99
108
|
return;
|
|
100
109
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (token.isCancellationRequested) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
return this._openAndWait(( (Iterable.map(orphans, s => [this._editorGroupService.activeGroup, s]))), token);
|
|
116
|
-
});
|
|
117
|
-
const allSessionsEnded = this._whenSessionsEnded(Iterable.concat(( (groups.map(tuple => tuple[1]))), orphans), token);
|
|
118
|
-
await Promise.race([allSessionsEnded, editorsOpenedAndSessionsEnded]);
|
|
119
|
-
}
|
|
120
|
-
_getGroupsAndOrphans(sessions) {
|
|
121
|
-
const groupByEditor = ( (new Map()));
|
|
122
|
-
for (const group of this._editorGroupService.getGroups(1 )) {
|
|
123
|
-
const candidate = group.activeEditorPane?.getControl();
|
|
124
|
-
if (isCodeEditor(candidate)) {
|
|
125
|
-
groupByEditor.set(candidate, group);
|
|
126
|
-
}
|
|
110
|
+
let message;
|
|
111
|
+
if (sessions.size === 1) {
|
|
112
|
+
const session = Iterable.first(( (sessions.values()))).session;
|
|
113
|
+
const agentName = session.agent.fullName;
|
|
114
|
+
const filelabel = this._labelService.getUriBasenameLabel(session.textModelN.uri);
|
|
115
|
+
message = ( localize(
|
|
116
|
+
2706,
|
|
117
|
+
"Do you want to save the changes {0} made in {1}?",
|
|
118
|
+
agentName,
|
|
119
|
+
filelabel
|
|
120
|
+
));
|
|
127
121
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
orphans.add(data);
|
|
141
|
-
}
|
|
122
|
+
else {
|
|
123
|
+
const labels = Array.from(( (Iterable.map(
|
|
124
|
+
(sessions.values()),
|
|
125
|
+
i => this._labelService.getUriBasenameLabel(i.session.textModelN.uri)
|
|
126
|
+
))));
|
|
127
|
+
message = ( localize(
|
|
128
|
+
2707,
|
|
129
|
+
"Do you want to save the changes inline chat made in {0}?",
|
|
130
|
+
labels.join(', ')
|
|
131
|
+
));
|
|
142
132
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
133
|
+
const result = await this._dialogService.confirm({
|
|
134
|
+
message,
|
|
135
|
+
detail: ( localize(
|
|
136
|
+
2708,
|
|
137
|
+
"AI-generated changes may be incorrect and should be reviewed before saving."
|
|
138
|
+
)),
|
|
139
|
+
primaryButton: ( localize(2709, "Save")),
|
|
140
|
+
cancelButton: ( localize(2710, "Cancel")),
|
|
141
|
+
checkbox: {
|
|
142
|
+
label: ( localize(2711, "Always save with AI-generated changes without asking")),
|
|
143
|
+
checked: false
|
|
152
144
|
}
|
|
153
|
-
|
|
145
|
+
});
|
|
146
|
+
if (!result.confirmed) {
|
|
147
|
+
throw ( (new CancellationError()));
|
|
154
148
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
array.sort((a, b) => compare(( (a.session.targetUri.toString())), ( (b.session.targetUri.toString()))));
|
|
160
|
-
for (const data of array) {
|
|
161
|
-
const input = { resource: data.resourceUri };
|
|
162
|
-
const pane = await this._editorService.openEditor(input, group);
|
|
163
|
-
let editor;
|
|
164
|
-
if (data.session.targetUri.scheme === Schemas.vscodeNotebookCell) {
|
|
165
|
-
const notebookEditor = getNotebookEditorFromEditorPane(pane);
|
|
166
|
-
const uriData = CellUri.parse(data.session.targetUri);
|
|
167
|
-
if (notebookEditor && notebookEditor.hasModel() && uriData) {
|
|
168
|
-
const cell = notebookEditor.getCellByHandle(uriData.handle);
|
|
169
|
-
if (cell) {
|
|
170
|
-
await notebookEditor.revealRangeInCenterIfOutsideViewportAsync(cell, data.session.wholeRange.value);
|
|
171
|
-
}
|
|
172
|
-
const tuple = notebookEditor.codeEditors.find(tuple => tuple[1].getModel()?.uri.toString() === ( (data.session.targetUri.toString())));
|
|
173
|
-
editor = tuple?.[1];
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
if (isCodeEditor(pane?.getControl())) {
|
|
178
|
-
editor = pane.getControl();
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (!editor) {
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
this._inlineChatSessionService.moveSession(data.session, editor);
|
|
185
|
-
InlineChatController.get(editor)?.showSaveHint();
|
|
186
|
-
this._logService.info('WAIT for session to end', editor.getId(), ( (data.session.targetUri.toString())));
|
|
187
|
-
await this._whenSessionsEnded(Iterable.single(data), token);
|
|
188
|
-
}
|
|
149
|
+
if (result.checkboxChecked) {
|
|
150
|
+
this._configService.updateValue(key, true);
|
|
189
151
|
}
|
|
190
152
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
for (const item of iterable) {
|
|
194
|
-
sessions.set(item.session, item);
|
|
195
|
-
}
|
|
196
|
-
if (sessions.size === 0) {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
let listener;
|
|
200
|
-
const whenEnded = ( (new Promise(resolve => {
|
|
201
|
-
listener = Event.any(this._inlineChatSessionService.onDidEndSession, this._inlineChatSessionService.onDidStashSession)(e => {
|
|
202
|
-
const data = sessions.get(e.session);
|
|
203
|
-
if (data) {
|
|
204
|
-
data.dispose();
|
|
205
|
-
sessions.delete(e.session);
|
|
206
|
-
if (sessions.size === 0) {
|
|
207
|
-
resolve();
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
})));
|
|
212
|
-
try {
|
|
213
|
-
await raceCancellation(whenEnded, token);
|
|
214
|
-
}
|
|
215
|
-
finally {
|
|
216
|
-
listener?.dispose();
|
|
217
|
-
}
|
|
153
|
+
_isDisabled() {
|
|
154
|
+
return this._configService.getValue("inlineChat.acceptedOrDiscardBeforeSave" ) === true || this._configService.getValue(key);
|
|
218
155
|
}
|
|
219
156
|
};
|
|
220
157
|
InlineChatSavingServiceImpl = ( (__decorate([
|
|
221
158
|
( (__param(0, IFilesConfigurationService))),
|
|
222
159
|
( (__param(1, IEditorGroupsService))),
|
|
223
160
|
( (__param(2, ITextFileService))),
|
|
224
|
-
( (__param(3,
|
|
225
|
-
( (__param(4,
|
|
226
|
-
( (__param(5,
|
|
227
|
-
( (__param(6,
|
|
228
|
-
( (__param(7,
|
|
161
|
+
( (__param(3, IInlineChatSessionService))),
|
|
162
|
+
( (__param(4, IConfigurationService))),
|
|
163
|
+
( (__param(5, IWorkingCopyFileService))),
|
|
164
|
+
( (__param(6, IDialogService))),
|
|
165
|
+
( (__param(7, ILabelService)))
|
|
229
166
|
], InlineChatSavingServiceImpl)));
|
|
230
167
|
|
|
231
168
|
export { InlineChatSavingServiceImpl };
|