@codingame/monaco-vscode-extensions-service-override 1.85.0 → 1.85.1

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.
Files changed (55) hide show
  1. package/package.json +3 -3
  2. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +3 -3
  3. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +1 -1
  4. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +3 -3
  5. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +1 -1
  6. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +2 -2
  7. package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +3 -3
  8. package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +2 -2
  9. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +1 -1
  10. package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -3
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +0 -40
  12. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +0 -141
  13. package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +0 -37
  14. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +0 -342
  15. package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +0 -1197
  16. package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +0 -117
  17. package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +0 -83
  18. package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +0 -543
  19. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +0 -6
  20. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +0 -292
  21. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +0 -169
  22. package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +0 -6
  23. package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +0 -255
  24. package/vscode/src/vs/workbench/contrib/chat/common/chatRequestParser.js +0 -195
  25. package/vscode/src/vs/workbench/contrib/chat/common/chatViewModel.js +0 -260
  26. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +0 -5
  27. package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +0 -26
  28. package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +0 -63
  29. package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +0 -51
  30. package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +0 -649
  31. package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +0 -302
  32. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +0 -62
  33. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +0 -251
  34. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +0 -109
  35. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +0 -335
  36. package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +0 -6
  37. package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +0 -101
  38. package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +0 -57
  39. package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +0 -3
  40. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +0 -144
  41. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +0 -482
  42. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +0 -6
  43. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +0 -92
  44. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +0 -56
  45. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +0 -110
  46. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +0 -260
  47. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +0 -616
  48. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +0 -309
  49. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +0 -38
  50. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +0 -167
  51. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +0 -80
  52. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +0 -70
  53. package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +0 -3
  54. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +0 -108
  55. package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +0 -79
@@ -1,144 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { assertFn } from 'monaco-editor/esm/vs/base/common/assert.js';
3
- import { autorun } from 'monaco-editor/esm/vs/base/common/observable.js';
4
- import { isEqual } from 'monaco-editor/esm/vs/base/common/resources.js';
5
- import { isDefined } from 'monaco-editor/esm/vs/base/common/types.js';
6
- import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
7
- import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
8
- import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
9
- import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
10
- import { ILabelService } from 'monaco-editor/esm/vs/platform/label/common/label.js';
11
- import { DEFAULT_EDITOR_ASSOCIATION, isResourceMergeEditorInput } from 'vscode/vscode/vs/workbench/common/editor';
12
- import { AbstractTextResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor/textResourceEditorInput';
13
- import { TempFileMergeEditorModeFactory, WorkspaceMergeEditorModeFactory } from './mergeEditorInputModel.js';
14
- import { MergeEditorTelemetry } from './telemetry.js';
15
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
16
- import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
17
- import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles';
18
-
19
- var MergeEditorInput_1;
20
- let MergeEditorInput = class MergeEditorInput extends AbstractTextResourceEditorInput {
21
- static { MergeEditorInput_1 = this; }
22
- static { this.ID = 'mergeEditor.Input'; }
23
- get useWorkingCopy() {
24
- return this.configurationService.getValue('mergeEditor.useWorkingCopy') ?? false;
25
- }
26
- constructor(base, input1, input2, result, _instaService, editorService, textFileService, labelService, fileService, configurationService, filesConfigurationService) {
27
- super(result, undefined, editorService, textFileService, labelService, fileService, filesConfigurationService);
28
- this.base = base;
29
- this.input1 = input1;
30
- this.input2 = input2;
31
- this.result = result;
32
- this._instaService = _instaService;
33
- this.configurationService = configurationService;
34
- this.closeHandler = {
35
- showConfirm: () => this._inputModel?.shouldConfirmClose() ?? false,
36
- confirm: async (editors) => {
37
- assertFn(() => editors.every(e => e.editor instanceof MergeEditorInput_1));
38
- const inputModels = ( editors.map(e => e.editor._inputModel)).filter(isDefined);
39
- return await this._inputModel.confirmClose(inputModels);
40
- },
41
- };
42
- this.mergeEditorModeFactory = this._instaService.createInstance(this.useWorkingCopy
43
- ? TempFileMergeEditorModeFactory
44
- : WorkspaceMergeEditorModeFactory, this._instaService.createInstance(MergeEditorTelemetry));
45
- }
46
- dispose() {
47
- super.dispose();
48
- }
49
- get typeId() {
50
- return MergeEditorInput_1.ID;
51
- }
52
- get editorId() {
53
- return DEFAULT_EDITOR_ASSOCIATION.id;
54
- }
55
- get capabilities() {
56
- let capabilities = super.capabilities | 256 ;
57
- if (this.useWorkingCopy) {
58
- capabilities |= 4 ;
59
- }
60
- return capabilities;
61
- }
62
- getName() {
63
- return ( localizeWithPath(
64
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInput',
65
- 'name',
66
- "Merging: {0}",
67
- super.getName()
68
- ));
69
- }
70
- async resolve() {
71
- if (!this._inputModel) {
72
- const inputModel = this._register(await this.mergeEditorModeFactory.createInputModel({
73
- base: this.base,
74
- input1: this.input1,
75
- input2: this.input2,
76
- result: this.result,
77
- }));
78
- this._inputModel = inputModel;
79
- this._register(autorun(reader => {
80
- inputModel.isDirty.read(reader);
81
- this._onDidChangeDirty.fire();
82
- }));
83
- await this._inputModel.model.onInitialized;
84
- }
85
- return this._inputModel;
86
- }
87
- async accept() {
88
- await this._inputModel?.accept();
89
- }
90
- async save(group, options) {
91
- await this._inputModel?.save(options);
92
- return undefined;
93
- }
94
- toUntyped() {
95
- return {
96
- input1: { resource: this.input1.uri, label: this.input1.title, description: this.input1.description, detail: this.input1.detail },
97
- input2: { resource: this.input2.uri, label: this.input2.title, description: this.input2.description, detail: this.input2.detail },
98
- base: { resource: this.base },
99
- result: { resource: this.result },
100
- options: {
101
- override: this.typeId
102
- }
103
- };
104
- }
105
- matches(otherInput) {
106
- if (this === otherInput) {
107
- return true;
108
- }
109
- if (otherInput instanceof MergeEditorInput_1) {
110
- return isEqual(this.base, otherInput.base)
111
- && isEqual(this.input1.uri, otherInput.input1.uri)
112
- && isEqual(this.input2.uri, otherInput.input2.uri)
113
- && isEqual(this.result, otherInput.result);
114
- }
115
- if (isResourceMergeEditorInput(otherInput)) {
116
- return (this.editorId === otherInput.options?.override || otherInput.options?.override === undefined)
117
- && isEqual(this.base, otherInput.base.resource)
118
- && isEqual(this.input1.uri, otherInput.input1.resource)
119
- && isEqual(this.input2.uri, otherInput.input2.resource)
120
- && isEqual(this.result, otherInput.result.resource);
121
- }
122
- return false;
123
- }
124
- async revert(group, options) {
125
- return this._inputModel?.revert(options);
126
- }
127
- isDirty() {
128
- return this._inputModel?.isDirty.get() ?? false;
129
- }
130
- setLanguageId(languageId, source) {
131
- this._inputModel?.model.setLanguageId(languageId, source);
132
- }
133
- };
134
- MergeEditorInput = MergeEditorInput_1 = ( __decorate([
135
- ( __param(4, IInstantiationService)),
136
- ( __param(5, IEditorService)),
137
- ( __param(6, ITextFileService)),
138
- ( __param(7, ILabelService)),
139
- ( __param(8, IFileService)),
140
- ( __param(9, IConfigurationService)),
141
- ( __param(10, IFilesConfigurationService))
142
- ], MergeEditorInput));
143
-
144
- export { MergeEditorInput };
@@ -1,482 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { assertFn } from 'monaco-editor/esm/vs/base/common/assert.js';
3
- import { BugIndicatingError } from 'monaco-editor/esm/vs/base/common/errors.js';
4
- import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
5
- import { DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
6
- import { observableValue, observableFromEvent, derived } from 'monaco-editor/esm/vs/base/common/observable.js';
7
- import { basename, isEqual } from 'monaco-editor/esm/vs/base/common/resources.js';
8
- import Severity from 'monaco-editor/esm/vs/base/common/severity.js';
9
- import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
10
- import { ITextModelService } from 'monaco-editor/esm/vs/editor/common/services/resolverService.js';
11
- import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
12
- import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
13
- import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
14
- import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
15
- import { SaveSourceRegistry } from 'vscode/vscode/vs/workbench/common/editor';
16
- import { EditorModel } from 'vscode/vscode/vs/workbench/common/editor/editorModel';
17
- import { conflictMarkers } from './mergeMarkers/mergeMarkersController.js';
18
- import { MergeDiffComputer } from './model/diffComputer.js';
19
- import { MergeEditorModel } from './model/mergeEditorModel.js';
20
- import { StorageCloseWithConflicts } from '../common/mergeEditor.js';
21
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
22
- import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles';
23
- import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
24
-
25
- var WorkspaceMergeEditorModeFactory_1;
26
- let TempFileMergeEditorModeFactory = class TempFileMergeEditorModeFactory {
27
- constructor(_mergeEditorTelemetry, _instantiationService, _textModelService, _modelService) {
28
- this._mergeEditorTelemetry = _mergeEditorTelemetry;
29
- this._instantiationService = _instantiationService;
30
- this._textModelService = _textModelService;
31
- this._modelService = _modelService;
32
- }
33
- async createInputModel(args) {
34
- const store = ( new DisposableStore());
35
- const [base, result, input1Data, input2Data,] = await Promise.all([
36
- this._textModelService.createModelReference(args.base),
37
- this._textModelService.createModelReference(args.result),
38
- toInputData(args.input1, this._textModelService, store),
39
- toInputData(args.input2, this._textModelService, store),
40
- ]);
41
- store.add(base);
42
- store.add(result);
43
- const tempResultUri = result.object.textEditorModel.uri.with({ scheme: 'merge-result' });
44
- const temporaryResultModel = this._modelService.createModel('', {
45
- languageId: result.object.textEditorModel.getLanguageId(),
46
- onDidChange: Event.None,
47
- }, tempResultUri);
48
- store.add(temporaryResultModel);
49
- const mergeDiffComputer = this._instantiationService.createInstance(MergeDiffComputer);
50
- const model = this._instantiationService.createInstance(MergeEditorModel, base.object.textEditorModel, input1Data, input2Data, temporaryResultModel, mergeDiffComputer, {
51
- resetResult: true,
52
- }, this._mergeEditorTelemetry);
53
- store.add(model);
54
- await model.onInitialized;
55
- return this._instantiationService.createInstance(TempFileMergeEditorInputModel, model, store, result.object, args.result);
56
- }
57
- };
58
- TempFileMergeEditorModeFactory = ( __decorate([
59
- ( __param(1, IInstantiationService)),
60
- ( __param(2, ITextModelService)),
61
- ( __param(3, IModelService))
62
- ], TempFileMergeEditorModeFactory));
63
- let TempFileMergeEditorInputModel = class TempFileMergeEditorInputModel extends EditorModel {
64
- constructor(model, disposable, result, resultUri, textFileService, dialogService, editorService) {
65
- super();
66
- this.model = model;
67
- this.disposable = disposable;
68
- this.result = result;
69
- this.resultUri = resultUri;
70
- this.textFileService = textFileService;
71
- this.dialogService = dialogService;
72
- this.editorService = editorService;
73
- this.savedAltVersionId = observableValue(this, this.model.resultTextModel.getAlternativeVersionId());
74
- this.altVersionId = observableFromEvent(e => this.model.resultTextModel.onDidChangeContent(e), () =>
75
- this.model.resultTextModel.getAlternativeVersionId());
76
- this.isDirty = derived(this, (reader) => this.altVersionId.read(reader) !== this.savedAltVersionId.read(reader));
77
- this.finished = false;
78
- }
79
- dispose() {
80
- this.disposable.dispose();
81
- super.dispose();
82
- }
83
- async accept() {
84
- const value = await this.model.resultTextModel.getValue();
85
- this.result.textEditorModel.setValue(value);
86
- this.savedAltVersionId.set(this.model.resultTextModel.getAlternativeVersionId(), undefined);
87
- await this.textFileService.save(this.result.textEditorModel.uri);
88
- this.finished = true;
89
- }
90
- async _discard() {
91
- await this.textFileService.revert(this.model.resultTextModel.uri);
92
- this.savedAltVersionId.set(this.model.resultTextModel.getAlternativeVersionId(), undefined);
93
- this.finished = true;
94
- }
95
- shouldConfirmClose() {
96
- return true;
97
- }
98
- async confirmClose(inputModels) {
99
- assertFn(() => ( inputModels.some((m) => m === this)));
100
- const someDirty = ( inputModels.some((m) => m.isDirty.get()));
101
- let choice;
102
- if (someDirty) {
103
- const isMany = inputModels.length > 1;
104
- const message = isMany
105
- ? ( localizeWithPath(
106
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
107
- 'messageN',
108
- 'Do you want keep the merge result of {0} files?',
109
- inputModels.length
110
- ))
111
- : ( localizeWithPath(
112
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
113
- 'message1',
114
- 'Do you want keep the merge result of {0}?',
115
- basename(inputModels[0].model.resultTextModel.uri)
116
- ));
117
- const hasUnhandledConflicts = ( inputModels.some((m) => m.model.hasUnhandledConflicts.get()));
118
- const buttons = [
119
- {
120
- label: hasUnhandledConflicts ?
121
- ( localizeWithPath(
122
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
123
- { key: 'saveWithConflict', comment: ['&& denotes a mnemonic'] },
124
- "&&Save With Conflicts"
125
- )) :
126
- ( localizeWithPath(
127
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
128
- { key: 'save', comment: ['&& denotes a mnemonic'] },
129
- "&&Save"
130
- )),
131
- run: () => 0
132
- },
133
- {
134
- label: ( localizeWithPath(
135
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
136
- { key: 'discard', comment: ['&& denotes a mnemonic'] },
137
- "Do&&n't Save"
138
- )),
139
- run: () => 1
140
- }
141
- ];
142
- choice = (await this.dialogService.prompt({
143
- type: Severity.Info,
144
- message,
145
- detail: hasUnhandledConflicts
146
- ? isMany
147
- ? ( localizeWithPath(
148
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
149
- 'detailNConflicts',
150
- "The files contain unhandled conflicts. The merge results will be lost if you don't save them."
151
- ))
152
- : ( localizeWithPath(
153
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
154
- 'detail1Conflicts',
155
- "The file contains unhandled conflicts. The merge result will be lost if you don't save it."
156
- ))
157
- : isMany
158
- ? ( localizeWithPath(
159
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
160
- 'detailN',
161
- "The merge results will be lost if you don't save them."
162
- ))
163
- : ( localizeWithPath(
164
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
165
- 'detail1',
166
- "The merge result will be lost if you don't save it."
167
- )),
168
- buttons,
169
- cancelButton: {
170
- run: () => 2
171
- }
172
- })).result;
173
- }
174
- else {
175
- choice = 1 ;
176
- }
177
- if (choice === 0 ) {
178
- await Promise.all(( inputModels.map(m => m.accept())));
179
- }
180
- else if (choice === 1 ) {
181
- await Promise.all(( inputModels.map(m => m._discard())));
182
- }
183
- else ;
184
- return choice;
185
- }
186
- async save(options) {
187
- if (this.finished) {
188
- return;
189
- }
190
- (async () => {
191
- const { confirmed } = await this.dialogService.confirm({
192
- message: ( localizeWithPath(
193
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
194
- 'saveTempFile.message',
195
- "Do you want to accept the merge result?"
196
- )),
197
- detail: ( localizeWithPath(
198
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
199
- 'saveTempFile.detail',
200
- "This will write the merge result to the original file and close the merge editor."
201
- )),
202
- primaryButton: ( localizeWithPath(
203
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
204
- { key: 'acceptMerge', comment: ['&& denotes a mnemonic'] },
205
- '&&Accept Merge'
206
- ))
207
- });
208
- if (confirmed) {
209
- await this.accept();
210
- const editors = this.editorService.findEditors(this.resultUri).filter(e => e.editor.typeId === 'mergeEditor.Input');
211
- await this.editorService.closeEditors(editors);
212
- }
213
- })();
214
- }
215
- async revert(options) {
216
- }
217
- };
218
- TempFileMergeEditorInputModel = ( __decorate([
219
- ( __param(4, ITextFileService)),
220
- ( __param(5, IDialogService)),
221
- ( __param(6, IEditorService))
222
- ], TempFileMergeEditorInputModel));
223
- let WorkspaceMergeEditorModeFactory = class WorkspaceMergeEditorModeFactory {
224
- static { WorkspaceMergeEditorModeFactory_1 = this; }
225
- constructor(_mergeEditorTelemetry, _instantiationService, _textModelService, textFileService) {
226
- this._mergeEditorTelemetry = _mergeEditorTelemetry;
227
- this._instantiationService = _instantiationService;
228
- this._textModelService = _textModelService;
229
- this.textFileService = textFileService;
230
- }
231
- static { this.FILE_SAVED_SOURCE = SaveSourceRegistry.registerSource('merge-editor.source', ( localizeWithPath(
232
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
233
- 'merge-editor.source',
234
- "Before Resolving Conflicts In Merge Editor"
235
- ))); }
236
- async createInputModel(args) {
237
- const store = ( new DisposableStore());
238
- let resultTextFileModel = undefined;
239
- const modelListener = store.add(( new DisposableStore()));
240
- const handleDidCreate = (model) => {
241
- if (isEqual(args.result, model.resource)) {
242
- modelListener.clear();
243
- resultTextFileModel = model;
244
- }
245
- };
246
- modelListener.add(this.textFileService.files.onDidCreate(handleDidCreate));
247
- this.textFileService.files.models.forEach(handleDidCreate);
248
- const [base, result, input1Data, input2Data,] = await Promise.all([
249
- this._textModelService.createModelReference(args.base),
250
- this._textModelService.createModelReference(args.result),
251
- toInputData(args.input1, this._textModelService, store),
252
- toInputData(args.input2, this._textModelService, store),
253
- ]);
254
- store.add(base);
255
- store.add(result);
256
- if (!resultTextFileModel) {
257
- throw new BugIndicatingError();
258
- }
259
- await resultTextFileModel.save({ source: WorkspaceMergeEditorModeFactory_1.FILE_SAVED_SOURCE });
260
- const lines = resultTextFileModel.textEditorModel.getLinesContent();
261
- const hasConflictMarkers = ( lines.some(l => l.startsWith(conflictMarkers.start)));
262
- const resetResult = hasConflictMarkers;
263
- const mergeDiffComputer = this._instantiationService.createInstance(MergeDiffComputer);
264
- const model = this._instantiationService.createInstance(MergeEditorModel, base.object.textEditorModel, input1Data, input2Data, result.object.textEditorModel, mergeDiffComputer, {
265
- resetResult
266
- }, this._mergeEditorTelemetry);
267
- store.add(model);
268
- await model.onInitialized;
269
- return this._instantiationService.createInstance(WorkspaceMergeEditorInputModel, model, store, resultTextFileModel, this._mergeEditorTelemetry);
270
- }
271
- };
272
- WorkspaceMergeEditorModeFactory = WorkspaceMergeEditorModeFactory_1 = ( __decorate([
273
- ( __param(1, IInstantiationService)),
274
- ( __param(2, ITextModelService)),
275
- ( __param(3, ITextFileService))
276
- ], WorkspaceMergeEditorModeFactory));
277
- let WorkspaceMergeEditorInputModel = class WorkspaceMergeEditorInputModel extends EditorModel {
278
- constructor(model, disposableStore, resultTextFileModel, telemetry, _dialogService, _storageService) {
279
- super();
280
- this.model = model;
281
- this.disposableStore = disposableStore;
282
- this.resultTextFileModel = resultTextFileModel;
283
- this.telemetry = telemetry;
284
- this._dialogService = _dialogService;
285
- this._storageService = _storageService;
286
- this.isDirty = observableFromEvent(Event.any(this.resultTextFileModel.onDidChangeDirty, this.resultTextFileModel.onDidSaveError), () => this.resultTextFileModel.isDirty());
287
- this.reported = false;
288
- this.dateTimeOpened = ( new Date());
289
- }
290
- dispose() {
291
- this.disposableStore.dispose();
292
- super.dispose();
293
- this.reportClose(false);
294
- }
295
- reportClose(accepted) {
296
- if (!this.reported) {
297
- const remainingConflictCount = this.model.unhandledConflictsCount.get();
298
- const durationOpenedMs = ( new Date()).getTime() - this.dateTimeOpened.getTime();
299
- this.telemetry.reportMergeEditorClosed({
300
- durationOpenedSecs: durationOpenedMs / 1000,
301
- remainingConflictCount,
302
- accepted,
303
- conflictCount: this.model.conflictCount,
304
- combinableConflictCount: this.model.combinableConflictCount,
305
- conflictsResolvedWithBase: this.model.conflictsResolvedWithBase,
306
- conflictsResolvedWithInput1: this.model.conflictsResolvedWithInput1,
307
- conflictsResolvedWithInput2: this.model.conflictsResolvedWithInput2,
308
- conflictsResolvedWithSmartCombination: this.model.conflictsResolvedWithSmartCombination,
309
- manuallySolvedConflictCountThatEqualNone: this.model.manuallySolvedConflictCountThatEqualNone,
310
- manuallySolvedConflictCountThatEqualSmartCombine: this.model.manuallySolvedConflictCountThatEqualSmartCombine,
311
- manuallySolvedConflictCountThatEqualInput1: this.model.manuallySolvedConflictCountThatEqualInput1,
312
- manuallySolvedConflictCountThatEqualInput2: this.model.manuallySolvedConflictCountThatEqualInput2,
313
- manuallySolvedConflictCountThatEqualNoneAndStartedWithBase: this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBase,
314
- manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1: this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1,
315
- manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2: this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2,
316
- manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart: this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart,
317
- manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart: this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart,
318
- });
319
- this.reported = true;
320
- }
321
- }
322
- async accept() {
323
- this.reportClose(true);
324
- await this.resultTextFileModel.save();
325
- }
326
- get resultUri() {
327
- return this.resultTextFileModel.resource;
328
- }
329
- async save(options) {
330
- await this.resultTextFileModel.save(options);
331
- }
332
- async revert(options) {
333
- await this.resultTextFileModel.revert(options);
334
- }
335
- shouldConfirmClose() {
336
- return true;
337
- }
338
- async confirmClose(inputModels) {
339
- const isMany = inputModels.length > 1;
340
- const someDirty = ( inputModels.some(m => m.isDirty.get()));
341
- const someUnhandledConflicts = ( inputModels.some(m => m.model.hasUnhandledConflicts.get()));
342
- if (someDirty) {
343
- const message = isMany
344
- ? ( localizeWithPath(
345
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
346
- 'workspace.messageN',
347
- 'Do you want to save the changes you made to {0} files?',
348
- inputModels.length
349
- ))
350
- : ( localizeWithPath(
351
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
352
- 'workspace.message1',
353
- 'Do you want to save the changes you made to {0}?',
354
- basename(inputModels[0].resultUri)
355
- ));
356
- const { result } = await this._dialogService.prompt({
357
- type: Severity.Info,
358
- message,
359
- detail: someUnhandledConflicts ?
360
- isMany
361
- ? ( localizeWithPath(
362
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
363
- 'workspace.detailN.unhandled',
364
- "The files contain unhandled conflicts. Your changes will be lost if you don't save them."
365
- ))
366
- : ( localizeWithPath(
367
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
368
- 'workspace.detail1.unhandled',
369
- "The file contains unhandled conflicts. Your changes will be lost if you don't save them."
370
- ))
371
- : isMany
372
- ? ( localizeWithPath(
373
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
374
- 'workspace.detailN.handled',
375
- "Your changes will be lost if you don't save them."
376
- ))
377
- : ( localizeWithPath(
378
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
379
- 'workspace.detail1.handled',
380
- "Your changes will be lost if you don't save them."
381
- )),
382
- buttons: [
383
- {
384
- label: someUnhandledConflicts
385
- ? ( localizeWithPath(
386
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
387
- { key: 'workspace.saveWithConflict', comment: ['&& denotes a mnemonic'] },
388
- '&&Save with Conflicts'
389
- ))
390
- : ( localizeWithPath(
391
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
392
- { key: 'workspace.save', comment: ['&& denotes a mnemonic'] },
393
- '&&Save'
394
- )),
395
- run: () => 0
396
- },
397
- {
398
- label: ( localizeWithPath(
399
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
400
- { key: 'workspace.doNotSave', comment: ['&& denotes a mnemonic'] },
401
- "Do&&n't Save"
402
- )),
403
- run: () => 1
404
- }
405
- ],
406
- cancelButton: {
407
- run: () => 2
408
- }
409
- });
410
- return result;
411
- }
412
- else if (someUnhandledConflicts && !this._storageService.getBoolean(StorageCloseWithConflicts, 0 , false)) {
413
- const { confirmed, checkboxChecked } = await this._dialogService.confirm({
414
- message: isMany
415
- ? ( localizeWithPath(
416
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
417
- 'workspace.messageN.nonDirty',
418
- 'Do you want to close {0} merge editors?',
419
- inputModels.length
420
- ))
421
- : ( localizeWithPath(
422
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
423
- 'workspace.message1.nonDirty',
424
- 'Do you want to close the merge editor for {0}?',
425
- basename(inputModels[0].resultUri)
426
- )),
427
- detail: someUnhandledConflicts ?
428
- isMany
429
- ? ( localizeWithPath(
430
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
431
- 'workspace.detailN.unhandled.nonDirty',
432
- "The files contain unhandled conflicts."
433
- ))
434
- : ( localizeWithPath(
435
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
436
- 'workspace.detail1.unhandled.nonDirty',
437
- "The file contains unhandled conflicts."
438
- ))
439
- : undefined,
440
- primaryButton: someUnhandledConflicts
441
- ? ( localizeWithPath(
442
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
443
- { key: 'workspace.closeWithConflicts', comment: ['&& denotes a mnemonic'] },
444
- '&&Close with Conflicts'
445
- ))
446
- : ( localizeWithPath(
447
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
448
- { key: 'workspace.close', comment: ['&& denotes a mnemonic'] },
449
- '&&Close'
450
- )),
451
- checkbox: { label: ( localizeWithPath(
452
- 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
453
- 'noMoreWarn',
454
- "Don't ask again"
455
- )) }
456
- });
457
- if (checkboxChecked) {
458
- this._storageService.store(StorageCloseWithConflicts, true, 0 , 0 );
459
- }
460
- return confirmed ? 0 : 2 ;
461
- }
462
- else {
463
- return 0 ;
464
- }
465
- }
466
- };
467
- WorkspaceMergeEditorInputModel = ( __decorate([
468
- ( __param(4, IDialogService)),
469
- ( __param(5, IStorageService))
470
- ], WorkspaceMergeEditorInputModel));
471
- async function toInputData(data, textModelService, store) {
472
- const ref = await textModelService.createModelReference(data.uri);
473
- store.add(ref);
474
- return {
475
- textModel: ref.object.textEditorModel,
476
- title: data.title,
477
- description: data.description,
478
- detail: data.detail,
479
- };
480
- }
481
-
482
- export { TempFileMergeEditorModeFactory, WorkspaceMergeEditorModeFactory };
@@ -1,6 +0,0 @@
1
- const conflictMarkers = {
2
- start: '<<<<<<<',
3
- end: '>>>>>>>',
4
- };
5
-
6
- export { conflictMarkers };