@codingame/monaco-vscode-bulk-edit-service-override 37.2.0 → 37.3.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/common.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { type IEditorOverrideServices } from "@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices";
2
+ export default function getServiceOverride(): IEditorOverrideServices;
package/common.js ADDED
@@ -0,0 +1,13 @@
1
+
2
+ import '@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices';
3
+ import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
4
+ import { IBulkEditService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/bulkEditService.service';
5
+ import { BulkEditService } from './vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.js';
6
+
7
+ function getServiceOverride() {
8
+ return {
9
+ [IBulkEditService.toString()]: new SyncDescriptor(BulkEditService, [], true)
10
+ };
11
+ }
12
+
13
+ export { getServiceOverride as default };
package/index.d.ts CHANGED
@@ -1,2 +1 @@
1
- import { type IEditorOverrideServices } from "@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices";
2
- export default function getServiceOverride(): IEditorOverrideServices;
1
+ export { default } from "./common.js";
package/index.js CHANGED
@@ -1,14 +1,3 @@
1
1
 
2
- import '@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices';
3
- import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
4
- import { IBulkEditService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/bulkEditService.service';
5
- import { BulkEditService } from './vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.js';
6
- import './vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.js';
7
-
8
- function getServiceOverride() {
9
- return {
10
- [IBulkEditService.toString()]: new SyncDescriptor(BulkEditService, [], true)
11
- };
12
- }
13
-
14
- export { getServiceOverride as default };
2
+ export { default } from './common.js';
3
+ import '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-bulk-edit-service-override",
3
- "version": "37.2.0",
3
+ "version": "37.3.0",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - bulk-edit service-override",
6
6
  "keywords": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-api": "37.2.0"
18
+ "@codingame/monaco-vscode-api": "37.3.0"
19
19
  },
20
20
  "main": "index.js",
21
21
  "module": "index.js",
@@ -31,6 +31,14 @@
31
31
  "types": "./vscode/src/*.d.ts",
32
32
  "default": "./vscode/src/*.js"
33
33
  },
34
+ "./session": {
35
+ "types": "./session.d.ts",
36
+ "default": "./session.js"
37
+ },
38
+ "./common": {
39
+ "types": "./common.d.ts",
40
+ "default": "./common.js"
41
+ },
34
42
  "./*": {
35
43
  "types": "./*.d.ts",
36
44
  "default": "./*.js"
package/session.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { default } from "./common.js";
package/session.js ADDED
@@ -0,0 +1,2 @@
1
+
2
+ export { default } from './common.js';
@@ -28,7 +28,7 @@ import { ResourceAttachmentEdit, OpaqueEdits } from './opaqueEdits.js';
28
28
  import { isMacintosh } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
29
29
 
30
30
  function liftEdits(edits) {
31
- return ( edits.map(edit => {
31
+ return edits.map(edit => {
32
32
  if (ResourceTextEdit.is(edit)) {
33
33
  return ResourceTextEdit.lift(edit);
34
34
  }
@@ -42,7 +42,7 @@ function liftEdits(edits) {
42
42
  return ResourceAttachmentEdit.lift(edit);
43
43
  }
44
44
  throw ( new Error("Unsupported edit"));
45
- }));
45
+ });
46
46
  }
47
47
  let BulkEdit = class BulkEdit {
48
48
  constructor(
@@ -83,21 +83,21 @@ let BulkEdit = class BulkEdit {
83
83
  }
84
84
  }
85
85
  if (this._edits.length === 0) {
86
- return localize(5362, "Made no edits");
86
+ return localize(7334, "Made no edits");
87
87
  } else if (otherResources.size === 0) {
88
88
  if (textEditCount > 1 && textEditResources.size > 1) {
89
89
  return localize(
90
- 5363,
90
+ 7335,
91
91
  "Made {0} text edits in {1} files",
92
92
  textEditCount,
93
93
  textEditResources.size
94
94
  );
95
95
  } else {
96
- return localize(5364, "Made {0} text edits in one file", textEditCount);
96
+ return localize(7336, "Made {0} text edits in one file", textEditCount);
97
97
  }
98
98
  } else {
99
99
  return localize(
100
- 5365,
100
+ 7337,
101
101
  "Made {0} text edits in {1} files, also created or deleted {2} files",
102
102
  textEditCount,
103
103
  textEditResources.size,
@@ -163,12 +163,12 @@ let BulkEdit = class BulkEdit {
163
163
  }
164
164
  async _performFileEdits(edits, undoRedoGroup, undoRedoSource, confirmBeforeUndo, progress) {
165
165
  this._logService.debug("_performFileEdits", JSON.stringify(edits));
166
- const model = this._instaService.createInstance(BulkFileEdits, this._label || ( localize(5366, "Workspace Edit")), this._code || "undoredo.workspaceEdit", undoRedoGroup, undoRedoSource, confirmBeforeUndo, progress, this._token, edits);
166
+ const model = this._instaService.createInstance(BulkFileEdits, this._label || ( localize(7338, "Workspace Edit")), this._code || "undoredo.workspaceEdit", undoRedoGroup, undoRedoSource, confirmBeforeUndo, progress, this._token, edits);
167
167
  return await model.apply();
168
168
  }
169
169
  async _performTextEdits(edits, undoRedoGroup, undoRedoSource, progress, reason) {
170
170
  this._logService.debug("_performTextEdits", JSON.stringify(edits));
171
- const model = this._instaService.createInstance(BulkTextEdits, this._label || ( localize(5366, "Workspace Edit")), this._code || "undoredo.workspaceEdit", this._editor, undoRedoGroup, undoRedoSource, progress, this._token, edits);
171
+ const model = this._instaService.createInstance(BulkTextEdits, this._label || ( localize(7338, "Workspace Edit")), this._code || "undoredo.workspaceEdit", this._editor, undoRedoGroup, undoRedoSource, progress, this._token, edits);
172
172
  return await model.apply(reason);
173
173
  }
174
174
  async _performCellEdits(edits, undoRedoGroup, undoRedoSource, progress) {
@@ -217,7 +217,7 @@ let BulkEditService = class BulkEditService {
217
217
  let edits = liftEdits(Array.isArray(editsIn) ? editsIn : editsIn.edits);
218
218
  if (edits.length === 0) {
219
219
  return {
220
- ariaSummary: ( localize(5367, "Made no edits")),
220
+ ariaSummary: ( localize(7339, "Made no edits")),
221
221
  isApplied: false
222
222
  };
223
223
  }
@@ -284,11 +284,11 @@ let BulkEditService = class BulkEditService {
284
284
  }
285
285
  async _saveAll(resources) {
286
286
  const set = ( new ResourceSet(resources));
287
- const saves = ( this._workingCopyService.dirtyWorkingCopies.map(async copy => {
287
+ const saves = this._workingCopyService.dirtyWorkingCopies.map(async copy => {
288
288
  if (( set.has(copy.resource))) {
289
289
  await copy.save();
290
290
  }
291
- }));
291
+ });
292
292
  const result = await Promise.allSettled(saves);
293
293
  for (const item of result) {
294
294
  if (item.status === "rejected") {
@@ -300,24 +300,24 @@ let BulkEditService = class BulkEditService {
300
300
  let message;
301
301
  switch (reason) {
302
302
  case ShutdownReason.CLOSE:
303
- message = ( localize(5368, "Are you sure you want to close the window?"));
303
+ message = ( localize(7340, "Are you sure you want to close the window?"));
304
304
  break;
305
305
  case ShutdownReason.LOAD:
306
- message = ( localize(5369, "Are you sure you want to change the workspace?"));
306
+ message = ( localize(7341, "Are you sure you want to change the workspace?"));
307
307
  break;
308
308
  case ShutdownReason.RELOAD:
309
- message = ( localize(5370, "Are you sure you want to reload the window?"));
309
+ message = ( localize(7342, "Are you sure you want to reload the window?"));
310
310
  break;
311
311
  default:
312
- message = isMacintosh ? ( localize(5371, "Are you sure you want to quit?")) : ( localize(5372, "Are you sure you want to exit?"));
312
+ message = isMacintosh ? ( localize(7343, "Are you sure you want to quit?")) : ( localize(7344, "Are you sure you want to exit?"));
313
313
  break;
314
314
  }
315
315
  const result = await this._dialogService.confirm({
316
316
  message,
317
317
  detail: ( localize(
318
- 5373,
318
+ 7345,
319
319
  "'{0}' is in progress.",
320
- label || ( localize(5374, "File operation"))
320
+ label || ( localize(7346, "File operation"))
321
321
  ))
322
322
  });
323
323
  return !result.confirmed;
@@ -330,7 +330,7 @@ const autoSaveSetting = "files.refactoring.autoSave";
330
330
  properties: {
331
331
  [autoSaveSetting]: {
332
332
  description: ( localize(
333
- 5375,
333
+ 7347,
334
334
  "Controls if files that were part of a refactoring are saved automatically"
335
335
  )),
336
336
  default: true,
@@ -67,7 +67,7 @@ let RenameOperation = RenameOperation_1 = class RenameOperation {
67
67
  }, this._workingCopyFileService, this._fileService));
68
68
  }
69
69
  toString() {
70
- 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(", ")})`;
71
71
  }
72
72
  };
73
73
  RenameOperation = RenameOperation_1 = ( __decorate([( __param(2, IWorkingCopyFileService)), ( __param(3, IFileService))], RenameOperation));
@@ -129,7 +129,7 @@ let CopyOperation = class CopyOperation {
129
129
  });
130
130
  }
131
131
  toString() {
132
- 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(", ")})`;
133
133
  }
134
134
  };
135
135
  CopyOperation = ( __decorate([( __param(2, IWorkingCopyFileService)), ( __param(3, IFileService)), ( __param(4, IInstantiationService))], CopyOperation));
@@ -158,7 +158,7 @@ let CreateOperation = class CreateOperation {
158
158
  this._textFileService = _textFileService;
159
159
  }
160
160
  get uris() {
161
- return ( this._edits.map(edit => edit.newUri));
161
+ return this._edits.map(edit => edit.newUri);
162
162
  }
163
163
  async perform(token) {
164
164
  const folderCreates = [];
@@ -195,9 +195,9 @@ let CreateOperation = class CreateOperation {
195
195
  });
196
196
  }
197
197
  toString() {
198
- return `(create ${( this._edits.map(
198
+ return `(create ${this._edits.map(
199
199
  edit => edit.options.folder ? `folder ${edit.newUri}` : `file ${edit.newUri} with ${edit.contents?.byteLength || 0} bytes`
200
- )).join(", ")})`;
200
+ ).join(", ")})`;
201
201
  }
202
202
  };
203
203
  CreateOperation = ( __decorate([( __param(2, IFileService)), ( __param(3, IWorkingCopyFileService)), ( __param(4, IInstantiationService)), ( __param(5, ITextFileService))], CreateOperation));
@@ -228,7 +228,7 @@ let DeleteOperation = class DeleteOperation {
228
228
  this._logService = _logService;
229
229
  }
230
230
  get uris() {
231
- return ( this._edits.map(edit => edit.oldUri));
231
+ return this._edits.map(edit => edit.oldUri);
232
232
  }
233
233
  async perform(token) {
234
234
  const deletes = [];
@@ -278,7 +278,7 @@ let DeleteOperation = class DeleteOperation {
278
278
  });
279
279
  }
280
280
  toString() {
281
- return `(delete ${( this._edits.map(edit => edit.oldUri)).join(", ")})`;
281
+ return `(delete ${this._edits.map(edit => edit.oldUri).join(", ")})`;
282
282
  }
283
283
  };
284
284
  DeleteOperation = ( __decorate([( __param(2, IWorkingCopyFileService)), ( __param(3, IFileService)), ( __param(4, IConfigurationService)), ( __param(5, IInstantiationService)), ( __param(6, ILogService))], DeleteOperation));
@@ -305,7 +305,7 @@ class FileUndoRedoElement {
305
305
  }
306
306
  }
307
307
  toString() {
308
- return ( this.operations.map(op => String(op))).join(", ");
308
+ return this.operations.map(op => String(op)).join(", ");
309
309
  }
310
310
  }
311
311
  let BulkFileEdits = class BulkFileEdits {
@@ -73,8 +73,8 @@ class ModelEditTask {
73
73
  }
74
74
  apply(reason) {
75
75
  if (this._edits.length > 0) {
76
- this._edits = (
77
- this._edits.map(this._transformSnippetStringToInsertText, this)).sort((a, b) => Range.compareRangesUsingStarts(a.range, b.range));
76
+ this._edits =
77
+ this._edits.map(this._transformSnippetStringToInsertText, this).sort((a, b) => Range.compareRangesUsingStarts(a.range, b.range));
78
78
  this.model.pushEditOperations(null, this._edits, () => null, undefined, reason);
79
79
  }
80
80
  if (this._newEol !== undefined) {
@@ -127,8 +127,8 @@ class EditorEditTask extends ModelEditTask {
127
127
  undoStopAfter: false
128
128
  });
129
129
  } else {
130
- this._edits = (
131
- this._edits.map(this._transformSnippetStringToInsertText, this)).sort((a, b) => Range.compareRangesUsingStarts(a.range, b.range));
130
+ this._edits =
131
+ this._edits.map(this._transformSnippetStringToInsertText, this).sort((a, b) => Range.compareRangesUsingStarts(a.range, b.range));
132
132
  this._editor.executeEdits(reason, this._edits);
133
133
  }
134
134
  }
@@ -210,7 +210,7 @@ let BulkTextEdits = class BulkTextEdits {
210
210
  }
211
211
  const makeGroupMoreMinimal = async (start, end) => {
212
212
  const oldEdits = edits.slice(start, end);
213
- const newEdits = await this._editorWorker.computeMoreMinimalEdits(ref.object.textEditorModel.uri, ( oldEdits.map(e => e.textEdit)), false);
213
+ const newEdits = await this._editorWorker.computeMoreMinimalEdits(ref.object.textEditorModel.uri, oldEdits.map(e => e.textEdit), false);
214
214
  if (!newEdits) {
215
215
  oldEdits.forEach(task.addEdit, task);
216
216
  } else {
@@ -268,7 +268,7 @@ let BulkTextEdits = class BulkTextEdits {
268
268
  }
269
269
  this._progress.report(undefined);
270
270
  } else {
271
- const multiModelEditStackElement = ( new MultiModelEditStackElement(this._label, this._code, ( tasks.map(t => ( new SingleModelEditStackElement(this._label, this._code, t.model, t.getBeforeCursorState()))))));
271
+ const multiModelEditStackElement = ( new MultiModelEditStackElement(this._label, this._code, tasks.map(t => ( new SingleModelEditStackElement(this._label, this._code, t.model, t.getBeforeCursorState())))));
272
272
  this._undoRedoService.pushElement(multiModelEditStackElement, this._undoRedoGroup, this._undoRedoSource);
273
273
  for (const task of tasks) {
274
274
  task.apply();
@@ -1,16 +0,0 @@
1
- import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
2
- import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
3
- import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service";
4
- import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
5
- import { ResourceEdit } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/bulkEditService";
6
- import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
7
- export declare class ConflictDetector {
8
- private readonly _conflicts;
9
- private readonly _disposables;
10
- private readonly _onDidConflict;
11
- readonly onDidConflict: Event<this>;
12
- constructor(edits: ResourceEdit[], fileService: IFileService, modelService: IModelService, logService: ILogService);
13
- dispose(): void;
14
- list(): URI[];
15
- hasConflicts(): boolean;
16
- }
@@ -1,73 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
4
- import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service';
5
- import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
6
- import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
7
- import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
8
- import { ResourceTextEdit, ResourceFileEdit } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/bulkEditService';
9
- import { ResourceNotebookCellEdit } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
10
- import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
11
-
12
- let ConflictDetector = class ConflictDetector {
13
- constructor(edits, fileService, modelService, logService) {
14
- this._conflicts = ( new ResourceMap());
15
- this._disposables = ( new DisposableStore());
16
- this._onDidConflict = ( new Emitter());
17
- this.onDidConflict = this._onDidConflict.event;
18
- const _workspaceEditResources = ( new ResourceMap());
19
- for (const edit of edits) {
20
- if (edit instanceof ResourceTextEdit) {
21
- _workspaceEditResources.set(edit.resource, true);
22
- if (typeof edit.versionId === "number") {
23
- const model = modelService.getModel(edit.resource);
24
- if (model && model.getVersionId() !== edit.versionId) {
25
- this._conflicts.set(edit.resource, true);
26
- this._onDidConflict.fire(this);
27
- }
28
- }
29
- } else if (edit instanceof ResourceFileEdit) {
30
- if (edit.newResource) {
31
- _workspaceEditResources.set(edit.newResource, true);
32
- } else if (edit.oldResource) {
33
- _workspaceEditResources.set(edit.oldResource, true);
34
- }
35
- } else if (edit instanceof ResourceNotebookCellEdit) {
36
- _workspaceEditResources.set(edit.resource, true);
37
- } else {
38
- logService.warn("UNKNOWN edit type", edit);
39
- }
40
- }
41
- this._disposables.add(fileService.onDidFilesChange(e => {
42
- for (const uri of ( _workspaceEditResources.keys())) {
43
- if (!modelService.getModel(uri) && e.contains(uri)) {
44
- this._conflicts.set(uri, true);
45
- this._onDidConflict.fire(this);
46
- break;
47
- }
48
- }
49
- }));
50
- const onDidChangeModel = model => {
51
- if (( _workspaceEditResources.has(model.uri))) {
52
- this._conflicts.set(model.uri, true);
53
- this._onDidConflict.fire(this);
54
- }
55
- };
56
- for (const model of modelService.getModels()) {
57
- this._disposables.add(model.onDidChangeContent(() => onDidChangeModel(model)));
58
- }
59
- }
60
- dispose() {
61
- this._disposables.dispose();
62
- this._onDidConflict.dispose();
63
- }
64
- list() {
65
- return [...( this._conflicts.keys())];
66
- }
67
- hasConflicts() {
68
- return this._conflicts.size > 0;
69
- }
70
- };
71
- ConflictDetector = ( __decorate([( __param(1, IFileService)), ( __param(2, IModelService)), ( __param(3, ILogService))], ConflictDetector));
72
-
73
- export { ConflictDetector };