@codingame/monaco-vscode-chat-service-override 11.1.2 → 12.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/index.d.ts +2 -1
- package/index.js +64 -1
- package/package.json +32 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +73 -60
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +73 -81
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +73 -112
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +253 -101
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +16 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +30 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +22 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +23 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +52 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +50 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +124 -95
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +6 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.js +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.d.ts +69 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +203 -182
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +103 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +458 -165
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +14 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/{chatParticipantContributions.js → chatParticipant.contribution.js} +101 -92
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +164 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +6 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +10 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +941 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +9 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +54 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +32 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +8 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +16 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +108 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.js +3 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/media/editorHoverWrapper.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +70 -49
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewSetup.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/{chatViewsWelcomeContributions.js → chatViewsWelcomeHandler.js} +13 -13
- package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.js +3 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +80 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +152 -104
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +6 -4
- package/vscode/src/vs/workbench/contrib/chat/common/ignoredFiles.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/ignoredFiles.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +23 -21
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +20 -19
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.service.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +30 -33
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +6 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +9 -7
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +247 -83
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +5 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +35 -35
- package/chat.js +0 -59
- package/vscode/src/vs/editor/common/diff/documentDiffProvider.js +0 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +0 -326
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +0 -76
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorActions.js +0 -110
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorController.js +0 -287
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +0 -130
- package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +0 -172
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { Queue } from 'vscode/vscode/vs/base/common/async';
|
|
3
4
|
import { DisposableStore, MutableDisposable, dispose, combinedDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
5
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
5
6
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
7
|
+
import { SaveReason } from 'vscode/vscode/vs/workbench/common/editor';
|
|
6
8
|
import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.service';
|
|
9
|
+
import { InlineChatConfigKeys } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
7
10
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
8
11
|
import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service';
|
|
9
12
|
import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles.service';
|
|
@@ -26,31 +29,31 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
26
29
|
this._workingCopyFileService = _workingCopyFileService;
|
|
27
30
|
this._dialogService = _dialogService;
|
|
28
31
|
this._labelService = _labelService;
|
|
29
|
-
this._store = (
|
|
30
|
-
this._saveParticipant = this._store.add((
|
|
31
|
-
this._sessionData = (
|
|
32
|
+
this._store = ( new DisposableStore());
|
|
33
|
+
this._saveParticipant = this._store.add(( new MutableDisposable()));
|
|
34
|
+
this._sessionData = ( new Map());
|
|
32
35
|
this._store.add(Event.any(_inlineChatSessionService.onDidEndSession, _inlineChatSessionService.onDidStashSession)(e => {
|
|
33
36
|
this._sessionData.get(e.session)?.dispose();
|
|
34
37
|
}));
|
|
35
38
|
this._store.add(_configService.onDidChangeConfiguration(e => {
|
|
36
|
-
if (!e.affectsConfiguration(key) && !e.affectsConfiguration(
|
|
39
|
+
if (!e.affectsConfiguration(key) && !e.affectsConfiguration(InlineChatConfigKeys.AcceptedOrDiscardBeforeSave)) {
|
|
37
40
|
return;
|
|
38
41
|
}
|
|
39
42
|
if (this._isDisabled()) {
|
|
40
|
-
dispose((
|
|
43
|
+
dispose(( this._sessionData.values()));
|
|
41
44
|
this._sessionData.clear();
|
|
42
45
|
}
|
|
43
46
|
}));
|
|
44
47
|
}
|
|
45
48
|
dispose() {
|
|
46
49
|
this._store.dispose();
|
|
47
|
-
dispose((
|
|
50
|
+
dispose(( this._sessionData.values()));
|
|
48
51
|
}
|
|
49
52
|
markChanged(session) {
|
|
50
53
|
if (this._isDisabled()) {
|
|
51
54
|
return;
|
|
52
55
|
}
|
|
53
|
-
if (!(
|
|
56
|
+
if (!( this._sessionData.has(session))) {
|
|
54
57
|
let uri = session.targetUri;
|
|
55
58
|
if (uri.scheme === Schemas.vscodeNotebookCell) {
|
|
56
59
|
const data = CellUri.parse(uri);
|
|
@@ -78,7 +81,7 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
83
|
_installSaveParticpant() {
|
|
81
|
-
const queue = (
|
|
84
|
+
const queue = ( new Queue());
|
|
82
85
|
const d1 = this._textFileService.files.addSaveParticipant({
|
|
83
86
|
participate: (model, ctx, progress, token) => {
|
|
84
87
|
return queue.queue(() => this._participate(ctx.savedFrom ?? model.textEditorModel?.uri, ctx.reason, progress, token));
|
|
@@ -92,15 +95,15 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
92
95
|
this._saveParticipant.value = combinedDisposable(d1, d2, queue);
|
|
93
96
|
}
|
|
94
97
|
async _participate(uri, reason, progress, token) {
|
|
95
|
-
if (reason !==
|
|
98
|
+
if (reason !== SaveReason.EXPLICIT) {
|
|
96
99
|
return;
|
|
97
100
|
}
|
|
98
101
|
if (this._isDisabled()) {
|
|
99
102
|
return;
|
|
100
103
|
}
|
|
101
|
-
const sessions = (
|
|
104
|
+
const sessions = ( new Map());
|
|
102
105
|
for (const [session, data] of this._sessionData) {
|
|
103
|
-
if (uri?.toString() === (
|
|
106
|
+
if (uri?.toString() === ( data.resourceUri.toString())) {
|
|
104
107
|
sessions.set(session, data);
|
|
105
108
|
}
|
|
106
109
|
}
|
|
@@ -109,23 +112,20 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
109
112
|
}
|
|
110
113
|
let message;
|
|
111
114
|
if (sessions.size === 1) {
|
|
112
|
-
const session = Iterable.first((
|
|
115
|
+
const session = Iterable.first(( sessions.values())).session;
|
|
113
116
|
const agentName = session.agent.fullName;
|
|
114
117
|
const filelabel = this._labelService.getUriBasenameLabel(session.textModelN.uri);
|
|
115
118
|
message = ( localize(
|
|
116
|
-
|
|
119
|
+
6775,
|
|
117
120
|
"Do you want to save the changes {0} made in {1}?",
|
|
118
121
|
agentName,
|
|
119
122
|
filelabel
|
|
120
123
|
));
|
|
121
124
|
}
|
|
122
125
|
else {
|
|
123
|
-
const labels = Array.from((
|
|
124
|
-
(sessions.values()),
|
|
125
|
-
i => this._labelService.getUriBasenameLabel(i.session.textModelN.uri)
|
|
126
|
-
))));
|
|
126
|
+
const labels = Array.from(( Iterable.map(( sessions.values()), i => this._labelService.getUriBasenameLabel(i.session.textModelN.uri))));
|
|
127
127
|
message = ( localize(
|
|
128
|
-
|
|
128
|
+
6776,
|
|
129
129
|
"Do you want to save the changes inline chat made in {0}?",
|
|
130
130
|
labels.join(', ')
|
|
131
131
|
));
|
|
@@ -133,36 +133,36 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
133
133
|
const result = await this._dialogService.confirm({
|
|
134
134
|
message,
|
|
135
135
|
detail: ( localize(
|
|
136
|
-
|
|
136
|
+
6777,
|
|
137
137
|
"AI-generated changes may be incorrect and should be reviewed before saving."
|
|
138
138
|
)),
|
|
139
|
-
primaryButton: ( localize(
|
|
140
|
-
cancelButton: ( localize(
|
|
139
|
+
primaryButton: ( localize(6778, "Save")),
|
|
140
|
+
cancelButton: ( localize(6779, "Cancel")),
|
|
141
141
|
checkbox: {
|
|
142
|
-
label: ( localize(
|
|
142
|
+
label: ( localize(6780, "Always save with AI-generated changes without asking")),
|
|
143
143
|
checked: false
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
146
|
if (!result.confirmed) {
|
|
147
|
-
throw (
|
|
147
|
+
throw ( new CancellationError());
|
|
148
148
|
}
|
|
149
149
|
if (result.checkboxChecked) {
|
|
150
150
|
this._configService.updateValue(key, true);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
_isDisabled() {
|
|
154
|
-
return this._configService.getValue(
|
|
154
|
+
return this._configService.getValue(InlineChatConfigKeys.AcceptedOrDiscardBeforeSave) === true || this._configService.getValue(key);
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
|
-
InlineChatSavingServiceImpl = (
|
|
158
|
-
(
|
|
159
|
-
(
|
|
160
|
-
(
|
|
161
|
-
(
|
|
162
|
-
(
|
|
163
|
-
(
|
|
164
|
-
(
|
|
165
|
-
(
|
|
166
|
-
], InlineChatSavingServiceImpl))
|
|
157
|
+
InlineChatSavingServiceImpl = ( __decorate([
|
|
158
|
+
( __param(0, IFilesConfigurationService)),
|
|
159
|
+
( __param(1, IEditorGroupsService)),
|
|
160
|
+
( __param(2, ITextFileService)),
|
|
161
|
+
( __param(3, IInlineChatSessionService)),
|
|
162
|
+
( __param(4, IConfigurationService)),
|
|
163
|
+
( __param(5, IWorkingCopyFileService)),
|
|
164
|
+
( __param(6, IDialogService)),
|
|
165
|
+
( __param(7, ILabelService))
|
|
166
|
+
], InlineChatSavingServiceImpl));
|
|
167
167
|
|
|
168
168
|
export { InlineChatSavingServiceImpl };
|
package/chat.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
2
|
-
import { IChatWidgetService, IQuickChatService, IChatAccessibilityService, IChatCodeBlockContextProviderService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
3
|
-
import { ChatAccessibilityService } from './vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js';
|
|
4
|
-
import { QuickChatService } from './vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js';
|
|
5
|
-
import { ChatVariablesService } from './vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js';
|
|
6
|
-
import { ChatWidgetService } from '@codingame/monaco-vscode-chat-notebook-common/vscode/vs/workbench/contrib/chat/browser/chatWidget';
|
|
7
|
-
import { ChatCodeBlockContextProviderService } from './vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.js';
|
|
8
|
-
import { ChatAgentService, ChatAgentNameService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
9
|
-
import { IChatAgentService, IChatAgentNameService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
10
|
-
import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
11
|
-
import { ChatService } from './vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js';
|
|
12
|
-
import { ChatSlashCommandService } from './vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js';
|
|
13
|
-
import { IChatSlashCommandService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatSlashCommands.service';
|
|
14
|
-
import { IChatVariablesService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatVariables.service';
|
|
15
|
-
import { ChatWidgetHistoryService } from './vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js';
|
|
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';
|
|
18
|
-
import { LanguageModelsService } from './vscode/src/vs/workbench/contrib/chat/common/languageModels.js';
|
|
19
|
-
import { ILanguageModelsService } from 'vscode/vscode/vs/workbench/contrib/chat/common/languageModels.service';
|
|
20
|
-
import { IInlineChatSavingService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSavingService.service';
|
|
21
|
-
import { InlineChatSavingServiceImpl } from './vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js';
|
|
22
|
-
import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.service';
|
|
23
|
-
import { InlineChatSessionServiceImpl } from '@codingame/monaco-vscode-chat-interactive-notebook-search-terminal-common/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl';
|
|
24
|
-
import { LanguageModelStatsService } from './vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js';
|
|
25
|
-
import './vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js';
|
|
26
|
-
import './vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js';
|
|
27
|
-
import { ILanguageModelToolsService } from 'vscode/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service';
|
|
28
|
-
import { LanguageModelToolsService } from './vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js';
|
|
29
|
-
import { ICodeMapperService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatCodeMapperService.service';
|
|
30
|
-
import { CodeMapperService } from './vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.js';
|
|
31
|
-
import { IChatEditingService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
32
|
-
import { ChatEditingService } from './vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js';
|
|
33
|
-
import { LanguageModelIgnoredFilesService } from './vscode/src/vs/workbench/contrib/chat/common/ignoredFiles.js';
|
|
34
|
-
import { ILanguageModelIgnoredFilesService } from 'vscode/vscode/vs/workbench/contrib/chat/common/ignoredFiles.service';
|
|
35
|
-
|
|
36
|
-
function getServiceOverride() {
|
|
37
|
-
return {
|
|
38
|
-
[( IChatService.toString())]: new SyncDescriptor(ChatService, [], true),
|
|
39
|
-
[( IChatWidgetService.toString())]: new SyncDescriptor(ChatWidgetService, [], true),
|
|
40
|
-
[( IQuickChatService.toString())]: new SyncDescriptor(QuickChatService, [], true),
|
|
41
|
-
[( IChatAccessibilityService.toString())]: new SyncDescriptor(ChatAccessibilityService, [], true),
|
|
42
|
-
[( IChatWidgetHistoryService.toString())]: new SyncDescriptor(ChatWidgetHistoryService, [], true),
|
|
43
|
-
[( ILanguageModelsService.toString())]: new SyncDescriptor(LanguageModelsService, [], true),
|
|
44
|
-
[( IChatSlashCommandService.toString())]: new SyncDescriptor(ChatSlashCommandService, [], true),
|
|
45
|
-
[( IChatAgentService.toString())]: new SyncDescriptor(ChatAgentService, [], true),
|
|
46
|
-
[( IChatVariablesService.toString())]: new SyncDescriptor(ChatVariablesService, [], true),
|
|
47
|
-
[( IInlineChatSessionService.toString())]: new SyncDescriptor(InlineChatSessionServiceImpl, [], true),
|
|
48
|
-
[( IInlineChatSavingService.toString())]: new SyncDescriptor(InlineChatSavingServiceImpl, [], true),
|
|
49
|
-
[( IChatCodeBlockContextProviderService.toString())]: new SyncDescriptor(ChatCodeBlockContextProviderService, [], true),
|
|
50
|
-
[( ILanguageModelStatsService.toString())]: new SyncDescriptor(LanguageModelStatsService, [], true),
|
|
51
|
-
[( ILanguageModelIgnoredFilesService.toString())]: new SyncDescriptor(LanguageModelIgnoredFilesService, [], true),
|
|
52
|
-
[( IChatAgentNameService.toString())]: new SyncDescriptor(ChatAgentNameService, [], true),
|
|
53
|
-
[( ILanguageModelToolsService.toString())]: new SyncDescriptor(LanguageModelToolsService, [], true),
|
|
54
|
-
[( ICodeMapperService.toString())]: new SyncDescriptor(CodeMapperService, [], true),
|
|
55
|
-
[( IChatEditingService.toString())]: new SyncDescriptor(ChatEditingService, [], true)
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export { getServiceOverride as default };
|
package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js
DELETED
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { RunOnceScheduler, timeout } from 'vscode/vscode/vs/base/common/async';
|
|
3
|
-
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
4
|
-
import { Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
-
import { observableValue, transaction } from 'vscode/vscode/vs/base/common/observableInternal/base';
|
|
6
|
-
import 'vscode/vscode/vs/base/common/arrays';
|
|
7
|
-
import 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
8
|
-
import 'vscode/vscode/vs/base/common/observableInternal/derived';
|
|
9
|
-
import 'vscode/vscode/vs/base/common/cancellation';
|
|
10
|
-
import 'vscode/vscode/vs/base/common/observableInternal/utils';
|
|
11
|
-
import { themeColorFromId } from 'vscode/vscode/vs/base/common/themables';
|
|
12
|
-
import { IBulkEditService } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
|
|
13
|
-
import { EditOperation } from 'vscode/vscode/vs/editor/common/core/editOperation';
|
|
14
|
-
import { OffsetEdit, SingleOffsetEdit } from 'vscode/vscode/vs/editor/common/core/offsetEdit';
|
|
15
|
-
import { OffsetRange } from 'vscode/vscode/vs/editor/common/core/offsetRange';
|
|
16
|
-
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
17
|
-
import { nullDocumentDiff } from '../../../../../editor/common/diff/documentDiffProvider.js';
|
|
18
|
-
import { TextEdit } from 'vscode/vscode/vs/editor/common/languages';
|
|
19
|
-
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
20
|
-
import { OverviewRulerLane } from 'vscode/vscode/vs/editor/common/model';
|
|
21
|
-
import { SingleModelEditStackElement } from 'vscode/vscode/vs/editor/common/model/editStack';
|
|
22
|
-
import { ModelDecorationOptions, createTextBufferFactoryFromSnapshot } from 'vscode/vscode/vs/editor/common/model/textModel';
|
|
23
|
-
import { IEditorWorkerService } from 'vscode/vscode/vs/editor/common/services/editorWorker';
|
|
24
|
-
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
25
|
-
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
26
|
-
import { localize } from 'vscode/vscode/vs/nls';
|
|
27
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
28
|
-
import 'vscode/vscode/vs/platform/theme/common/colorUtils';
|
|
29
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
|
|
30
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
31
|
-
import { editorSelectionBackground } from 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
|
|
32
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
|
|
33
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
|
|
34
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
|
|
35
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
36
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
37
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
38
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
39
|
-
import { IUndoRedoService } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo.service';
|
|
40
|
-
import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
41
|
-
import { ChatEditingTextModelContentProvider, ChatEditingSnapshotTextModelContentProvider } from './chatEditingTextModelContentProviders.js';
|
|
42
|
-
|
|
43
|
-
var ChatEditingModifiedFileEntry_1;
|
|
44
|
-
let ChatEditingModifiedFileEntry = class ChatEditingModifiedFileEntry extends Disposable {
|
|
45
|
-
static { ChatEditingModifiedFileEntry_1 = this; }
|
|
46
|
-
static { this.scheme = 'modified-file-entry'; }
|
|
47
|
-
static { this.lastEntryId = 0; }
|
|
48
|
-
get onDidDelete() {
|
|
49
|
-
return this._onDidDelete.event;
|
|
50
|
-
}
|
|
51
|
-
get originalURI() {
|
|
52
|
-
return this.docSnapshot.uri;
|
|
53
|
-
}
|
|
54
|
-
get originalModel() {
|
|
55
|
-
return this.docSnapshot;
|
|
56
|
-
}
|
|
57
|
-
get modifiedURI() {
|
|
58
|
-
return this.doc.uri;
|
|
59
|
-
}
|
|
60
|
-
get modifiedModel() {
|
|
61
|
-
return this.doc;
|
|
62
|
-
}
|
|
63
|
-
get state() {
|
|
64
|
-
return this._stateObs;
|
|
65
|
-
}
|
|
66
|
-
get isCurrentlyBeingModified() {
|
|
67
|
-
return this._isCurrentlyBeingModifiedObs;
|
|
68
|
-
}
|
|
69
|
-
get diffInfo() {
|
|
70
|
-
return this._diffInfo;
|
|
71
|
-
}
|
|
72
|
-
static { this._editDecorationOptions = ModelDecorationOptions.register({
|
|
73
|
-
isWholeLine: true,
|
|
74
|
-
description: 'chat-editing',
|
|
75
|
-
className: 'rangeHighlight',
|
|
76
|
-
marginClassName: 'rangeHighlight',
|
|
77
|
-
overviewRuler: {
|
|
78
|
-
position: OverviewRulerLane.Full,
|
|
79
|
-
color: themeColorFromId(editorSelectionBackground)
|
|
80
|
-
},
|
|
81
|
-
}); }
|
|
82
|
-
get telemetryInfo() {
|
|
83
|
-
return this._telemetryInfo;
|
|
84
|
-
}
|
|
85
|
-
get lastModifyingRequestId() {
|
|
86
|
-
return this._telemetryInfo.requestId;
|
|
87
|
-
}
|
|
88
|
-
constructor(resource, resourceRef, _multiDiffEntryDelegate, _telemetryInfo, kind, modelService, textModelService, languageService, bulkEditService, _chatService, _editorWorkerService, _undoRedoService, _fileService) {
|
|
89
|
-
super();
|
|
90
|
-
this.resource = resource;
|
|
91
|
-
this._multiDiffEntryDelegate = _multiDiffEntryDelegate;
|
|
92
|
-
this._telemetryInfo = _telemetryInfo;
|
|
93
|
-
this.bulkEditService = bulkEditService;
|
|
94
|
-
this._chatService = _chatService;
|
|
95
|
-
this._editorWorkerService = _editorWorkerService;
|
|
96
|
-
this._undoRedoService = _undoRedoService;
|
|
97
|
-
this._fileService = _fileService;
|
|
98
|
-
this.entryId = `${ChatEditingModifiedFileEntry_1.scheme}::${++ChatEditingModifiedFileEntry_1.lastEntryId}`;
|
|
99
|
-
this._onDidDelete = this._register(( (new Emitter())));
|
|
100
|
-
this._stateObs = observableValue(this, 0 );
|
|
101
|
-
this._isCurrentlyBeingModifiedObs = observableValue(this, false);
|
|
102
|
-
this._isFirstEditAfterStartOrSnapshot = true;
|
|
103
|
-
this._edit = OffsetEdit.empty;
|
|
104
|
-
this._isEditFromUs = false;
|
|
105
|
-
this._diffOperationIds = 0;
|
|
106
|
-
this._diffInfo = observableValue(this, nullDocumentDiff);
|
|
107
|
-
this._editDecorationClear = this._register(( (new RunOnceScheduler(
|
|
108
|
-
() => { this._editDecorations = this.doc.deltaDecorations(this._editDecorations, []); },
|
|
109
|
-
3000
|
|
110
|
-
))));
|
|
111
|
-
this._editDecorations = [];
|
|
112
|
-
if (kind === 0 ) {
|
|
113
|
-
this.createdInRequestId = this._telemetryInfo.requestId;
|
|
114
|
-
}
|
|
115
|
-
this.doc = resourceRef.object.textEditorModel;
|
|
116
|
-
const docSnapshot = this.docSnapshot = this._register(modelService.createModel(createTextBufferFactoryFromSnapshot(this.doc.createSnapshot()), languageService.createById(this.doc.getLanguageId()), ChatEditingTextModelContentProvider.getFileURI(this.entryId, resource.path), false));
|
|
117
|
-
(async () => {
|
|
118
|
-
const reference = await textModelService.createModelReference(docSnapshot.uri);
|
|
119
|
-
if (this._store.isDisposed) {
|
|
120
|
-
reference.dispose();
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
this._register(reference);
|
|
124
|
-
})();
|
|
125
|
-
this._register(resourceRef);
|
|
126
|
-
this._register(this.doc.onDidChangeContent(e => this._mirrorEdits(e)));
|
|
127
|
-
this._register(toDisposable(() => {
|
|
128
|
-
this._clearCurrentEditLineDecoration();
|
|
129
|
-
}));
|
|
130
|
-
}
|
|
131
|
-
_clearCurrentEditLineDecoration() {
|
|
132
|
-
this._editDecorations = this.doc.deltaDecorations(this._editDecorations, []);
|
|
133
|
-
}
|
|
134
|
-
updateTelemetryInfo(telemetryInfo) {
|
|
135
|
-
this._telemetryInfo = telemetryInfo;
|
|
136
|
-
}
|
|
137
|
-
createSnapshot(requestId) {
|
|
138
|
-
this._isFirstEditAfterStartOrSnapshot = true;
|
|
139
|
-
return {
|
|
140
|
-
resource: this.modifiedURI,
|
|
141
|
-
languageId: this.modifiedModel.getLanguageId(),
|
|
142
|
-
snapshotUri: ChatEditingSnapshotTextModelContentProvider.getSnapshotFileURI(requestId, this.modifiedURI.path),
|
|
143
|
-
original: this.originalModel.getValue(),
|
|
144
|
-
current: this.modifiedModel.getValue(),
|
|
145
|
-
originalToCurrentEdit: this._edit,
|
|
146
|
-
state: this.state.get(),
|
|
147
|
-
telemetryInfo: this._telemetryInfo
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
restoreFromSnapshot(snapshot) {
|
|
151
|
-
this._stateObs.set(snapshot.state, undefined);
|
|
152
|
-
this.docSnapshot.setValue(snapshot.original);
|
|
153
|
-
this._setDocValue(snapshot.current);
|
|
154
|
-
this._edit = snapshot.originalToCurrentEdit;
|
|
155
|
-
}
|
|
156
|
-
resetToInitialValue(value) {
|
|
157
|
-
this._setDocValue(value);
|
|
158
|
-
}
|
|
159
|
-
acceptStreamingEditsStart(tx) {
|
|
160
|
-
this._isCurrentlyBeingModifiedObs.set(false, tx);
|
|
161
|
-
this._clearCurrentEditLineDecoration();
|
|
162
|
-
}
|
|
163
|
-
acceptStreamingEditsEnd(tx) {
|
|
164
|
-
this._isCurrentlyBeingModifiedObs.set(false, tx);
|
|
165
|
-
this._clearCurrentEditLineDecoration();
|
|
166
|
-
}
|
|
167
|
-
_mirrorEdits(event) {
|
|
168
|
-
const edit = fromContentChange(event.changes);
|
|
169
|
-
if (this._isEditFromUs) {
|
|
170
|
-
const e_sum = this._edit;
|
|
171
|
-
const e_ai = edit;
|
|
172
|
-
this._edit = e_sum.compose(e_ai);
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
const e_ai = this._edit;
|
|
176
|
-
const e_user = edit;
|
|
177
|
-
const e_user_r = e_user.tryRebase(e_ai.inverse(this.docSnapshot.getValue()), true);
|
|
178
|
-
if (e_user_r === undefined) {
|
|
179
|
-
this._edit = e_ai.compose(e_user);
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
const edits = toEditOperations(e_user_r, this.docSnapshot);
|
|
183
|
-
this.docSnapshot.applyEdits(edits);
|
|
184
|
-
this._edit = e_ai.tryRebase(e_user_r);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
this._updateDiffInfoSeq(!this._isEditFromUs);
|
|
188
|
-
}
|
|
189
|
-
acceptAgentEdits(textEdits) {
|
|
190
|
-
this._editDecorations = this.doc.deltaDecorations(this._editDecorations, ( (textEdits.map(edit => {
|
|
191
|
-
return {
|
|
192
|
-
options: ChatEditingModifiedFileEntry_1._editDecorationOptions,
|
|
193
|
-
range: edit.range
|
|
194
|
-
};
|
|
195
|
-
}))));
|
|
196
|
-
this._editDecorationClear.schedule();
|
|
197
|
-
if (this._isFirstEditAfterStartOrSnapshot) {
|
|
198
|
-
this._isFirstEditAfterStartOrSnapshot = false;
|
|
199
|
-
const request = this._chatService.getSession(this._telemetryInfo.sessionId)?.getRequests().at(-1);
|
|
200
|
-
const label = request?.message.text ? ( localize(10885, "Chat Edit: '{0}'", request.message.text)) : ( localize(10886, "Chat Edit"));
|
|
201
|
-
this._undoRedoService.pushElement(( (new SingleModelEditStackElement(label, 'chat.edit', this.doc, null))));
|
|
202
|
-
}
|
|
203
|
-
this._applyEdits(( (textEdits.map(TextEdit.asEditOperation))));
|
|
204
|
-
transaction((tx) => {
|
|
205
|
-
this._stateObs.set(0 , tx);
|
|
206
|
-
this._isCurrentlyBeingModifiedObs.set(true, tx);
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
_applyEdits(edits) {
|
|
210
|
-
this._isEditFromUs = true;
|
|
211
|
-
try {
|
|
212
|
-
this.doc.pushEditOperations(null, edits, () => null);
|
|
213
|
-
}
|
|
214
|
-
finally {
|
|
215
|
-
this._isEditFromUs = false;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
_updateDiffInfoSeq(fast) {
|
|
219
|
-
const myDiffOperationId = ++this._diffOperationIds;
|
|
220
|
-
Promise.resolve(this._diffOperation).then(() => {
|
|
221
|
-
if (this._diffOperationIds === myDiffOperationId) {
|
|
222
|
-
this._diffOperation = this._updateDiffInfo(fast);
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
async _updateDiffInfo(fast) {
|
|
227
|
-
const docVersionNow = this.doc.getVersionId();
|
|
228
|
-
const snapshotVersionNow = this.docSnapshot.getVersionId();
|
|
229
|
-
const [diff] = await Promise.all([
|
|
230
|
-
this._editorWorkerService.computeDiff(this.docSnapshot.uri, this.doc.uri, { computeMoves: true, ignoreTrimWhitespace: false, maxComputationTimeMs: 3000 }, 'advanced'),
|
|
231
|
-
timeout(fast ? 50 : 800)
|
|
232
|
-
]);
|
|
233
|
-
if (this.doc.getVersionId() === docVersionNow && this.docSnapshot.getVersionId() === snapshotVersionNow) {
|
|
234
|
-
const diff2 = diff ?? nullDocumentDiff;
|
|
235
|
-
this._diffInfo.set(diff2, undefined);
|
|
236
|
-
this._edit = fromDiff(this.docSnapshot, this.doc, diff2);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
async accept(transaction) {
|
|
240
|
-
if (this._stateObs.get() !== 0 ) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
this.docSnapshot.setValue(this.doc.createSnapshot());
|
|
244
|
-
this._stateObs.set(1 , transaction);
|
|
245
|
-
await this.collapse(transaction);
|
|
246
|
-
this._notifyAction('accepted');
|
|
247
|
-
}
|
|
248
|
-
async reject(transaction) {
|
|
249
|
-
if (this._stateObs.get() !== 0 ) {
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
this._stateObs.set(2 , transaction);
|
|
253
|
-
this._notifyAction('rejected');
|
|
254
|
-
if (this.createdInRequestId === this._telemetryInfo.requestId) {
|
|
255
|
-
await this._fileService.del(this.resource);
|
|
256
|
-
this._onDidDelete.fire();
|
|
257
|
-
this.dispose();
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
this._setDocValue(this.docSnapshot.getValue());
|
|
261
|
-
await this.collapse(transaction);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
_setDocValue(value) {
|
|
265
|
-
this.doc.pushStackElement();
|
|
266
|
-
const edit = EditOperation.replace(this.doc.getFullModelRange(), value);
|
|
267
|
-
this._applyEdits([edit]);
|
|
268
|
-
this.doc.pushStackElement();
|
|
269
|
-
}
|
|
270
|
-
async collapse(transaction) {
|
|
271
|
-
this._multiDiffEntryDelegate.collapse(transaction);
|
|
272
|
-
}
|
|
273
|
-
_notifyAction(outcome) {
|
|
274
|
-
this._chatService.notifyUserAction({
|
|
275
|
-
action: { kind: 'chatEditingSessionAction', uri: this.resource, hasRemainingEdits: false, outcome },
|
|
276
|
-
agentId: this._telemetryInfo.agentId,
|
|
277
|
-
command: this._telemetryInfo.command,
|
|
278
|
-
sessionId: this._telemetryInfo.sessionId,
|
|
279
|
-
requestId: this._telemetryInfo.requestId,
|
|
280
|
-
result: this._telemetryInfo.result
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
ChatEditingModifiedFileEntry = ChatEditingModifiedFileEntry_1 = ( (__decorate([
|
|
285
|
-
( (__param(5, IModelService))),
|
|
286
|
-
( (__param(6, ITextModelService))),
|
|
287
|
-
( (__param(7, ILanguageService))),
|
|
288
|
-
( (__param(8, IBulkEditService))),
|
|
289
|
-
( (__param(9, IChatService))),
|
|
290
|
-
( (__param(10, IEditorWorkerService))),
|
|
291
|
-
( (__param(11, IUndoRedoService))),
|
|
292
|
-
( (__param(12, IFileService)))
|
|
293
|
-
], ChatEditingModifiedFileEntry)));
|
|
294
|
-
function toEditOperations(offsetEdit, doc) {
|
|
295
|
-
const edits = [];
|
|
296
|
-
for (const singleEdit of offsetEdit.edits) {
|
|
297
|
-
const range = Range.fromPositions(doc.getPositionAt(singleEdit.replaceRange.start), doc.getPositionAt(singleEdit.replaceRange.start + singleEdit.replaceRange.length));
|
|
298
|
-
edits.push(EditOperation.replace(range, singleEdit.newText));
|
|
299
|
-
}
|
|
300
|
-
return edits;
|
|
301
|
-
}
|
|
302
|
-
function fromContentChange(contentChanges) {
|
|
303
|
-
const editsArr = ( (contentChanges.map(
|
|
304
|
-
c => ( (new SingleOffsetEdit(OffsetRange.ofStartAndLength(c.rangeOffset, c.rangeLength), c.text)))
|
|
305
|
-
)));
|
|
306
|
-
editsArr.reverse();
|
|
307
|
-
const edits = ( (new OffsetEdit(editsArr)));
|
|
308
|
-
return edits;
|
|
309
|
-
}
|
|
310
|
-
function fromDiff(original, modified, diff) {
|
|
311
|
-
const edits = [];
|
|
312
|
-
for (const c of diff.changes) {
|
|
313
|
-
for (const i of c.innerChanges ?? []) {
|
|
314
|
-
const newText = modified.getValueInRange(i.modifiedRange);
|
|
315
|
-
const startOrig = original.getOffsetAt(i.originalRange.getStartPosition());
|
|
316
|
-
const endExOrig = original.getOffsetAt(i.originalRange.getEndPosition());
|
|
317
|
-
const origRange = ( (new OffsetRange(startOrig, endExOrig)));
|
|
318
|
-
edits.push(( (new SingleOffsetEdit(origRange, newText))));
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
return (
|
|
322
|
-
(new OffsetEdit(edits))
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
export { ChatEditingModifiedFileEntry };
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
3
|
-
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
4
|
-
|
|
5
|
-
var ChatEditingTextModelContentProvider_1, ChatEditingSnapshotTextModelContentProvider_1;
|
|
6
|
-
let ChatEditingTextModelContentProvider = class ChatEditingTextModelContentProvider {
|
|
7
|
-
static { ChatEditingTextModelContentProvider_1 = this; }
|
|
8
|
-
static { this.scheme = 'chat-editing-text-model'; }
|
|
9
|
-
static getEmptyFileURI() {
|
|
10
|
-
return ( URI.from({
|
|
11
|
-
scheme: ChatEditingTextModelContentProvider_1.scheme,
|
|
12
|
-
query: JSON.stringify({ kind: 'empty' }),
|
|
13
|
-
}));
|
|
14
|
-
}
|
|
15
|
-
static getFileURI(documentId, path) {
|
|
16
|
-
return ( URI.from({
|
|
17
|
-
scheme: ChatEditingTextModelContentProvider_1.scheme,
|
|
18
|
-
path,
|
|
19
|
-
query: JSON.stringify({ kind: 'doc', documentId }),
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
|
-
constructor(_currentSessionObs, _modelService) {
|
|
23
|
-
this._currentSessionObs = _currentSessionObs;
|
|
24
|
-
this._modelService = _modelService;
|
|
25
|
-
}
|
|
26
|
-
async provideTextContent(resource) {
|
|
27
|
-
const existing = this._modelService.getModel(resource);
|
|
28
|
-
if (existing && !existing.isDisposed()) {
|
|
29
|
-
return existing;
|
|
30
|
-
}
|
|
31
|
-
const data = JSON.parse(resource.query);
|
|
32
|
-
if (data.kind === 'empty') {
|
|
33
|
-
return this._modelService.createModel('', null, resource, false);
|
|
34
|
-
}
|
|
35
|
-
const session = this._currentSessionObs.get();
|
|
36
|
-
if (!session) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
return session.getVirtualModel(data.documentId);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
ChatEditingTextModelContentProvider = ChatEditingTextModelContentProvider_1 = ( __decorate([
|
|
43
|
-
( __param(1, IModelService))
|
|
44
|
-
], ChatEditingTextModelContentProvider));
|
|
45
|
-
let ChatEditingSnapshotTextModelContentProvider = class ChatEditingSnapshotTextModelContentProvider {
|
|
46
|
-
static { ChatEditingSnapshotTextModelContentProvider_1 = this; }
|
|
47
|
-
static { this.scheme = 'chat-editing-snapshot-text-model'; }
|
|
48
|
-
static getSnapshotFileURI(requestId, path) {
|
|
49
|
-
return ( URI.from({
|
|
50
|
-
scheme: ChatEditingSnapshotTextModelContentProvider_1.scheme,
|
|
51
|
-
path,
|
|
52
|
-
query: JSON.stringify({ requestId: requestId ?? '' }),
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
constructor(_currentSessionObs, _modelService) {
|
|
56
|
-
this._currentSessionObs = _currentSessionObs;
|
|
57
|
-
this._modelService = _modelService;
|
|
58
|
-
}
|
|
59
|
-
async provideTextContent(resource) {
|
|
60
|
-
const existing = this._modelService.getModel(resource);
|
|
61
|
-
if (existing && !existing.isDisposed()) {
|
|
62
|
-
return existing;
|
|
63
|
-
}
|
|
64
|
-
const data = JSON.parse(resource.query);
|
|
65
|
-
const session = this._currentSessionObs.get();
|
|
66
|
-
if (!session || !data.requestId) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
return session.getSnapshotModel(data.requestId, resource);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
ChatEditingSnapshotTextModelContentProvider = ChatEditingSnapshotTextModelContentProvider_1 = ( __decorate([
|
|
73
|
-
( __param(1, IModelService))
|
|
74
|
-
], ChatEditingSnapshotTextModelContentProvider));
|
|
75
|
-
|
|
76
|
-
export { ChatEditingSnapshotTextModelContentProvider, ChatEditingTextModelContentProvider };
|