@codingame/monaco-vscode-bulk-edit-service-override 25.1.2 → 26.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.
@@ -17,9 +17,11 @@ class Noop {
17
17
  constructor() {
18
18
  this.uris = [];
19
19
  }
20
- async perform() { return this; }
20
+ async perform() {
21
+ return this;
22
+ }
21
23
  toString() {
22
- return '(noop)';
24
+ return "(noop)";
23
25
  }
24
26
  }
25
27
  class RenameEdit {
@@ -27,7 +29,7 @@ class RenameEdit {
27
29
  this.newUri = newUri;
28
30
  this.oldUri = oldUri;
29
31
  this.options = options;
30
- this.type = 'rename';
32
+ this.type = "rename";
31
33
  }
32
34
  }
33
35
  let RenameOperation = RenameOperation_1 = class RenameOperation {
@@ -47,7 +49,10 @@ let RenameOperation = RenameOperation_1 = class RenameOperation {
47
49
  const skip = edit.options.overwrite === undefined && edit.options.ignoreIfExists && (await this._fileService.exists(edit.newUri));
48
50
  if (!skip) {
49
51
  moves.push({
50
- file: { source: edit.oldUri, target: edit.newUri },
52
+ file: {
53
+ source: edit.oldUri,
54
+ target: edit.newUri
55
+ },
51
56
  overwrite: edit.options.overwrite
52
57
  });
53
58
  undoes.push(( new RenameEdit(edit.oldUri, edit.newUri, edit.options)));
@@ -57,31 +62,31 @@ let RenameOperation = RenameOperation_1 = class RenameOperation {
57
62
  return ( new Noop());
58
63
  }
59
64
  await this._workingCopyFileService.move(moves, token, this._undoRedoInfo);
60
- return ( new RenameOperation_1(
61
- undoes,
62
- { isUndoing: true },
63
- this._workingCopyFileService,
64
- this._fileService
65
- ));
65
+ return ( new RenameOperation_1(undoes, {
66
+ isUndoing: true
67
+ }, this._workingCopyFileService, this._fileService));
66
68
  }
67
69
  toString() {
68
- return `(rename ${( this._edits.map(edit => `${edit.oldUri} to ${edit.newUri}`)).join(', ')})`;
70
+ return `(rename ${( this._edits.map(edit => `${edit.oldUri} to ${edit.newUri}`)).join(", ")})`;
69
71
  }
70
72
  };
71
- RenameOperation = RenameOperation_1 = ( __decorate([
72
- ( __param(2, IWorkingCopyFileService)),
73
- ( __param(3, IFileService))
74
- ], RenameOperation));
73
+ RenameOperation = RenameOperation_1 = ( __decorate([( __param(2, IWorkingCopyFileService)), ( __param(3, IFileService))], RenameOperation));
75
74
  class CopyEdit {
76
75
  constructor(newUri, oldUri, options) {
77
76
  this.newUri = newUri;
78
77
  this.oldUri = oldUri;
79
78
  this.options = options;
80
- this.type = 'copy';
79
+ this.type = "copy";
81
80
  }
82
81
  }
83
82
  let CopyOperation = class CopyOperation {
84
- constructor(_edits, _undoRedoInfo, _workingCopyFileService, _fileService, _instaService) {
83
+ constructor(
84
+ _edits,
85
+ _undoRedoInfo,
86
+ _workingCopyFileService,
87
+ _fileService,
88
+ _instaService
89
+ ) {
85
90
  this._edits = _edits;
86
91
  this._undoRedoInfo = _undoRedoInfo;
87
92
  this._workingCopyFileService = _workingCopyFileService;
@@ -96,7 +101,13 @@ let CopyOperation = class CopyOperation {
96
101
  for (const edit of this._edits) {
97
102
  const skip = edit.options.overwrite === undefined && edit.options.ignoreIfExists && (await this._fileService.exists(edit.newUri));
98
103
  if (!skip) {
99
- copies.push({ file: { source: edit.oldUri, target: edit.newUri }, overwrite: edit.options.overwrite });
104
+ copies.push({
105
+ file: {
106
+ source: edit.oldUri,
107
+ target: edit.newUri
108
+ },
109
+ overwrite: edit.options.overwrite
110
+ });
100
111
  }
101
112
  }
102
113
  if (copies.length === 0) {
@@ -107,33 +118,38 @@ let CopyOperation = class CopyOperation {
107
118
  for (let i = 0; i < stats.length; i++) {
108
119
  const stat = stats[i];
109
120
  const edit = this._edits[i];
110
- undoes.push(( new DeleteEdit(
111
- stat.resource,
112
- { recursive: true, folder: this._edits[i].options.folder || stat.isDirectory, ...edit.options },
113
- false
114
- )));
121
+ undoes.push(( new DeleteEdit(stat.resource, {
122
+ recursive: true,
123
+ folder: this._edits[i].options.folder || stat.isDirectory,
124
+ ...edit.options
125
+ }, false)));
115
126
  }
116
- return this._instaService.createInstance(DeleteOperation, undoes, { isUndoing: true });
127
+ return this._instaService.createInstance(DeleteOperation, undoes, {
128
+ isUndoing: true
129
+ });
117
130
  }
118
131
  toString() {
119
- return `(copy ${( this._edits.map(edit => `${edit.oldUri} to ${edit.newUri}`)).join(', ')})`;
132
+ return `(copy ${( this._edits.map(edit => `${edit.oldUri} to ${edit.newUri}`)).join(", ")})`;
120
133
  }
121
134
  };
122
- CopyOperation = ( __decorate([
123
- ( __param(2, IWorkingCopyFileService)),
124
- ( __param(3, IFileService)),
125
- ( __param(4, IInstantiationService))
126
- ], CopyOperation));
135
+ CopyOperation = ( __decorate([( __param(2, IWorkingCopyFileService)), ( __param(3, IFileService)), ( __param(4, IInstantiationService))], CopyOperation));
127
136
  class CreateEdit {
128
137
  constructor(newUri, options, contents) {
129
138
  this.newUri = newUri;
130
139
  this.options = options;
131
140
  this.contents = contents;
132
- this.type = 'create';
141
+ this.type = "create";
133
142
  }
134
143
  }
135
144
  let CreateOperation = class CreateOperation {
136
- constructor(_edits, _undoRedoInfo, _fileService, _workingCopyFileService, _instaService, _textFileService) {
145
+ constructor(
146
+ _edits,
147
+ _undoRedoInfo,
148
+ _fileService,
149
+ _workingCopyFileService,
150
+ _instaService,
151
+ _textFileService
152
+ ) {
137
153
  this._edits = _edits;
138
154
  this._undoRedoInfo = _undoRedoInfo;
139
155
  this._fileService = _fileService;
@@ -156,11 +172,16 @@ let CreateOperation = class CreateOperation {
156
172
  continue;
157
173
  }
158
174
  if (edit.options.folder) {
159
- folderCreates.push({ resource: edit.newUri });
160
- }
161
- else {
162
- const encodedReadable = typeof edit.contents !== 'undefined' ? edit.contents : await this._textFileService.getEncodedReadable(edit.newUri);
163
- fileCreates.push({ resource: edit.newUri, contents: encodedReadable, overwrite: edit.options.overwrite });
175
+ folderCreates.push({
176
+ resource: edit.newUri
177
+ });
178
+ } else {
179
+ const encodedReadable = typeof edit.contents !== "undefined" ? edit.contents : await this._textFileService.getEncodedReadable(edit.newUri);
180
+ fileCreates.push({
181
+ resource: edit.newUri,
182
+ contents: encodedReadable,
183
+ overwrite: edit.options.overwrite
184
+ });
164
185
  }
165
186
  undoes.push(( new DeleteEdit(edit.newUri, edit.options, !edit.options.folder && !edit.contents)));
166
187
  }
@@ -169,30 +190,35 @@ let CreateOperation = class CreateOperation {
169
190
  }
170
191
  await this._workingCopyFileService.createFolder(folderCreates, token, this._undoRedoInfo);
171
192
  await this._workingCopyFileService.create(fileCreates, token, this._undoRedoInfo);
172
- return this._instaService.createInstance(DeleteOperation, undoes, { isUndoing: true });
193
+ return this._instaService.createInstance(DeleteOperation, undoes, {
194
+ isUndoing: true
195
+ });
173
196
  }
174
197
  toString() {
175
198
  return `(create ${( this._edits.map(
176
- edit => edit.options.folder ? `folder ${edit.newUri}` : `file ${edit.newUri} with ${edit.contents?.byteLength || 0} bytes`
177
- )).join(', ')})`;
199
+ edit => edit.options.folder ? `folder ${edit.newUri}` : `file ${edit.newUri} with ${edit.contents?.byteLength || 0} bytes`
200
+ )).join(", ")})`;
178
201
  }
179
202
  };
180
- CreateOperation = ( __decorate([
181
- ( __param(2, IFileService)),
182
- ( __param(3, IWorkingCopyFileService)),
183
- ( __param(4, IInstantiationService)),
184
- ( __param(5, ITextFileService))
185
- ], CreateOperation));
203
+ CreateOperation = ( __decorate([( __param(2, IFileService)), ( __param(3, IWorkingCopyFileService)), ( __param(4, IInstantiationService)), ( __param(5, ITextFileService))], CreateOperation));
186
204
  class DeleteEdit {
187
205
  constructor(oldUri, options, undoesCreate) {
188
206
  this.oldUri = oldUri;
189
207
  this.options = options;
190
208
  this.undoesCreate = undoesCreate;
191
- this.type = 'delete';
209
+ this.type = "delete";
192
210
  }
193
211
  }
194
212
  let DeleteOperation = class DeleteOperation {
195
- constructor(_edits, _undoRedoInfo, _workingCopyFileService, _fileService, _configurationService, _instaService, _logService) {
213
+ constructor(
214
+ _edits,
215
+ _undoRedoInfo,
216
+ _workingCopyFileService,
217
+ _fileService,
218
+ _configurationService,
219
+ _instaService,
220
+ _logService
221
+ ) {
196
222
  this._edits = _edits;
197
223
  this._undoRedoInfo = _undoRedoInfo;
198
224
  this._workingCopyFileService = _workingCopyFileService;
@@ -210,9 +236,10 @@ let DeleteOperation = class DeleteOperation {
210
236
  for (const edit of this._edits) {
211
237
  let fileStat;
212
238
  try {
213
- fileStat = await this._fileService.resolve(edit.oldUri, { resolveMetadata: true });
214
- }
215
- catch (err) {
239
+ fileStat = await this._fileService.resolve(edit.oldUri, {
240
+ resolveMetadata: true
241
+ });
242
+ } catch (err) {
216
243
  if (!edit.options.ignoreIfNotExists) {
217
244
  throw ( new Error(`${edit.oldUri} does not exist and can not be deleted`));
218
245
  }
@@ -221,17 +248,16 @@ let DeleteOperation = class DeleteOperation {
221
248
  deletes.push({
222
249
  resource: edit.oldUri,
223
250
  recursive: edit.options.recursive,
224
- useTrash: !edit.options.skipTrashBin && this._fileService.hasCapability(edit.oldUri, FileSystemProviderCapabilities.Trash) && this._configurationService.getValue('files.enableTrash')
251
+ useTrash: !edit.options.skipTrashBin && this._fileService.hasCapability(edit.oldUri, FileSystemProviderCapabilities.Trash) && this._configurationService.getValue("files.enableTrash")
225
252
  });
226
253
  let fileContent;
227
254
  let fileContentExceedsMaxSize = false;
228
255
  if (!edit.undoesCreate && !edit.options.folder) {
229
- fileContentExceedsMaxSize = typeof edit.options.maxSize === 'number' && fileStat.size > edit.options.maxSize;
256
+ fileContentExceedsMaxSize = typeof edit.options.maxSize === "number" && fileStat.size > edit.options.maxSize;
230
257
  if (!fileContentExceedsMaxSize) {
231
258
  try {
232
259
  fileContent = await this._fileService.readFile(edit.oldUri);
233
- }
234
- catch (err) {
260
+ } catch (err) {
235
261
  this._logService.error(err);
236
262
  }
237
263
  }
@@ -247,19 +273,15 @@ let DeleteOperation = class DeleteOperation {
247
273
  if (undoes.length === 0) {
248
274
  return ( new Noop());
249
275
  }
250
- return this._instaService.createInstance(CreateOperation, undoes, { isUndoing: true });
276
+ return this._instaService.createInstance(CreateOperation, undoes, {
277
+ isUndoing: true
278
+ });
251
279
  }
252
280
  toString() {
253
- return `(delete ${( this._edits.map(edit => edit.oldUri)).join(', ')})`;
281
+ return `(delete ${( this._edits.map(edit => edit.oldUri)).join(", ")})`;
254
282
  }
255
283
  };
256
- DeleteOperation = ( __decorate([
257
- ( __param(2, IWorkingCopyFileService)),
258
- ( __param(3, IFileService)),
259
- ( __param(4, IConfigurationService)),
260
- ( __param(5, IInstantiationService)),
261
- ( __param(6, ILogService))
262
- ], DeleteOperation));
284
+ DeleteOperation = ( __decorate([( __param(2, IWorkingCopyFileService)), ( __param(3, IFileService)), ( __param(4, IConfigurationService)), ( __param(5, IInstantiationService)), ( __param(6, ILogService))], DeleteOperation));
263
285
  class FileUndoRedoElement {
264
286
  constructor(label, code, operations, confirmBeforeUndo) {
265
287
  this.label = label;
@@ -283,11 +305,22 @@ class FileUndoRedoElement {
283
305
  }
284
306
  }
285
307
  toString() {
286
- return ( this.operations.map(op => String(op))).join(', ');
308
+ return ( this.operations.map(op => String(op))).join(", ");
287
309
  }
288
310
  }
289
311
  let BulkFileEdits = class BulkFileEdits {
290
- constructor(_label, _code, _undoRedoGroup, _undoRedoSource, _confirmBeforeUndo, _progress, _token, _edits, _instaService, _undoRedoService) {
312
+ constructor(
313
+ _label,
314
+ _code,
315
+ _undoRedoGroup,
316
+ _undoRedoSource,
317
+ _confirmBeforeUndo,
318
+ _progress,
319
+ _token,
320
+ _edits,
321
+ _instaService,
322
+ _undoRedoService
323
+ ) {
291
324
  this._label = _label;
292
325
  this._code = _code;
293
326
  this._undoRedoGroup = _undoRedoGroup;
@@ -301,19 +334,18 @@ let BulkFileEdits = class BulkFileEdits {
301
334
  }
302
335
  async apply() {
303
336
  const undoOperations = [];
304
- const undoRedoInfo = { undoRedoGroupId: this._undoRedoGroup.id };
337
+ const undoRedoInfo = {
338
+ undoRedoGroupId: this._undoRedoGroup.id
339
+ };
305
340
  const edits = [];
306
341
  for (const edit of this._edits) {
307
342
  if (edit.newResource && edit.oldResource && !edit.options?.copy) {
308
343
  edits.push(( new RenameEdit(edit.newResource, edit.oldResource, edit.options ?? {})));
309
- }
310
- else if (edit.newResource && edit.oldResource && edit.options?.copy) {
344
+ } else if (edit.newResource && edit.oldResource && edit.options?.copy) {
311
345
  edits.push(( new CopyEdit(edit.newResource, edit.oldResource, edit.options ?? {})));
312
- }
313
- else if (!edit.newResource && edit.oldResource) {
346
+ } else if (!edit.newResource && edit.oldResource) {
314
347
  edits.push(( new DeleteEdit(edit.oldResource, edit.options ?? {}, false)));
315
- }
316
- else if (edit.newResource && !edit.oldResource) {
348
+ } else if (edit.newResource && !edit.oldResource) {
317
349
  edits.push(( new CreateEdit(edit.newResource, edit.options ?? {}, await edit.options.contents)));
318
350
  }
319
351
  }
@@ -327,8 +359,7 @@ let BulkFileEdits = class BulkFileEdits {
327
359
  const lastGroup = groups.at(-1);
328
360
  if (lastGroup?.[0].type === edit.type) {
329
361
  lastGroup.push(edit);
330
- }
331
- else {
362
+ } else {
332
363
  groups.push([edit]);
333
364
  }
334
365
  }
@@ -338,18 +369,18 @@ let BulkFileEdits = class BulkFileEdits {
338
369
  }
339
370
  let op;
340
371
  switch (group[0].type) {
341
- case 'rename':
342
- op = this._instaService.createInstance(RenameOperation, group, undoRedoInfo);
343
- break;
344
- case 'copy':
345
- op = this._instaService.createInstance(CopyOperation, group, undoRedoInfo);
346
- break;
347
- case 'delete':
348
- op = this._instaService.createInstance(DeleteOperation, group, undoRedoInfo);
349
- break;
350
- case 'create':
351
- op = this._instaService.createInstance(CreateOperation, group, undoRedoInfo);
352
- break;
372
+ case "rename":
373
+ op = this._instaService.createInstance(RenameOperation, group, undoRedoInfo);
374
+ break;
375
+ case "copy":
376
+ op = this._instaService.createInstance(CopyOperation, group, undoRedoInfo);
377
+ break;
378
+ case "delete":
379
+ op = this._instaService.createInstance(DeleteOperation, group, undoRedoInfo);
380
+ break;
381
+ case "create":
382
+ op = this._instaService.createInstance(CreateOperation, group, undoRedoInfo);
383
+ break;
353
384
  }
354
385
  if (op) {
355
386
  const undoOp = await op.perform(this._token);
@@ -362,9 +393,6 @@ let BulkFileEdits = class BulkFileEdits {
362
393
  return undoRedoElement.resources;
363
394
  }
364
395
  };
365
- BulkFileEdits = ( __decorate([
366
- ( __param(8, IInstantiationService)),
367
- ( __param(9, IUndoRedoService))
368
- ], BulkFileEdits));
396
+ BulkFileEdits = ( __decorate([( __param(8, IInstantiationService)), ( __param(9, IUndoRedoService))], BulkFileEdits));
369
397
 
370
398
  export { BulkFileEdits };
@@ -33,8 +33,10 @@ class ModelEditTask {
33
33
  }
34
34
  addEdit(resourceEdit) {
35
35
  this._expectedModelVersionId = resourceEdit.versionId;
36
- const { textEdit } = resourceEdit;
37
- if (typeof textEdit.eol === 'number') {
36
+ const {
37
+ textEdit
38
+ } = resourceEdit;
39
+ if (typeof textEdit.eol === "number") {
38
40
  this._newEol = textEdit.eol;
39
41
  }
40
42
  if (!textEdit.range && !textEdit.text) {
@@ -46,17 +48,25 @@ class ModelEditTask {
46
48
  let range;
47
49
  if (!textEdit.range) {
48
50
  range = this.model.getFullModelRange();
49
- }
50
- else {
51
+ } else {
51
52
  range = Range.lift(textEdit.range);
52
53
  }
53
- this._edits.push({ ...EditOperation.replaceMove(range, textEdit.text), insertAsSnippet: textEdit.insertAsSnippet, keepWhitespace: textEdit.keepWhitespace });
54
+ this._edits.push({
55
+ ...EditOperation.replaceMove(range, textEdit.text),
56
+ insertAsSnippet: textEdit.insertAsSnippet,
57
+ keepWhitespace: textEdit.keepWhitespace
58
+ });
54
59
  }
55
60
  validate() {
56
- if (typeof this._expectedModelVersionId === 'undefined' || this.model.getVersionId() === this._expectedModelVersionId) {
57
- return { canApply: true };
61
+ if (typeof this._expectedModelVersionId === "undefined" || this.model.getVersionId() === this._expectedModelVersionId) {
62
+ return {
63
+ canApply: true
64
+ };
58
65
  }
59
- return { canApply: false, reason: this.model.uri };
66
+ return {
67
+ canApply: false,
68
+ reason: this.model.uri
69
+ };
60
70
  }
61
71
  getBeforeCursorState() {
62
72
  return null;
@@ -64,9 +74,7 @@ class ModelEditTask {
64
74
  apply(reason) {
65
75
  if (this._edits.length > 0) {
66
76
  this._edits = (
67
- this._edits
68
- .map(this._transformSnippetStringToInsertText, this))
69
- .sort((a, b) => Range.compareRangesUsingStarts(a.range, b.range));
77
+ this._edits.map(this._transformSnippetStringToInsertText, this)).sort((a, b) => Range.compareRangesUsingStarts(a.range, b.range));
70
78
  this.model.pushEditOperations(null, this._edits, () => null, undefined, reason);
71
79
  }
72
80
  if (this._newEol !== undefined) {
@@ -81,7 +89,11 @@ class ModelEditTask {
81
89
  return edit;
82
90
  }
83
91
  const text = SnippetParser.asInsertText(edit.text);
84
- return { ...edit, insertAsSnippet: false, text };
92
+ return {
93
+ ...edit,
94
+ insertAsSnippet: false,
95
+ text
96
+ };
85
97
  }
86
98
  }
87
99
  class EditorEditTask extends ModelEditTask {
@@ -110,13 +122,13 @@ class EditorEditTask extends ModelEditTask {
110
122
  });
111
123
  }
112
124
  }
113
- snippetCtrl.apply(snippetEdits, { undoStopBefore: false, undoStopAfter: false });
114
- }
115
- else {
125
+ snippetCtrl.apply(snippetEdits, {
126
+ undoStopBefore: false,
127
+ undoStopAfter: false
128
+ });
129
+ } else {
116
130
  this._edits = (
117
- this._edits
118
- .map(this._transformSnippetStringToInsertText, this))
119
- .sort((a, b) => Range.compareRangesUsingStarts(a.range, b.range));
131
+ this._edits.map(this._transformSnippetStringToInsertText, this)).sort((a, b) => Range.compareRangesUsingStarts(a.range, b.range));
120
132
  this._editor.executeEdits(reason, this._edits);
121
133
  }
122
134
  }
@@ -131,7 +143,20 @@ class EditorEditTask extends ModelEditTask {
131
143
  }
132
144
  }
133
145
  let BulkTextEdits = class BulkTextEdits {
134
- constructor(_label, _code, _editor, _undoRedoGroup, _undoRedoSource, _progress, _token, edits, _editorWorker, _modelService, _textModelResolverService, _undoRedoService) {
146
+ constructor(
147
+ _label,
148
+ _code,
149
+ _editor,
150
+ _undoRedoGroup,
151
+ _undoRedoSource,
152
+ _progress,
153
+ _token,
154
+ edits,
155
+ _editorWorker,
156
+ _modelService,
157
+ _textModelResolverService,
158
+ _undoRedoService
159
+ ) {
135
160
  this._label = _label;
136
161
  this._code = _code;
137
162
  this._editor = _editor;
@@ -156,7 +181,7 @@ let BulkTextEdits = class BulkTextEdits {
156
181
  _validateBeforePrepare() {
157
182
  for (const array of ( this._edits.values())) {
158
183
  for (const edit of array) {
159
- if (typeof edit.versionId === 'number') {
184
+ if (typeof edit.versionId === "number") {
160
185
  const model = this._modelService.getModel(edit.resource);
161
186
  if (model && model.getVersionId() !== edit.versionId) {
162
187
  throw ( new Error(`${( model.uri.toString())} has changed in the meantime`));
@@ -169,14 +194,13 @@ let BulkTextEdits = class BulkTextEdits {
169
194
  const tasks = [];
170
195
  const promises = [];
171
196
  for (const [key, edits] of this._edits) {
172
- const promise = this._textModelResolverService.createModelReference(key).then(async (ref) => {
197
+ const promise = this._textModelResolverService.createModelReference(key).then(async ref => {
173
198
  let task;
174
199
  let makeMinimal = false;
175
200
  if (this._editor?.getModel()?.uri.toString() === ( ref.object.textEditorModel.uri.toString())) {
176
201
  task = ( new EditorEditTask(ref, this._editor));
177
202
  makeMinimal = true;
178
- }
179
- else {
203
+ } else {
180
204
  task = ( new ModelEditTask(ref));
181
205
  }
182
206
  tasks.push(task);
@@ -189,8 +213,7 @@ let BulkTextEdits = class BulkTextEdits {
189
213
  const newEdits = await this._editorWorker.computeMoreMinimalEdits(ref.object.textEditorModel.uri, ( oldEdits.map(e => e.textEdit)), false);
190
214
  if (!newEdits) {
191
215
  oldEdits.forEach(task.addEdit, task);
192
- }
193
- else {
216
+ } else {
194
217
  newEdits.forEach(edit => task.addEdit(( new ResourceTextEdit(ref.object.textEditorModel.uri, edit, undefined, undefined))));
195
218
  }
196
219
  };
@@ -217,7 +240,9 @@ let BulkTextEdits = class BulkTextEdits {
217
240
  return result;
218
241
  }
219
242
  }
220
- return { canApply: true };
243
+ return {
244
+ canApply: true
245
+ };
221
246
  }
222
247
  async apply(reason) {
223
248
  this._validateBeforePrepare();
@@ -241,8 +266,7 @@ let BulkTextEdits = class BulkTextEdits {
241
266
  resources.push(task.model.uri);
242
267
  }
243
268
  this._progress.report(undefined);
244
- }
245
- else {
269
+ } else {
246
270
  const multiModelEditStackElement = ( new MultiModelEditStackElement(this._label, this._code, ( tasks.map(t => ( new SingleModelEditStackElement(this._label, this._code, t.model, t.getBeforeCursorState()))))));
247
271
  this._undoRedoService.pushElement(multiModelEditStackElement, this._undoRedoGroup, this._undoRedoSource);
248
272
  for (const task of tasks) {
@@ -253,17 +277,11 @@ let BulkTextEdits = class BulkTextEdits {
253
277
  multiModelEditStackElement.close();
254
278
  }
255
279
  return resources;
256
- }
257
- finally {
280
+ } finally {
258
281
  dispose(tasks);
259
282
  }
260
283
  }
261
284
  };
262
- BulkTextEdits = ( __decorate([
263
- ( __param(8, IEditorWorkerService)),
264
- ( __param(9, IModelService)),
265
- ( __param(10, ITextModelService)),
266
- ( __param(11, IUndoRedoService))
267
- ], BulkTextEdits));
285
+ BulkTextEdits = ( __decorate([( __param(8, IEditorWorkerService)), ( __param(9, IModelService)), ( __param(10, ITextModelService)), ( __param(11, IUndoRedoService))], BulkTextEdits));
268
286
 
269
287
  export { BulkTextEdits };
@@ -19,27 +19,23 @@ let ConflictDetector = class ConflictDetector {
19
19
  for (const edit of edits) {
20
20
  if (edit instanceof ResourceTextEdit) {
21
21
  _workspaceEditResources.set(edit.resource, true);
22
- if (typeof edit.versionId === 'number') {
22
+ if (typeof edit.versionId === "number") {
23
23
  const model = modelService.getModel(edit.resource);
24
24
  if (model && model.getVersionId() !== edit.versionId) {
25
25
  this._conflicts.set(edit.resource, true);
26
26
  this._onDidConflict.fire(this);
27
27
  }
28
28
  }
29
- }
30
- else if (edit instanceof ResourceFileEdit) {
29
+ } else if (edit instanceof ResourceFileEdit) {
31
30
  if (edit.newResource) {
32
31
  _workspaceEditResources.set(edit.newResource, true);
33
- }
34
- else if (edit.oldResource) {
32
+ } else if (edit.oldResource) {
35
33
  _workspaceEditResources.set(edit.oldResource, true);
36
34
  }
37
- }
38
- else if (edit instanceof ResourceNotebookCellEdit) {
35
+ } else if (edit instanceof ResourceNotebookCellEdit) {
39
36
  _workspaceEditResources.set(edit.resource, true);
40
- }
41
- else {
42
- logService.warn('UNKNOWN edit type', edit);
37
+ } else {
38
+ logService.warn("UNKNOWN edit type", edit);
43
39
  }
44
40
  }
45
41
  this._disposables.add(fileService.onDidFilesChange(e => {
@@ -51,7 +47,7 @@ let ConflictDetector = class ConflictDetector {
51
47
  }
52
48
  }
53
49
  }));
54
- const onDidChangeModel = (model) => {
50
+ const onDidChangeModel = model => {
55
51
  if (( _workspaceEditResources.has(model.uri))) {
56
52
  this._conflicts.set(model.uri, true);
57
53
  this._onDidConflict.fire(this);
@@ -72,10 +68,6 @@ let ConflictDetector = class ConflictDetector {
72
68
  return this._conflicts.size > 0;
73
69
  }
74
70
  };
75
- ConflictDetector = ( __decorate([
76
- ( __param(1, IFileService)),
77
- ( __param(2, IModelService)),
78
- ( __param(3, ILogService))
79
- ], ConflictDetector));
71
+ ConflictDetector = ( __decorate([( __param(1, IFileService)), ( __param(2, IModelService)), ( __param(3, ILogService))], ConflictDetector));
80
72
 
81
73
  export { ConflictDetector };
@@ -9,17 +9,14 @@ class ResourceAttachmentEdit extends ResourceEdit {
9
9
  static is(candidate) {
10
10
  if (candidate instanceof ResourceAttachmentEdit) {
11
11
  return true;
12
- }
13
- else {
14
- return isObject(candidate)
15
- && (Boolean(candidate.undo && candidate.redo));
12
+ } else {
13
+ return isObject(candidate) && (Boolean(candidate.undo && candidate.redo));
16
14
  }
17
15
  }
18
16
  static lift(edit) {
19
17
  if (edit instanceof ResourceAttachmentEdit) {
20
18
  return edit;
21
- }
22
- else {
19
+ } else {
23
20
  return ( new ResourceAttachmentEdit(edit.resource, edit.undo, edit.redo, edit.metadata));
24
21
  }
25
22
  }
@@ -31,7 +28,14 @@ class ResourceAttachmentEdit extends ResourceEdit {
31
28
  }
32
29
  }
33
30
  let OpaqueEdits = class OpaqueEdits {
34
- constructor(_undoRedoGroup, _undoRedoSource, _progress, _token, _edits, _undoRedoService) {
31
+ constructor(
32
+ _undoRedoGroup,
33
+ _undoRedoSource,
34
+ _progress,
35
+ _token,
36
+ _edits,
37
+ _undoRedoService
38
+ ) {
35
39
  this._undoRedoGroup = _undoRedoGroup;
36
40
  this._undoRedoSource = _undoRedoSource;
37
41
  this._progress = _progress;
@@ -49,10 +53,10 @@ let OpaqueEdits = class OpaqueEdits {
49
53
  this._undoRedoService.pushElement({
50
54
  type: UndoRedoElementType.Resource,
51
55
  resource: edit.resource,
52
- label: edit.metadata?.label || 'Custom Edit',
53
- code: 'paste',
56
+ label: edit.metadata?.label || "Custom Edit",
57
+ code: "paste",
54
58
  undo: edit.undo,
55
- redo: edit.redo,
59
+ redo: edit.redo
56
60
  }, this._undoRedoGroup, this._undoRedoSource);
57
61
  this._progress.report(undefined);
58
62
  resources.push(edit.resource);
@@ -60,8 +64,6 @@ let OpaqueEdits = class OpaqueEdits {
60
64
  return resources;
61
65
  }
62
66
  };
63
- OpaqueEdits = ( __decorate([
64
- ( __param(5, IUndoRedoService))
65
- ], OpaqueEdits));
67
+ OpaqueEdits = ( __decorate([( __param(5, IUndoRedoService))], OpaqueEdits));
66
68
 
67
69
  export { OpaqueEdits, ResourceAttachmentEdit };