@codingame/monaco-vscode-bulk-edit-service-override 4.5.1 → 4.5.2

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.
@@ -30,13 +30,14 @@ import { defaultButtonStyles } from 'vscode/vscode/vs/platform/theme/browser/def
30
30
  import { LRUCachedFunction, CachedFunction } from 'vscode/vscode/vs/base/common/cache';
31
31
 
32
32
  var BulkEditPane_1;
33
+ const _moduleId = "vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane";
33
34
  let BulkEditPane = class BulkEditPane extends ViewPane {
34
35
  static { BulkEditPane_1 = this; }
35
36
  static { this.ID = 'refactorPreview'; }
36
37
  static { this.Schema = 'vscode-bulkeditpreview-multieditor'; }
37
- static { this.ctxHasCategories = ( new RawContextKey('refactorPreview.hasCategories', false)); }
38
- static { this.ctxGroupByFile = ( new RawContextKey('refactorPreview.groupByFile', true)); }
39
- static { this.ctxHasCheckedChanges = ( new RawContextKey('refactorPreview.hasCheckedChanges', true)); }
38
+ static { this.ctxHasCategories = ( (new RawContextKey('refactorPreview.hasCategories', false))); }
39
+ static { this.ctxGroupByFile = ( (new RawContextKey('refactorPreview.groupByFile', true))); }
40
+ static { this.ctxHasCheckedChanges = ( (new RawContextKey('refactorPreview.hasCheckedChanges', true))); }
40
41
  static { this._memGroupByFile = `${BulkEditPane_1.ID}.groupByFile`; }
41
42
  constructor(options, _instaService, _editorService, _labelService, _textModelService, _dialogService, _contextMenuService, _storageService, contextKeyService, viewDescriptorService, keybindingService, contextMenuService, configurationService, openerService, themeService, telemetryService) {
42
43
  super({ ...options, titleMenuId: MenuId.BulkEditTitle }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, _instaService, openerService, themeService, telemetryService);
@@ -47,11 +48,11 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
47
48
  this._dialogService = _dialogService;
48
49
  this._contextMenuService = _contextMenuService;
49
50
  this._storageService = _storageService;
50
- this._treeViewStates = ( new Map());
51
- this._disposables = ( new DisposableStore());
52
- this._sessionDisposables = ( new DisposableStore());
53
- this._computeResourceDiffEditorInputs = ( new LRUCachedFunction(async (fileOperations) => {
54
- const computeDiffEditorInput = ( new CachedFunction(async (fileOperation) => {
51
+ this._treeViewStates = ( (new Map()));
52
+ this._disposables = ( (new DisposableStore()));
53
+ this._sessionDisposables = ( (new DisposableStore()));
54
+ this._computeResourceDiffEditorInputs = ( (new LRUCachedFunction(async (fileOperations) => {
55
+ const computeDiffEditorInput = ( (new CachedFunction(async (fileOperation) => {
55
56
  const fileOperationUri = fileOperation.uri;
56
57
  const previewUri = this._currentProvider.asPreviewUri(fileOperationUri);
57
58
  if (fileOperation.type & 4 ) {
@@ -74,7 +75,7 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
74
75
  modified: { resource: URI.revive(previewUri) }
75
76
  };
76
77
  }
77
- }));
78
+ })));
78
79
  const sortedFileOperations = fileOperations.slice().sort(compareBulkFileOperations);
79
80
  const resources = [];
80
81
  for (const operation of sortedFileOperations) {
@@ -88,7 +89,7 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
88
89
  resources,
89
90
  getResourceDiffEditorInputIdOfOperation
90
91
  };
91
- }, key => key));
92
+ }, key => key)));
92
93
  this.element.classList.add('bulk-edit-panel', 'show-file-icons');
93
94
  this._ctxHasCategories = BulkEditPane_1.ctxHasCategories.bindTo(contextKeyService);
94
95
  this._ctxGroupByFile = BulkEditPane_1.ctxGroupByFile.bindTo(contextKeyService);
@@ -112,13 +113,13 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
112
113
  this._treeDataSource = this._instaService.createInstance(BulkEditDataSource);
113
114
  this._treeDataSource.groupByFile = this._storageService.getBoolean(BulkEditPane_1._memGroupByFile, 0 , true);
114
115
  this._ctxGroupByFile.set(this._treeDataSource.groupByFile);
115
- this._tree = this._instaService.createInstance(WorkbenchAsyncDataTree, this.id, treeContainer, ( new BulkEditDelegate()), [this._instaService.createInstance(TextEditElementRenderer), this._instaService.createInstance(FileElementRenderer, resourceLabels), this._instaService.createInstance(CategoryElementRenderer)], this._treeDataSource, {
116
+ this._tree = this._instaService.createInstance(WorkbenchAsyncDataTree, this.id, treeContainer, ( (new BulkEditDelegate())), [this._instaService.createInstance(TextEditElementRenderer), this._instaService.createInstance(FileElementRenderer, resourceLabels), this._instaService.createInstance(CategoryElementRenderer)], this._treeDataSource, {
116
117
  accessibilityProvider: this._instaService.createInstance(BulkEditAccessibilityProvider),
117
- identityProvider: ( new BulkEditIdentityProvider()),
118
+ identityProvider: ( (new BulkEditIdentityProvider())),
118
119
  expandOnlyOnTwistieClick: true,
119
120
  multipleSelectionSupport: false,
120
- keyboardNavigationLabelProvider: ( new BulkEditNaviLabelProvider()),
121
- sorter: ( new BulkEditSorter()),
121
+ keyboardNavigationLabelProvider: ( (new BulkEditNaviLabelProvider())),
122
+ sorter: ( (new BulkEditSorter())),
122
123
  selectionNavigation: true
123
124
  });
124
125
  this._disposables.add(this._tree.onContextMenu(this._onContextMenu, this));
@@ -126,27 +127,19 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
126
127
  const buttonsContainer = document.createElement('div');
127
128
  buttonsContainer.className = 'buttons';
128
129
  contentContainer.appendChild(buttonsContainer);
129
- const buttonBar = ( new ButtonBar(buttonsContainer));
130
+ const buttonBar = ( (new ButtonBar(buttonsContainer)));
130
131
  this._disposables.add(buttonBar);
131
132
  const btnConfirm = buttonBar.addButton({ supportIcons: true, ...defaultButtonStyles });
132
- btnConfirm.label = ( localizeWithPath(
133
- 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane',
134
- 'ok',
135
- 'Apply'
136
- ));
133
+ btnConfirm.label = ( localizeWithPath(_moduleId, 0, 'Apply'));
137
134
  btnConfirm.onDidClick(() => this.accept(), this, this._disposables);
138
135
  const btnCancel = buttonBar.addButton({ ...defaultButtonStyles, secondary: true });
139
- btnCancel.label = ( localizeWithPath(
140
- 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane',
141
- 'cancel',
142
- 'Discard'
143
- ));
136
+ btnCancel.label = ( localizeWithPath(_moduleId, 1, 'Discard'));
144
137
  btnCancel.onDidClick(() => this.discard(), this, this._disposables);
145
138
  this._message = document.createElement('span');
146
139
  this._message.className = 'message';
147
140
  this._message.innerText = ( localizeWithPath(
148
- 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane',
149
- 'empty.msg',
141
+ _moduleId,
142
+ 2,
150
143
  "Invoke a code action, like rename, to see a preview of its changes here."
151
144
  ));
152
145
  parent.appendChild(this._message);
@@ -178,15 +171,17 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
178
171
  this._treeDataSource.groupByFile = !hasCategories || this._treeDataSource.groupByFile;
179
172
  this._ctxHasCheckedChanges.set(input.checked.checkedCount > 0);
180
173
  this._currentInput = input;
181
- return ( new Promise(resolve => {
182
- token.onCancellationRequested(() => resolve(undefined));
183
- this._currentResolve = resolve;
184
- this._setTreeInput(input);
185
- this._sessionDisposables.add(input.checked.onDidChange(() => {
186
- this._tree.updateChildren();
187
- this._ctxHasCheckedChanges.set(input.checked.checkedCount > 0);
188
- }));
189
- }));
174
+ return (
175
+ (new Promise(resolve => {
176
+ token.onCancellationRequested(() => resolve(undefined));
177
+ this._currentResolve = resolve;
178
+ this._setTreeInput(input);
179
+ this._sessionDisposables.add(input.checked.onDidChange(() => {
180
+ this._tree.updateChildren();
181
+ this._ctxHasCheckedChanges.set(input.checked.checkedCount > 0);
182
+ }));
183
+ }))
184
+ );
190
185
  }
191
186
  hasInput() {
192
187
  return Boolean(this._currentInput);
@@ -219,16 +214,16 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
219
214
  let message;
220
215
  if (conflicts.length === 1) {
221
216
  message = ( localizeWithPath(
222
- 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane',
223
- 'conflict.1',
217
+ _moduleId,
218
+ 3,
224
219
  "Cannot apply refactoring because '{0}' has changed in the meantime.",
225
220
  this._labelService.getUriLabel(conflicts[0], { relative: true })
226
221
  ));
227
222
  }
228
223
  else {
229
224
  message = ( localizeWithPath(
230
- 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane',
231
- 'conflict.N',
225
+ _moduleId,
226
+ 4,
232
227
  "Cannot apply refactoring because {0} other files have changed in the meantime.",
233
228
  conflicts.length
234
229
  ));
@@ -303,7 +298,7 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
303
298
  }
304
299
  }
305
300
  };
306
- const multiDiffSource = ( URI.from({ scheme: BulkEditPane_1.Schema }));
301
+ const multiDiffSource = ( (URI.from({ scheme: BulkEditPane_1.Schema })));
307
302
  const label = 'Refactor Preview';
308
303
  this._editorService.openEditor({
309
304
  multiDiffSource,
@@ -322,22 +317,22 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
322
317
  });
323
318
  }
324
319
  };
325
- BulkEditPane = BulkEditPane_1 = ( __decorate([
326
- ( __param(1, IInstantiationService)),
327
- ( __param(2, IEditorService)),
328
- ( __param(3, ILabelService)),
329
- ( __param(4, ITextModelService)),
330
- ( __param(5, IDialogService)),
331
- ( __param(6, IContextMenuService)),
332
- ( __param(7, IStorageService)),
333
- ( __param(8, IContextKeyService)),
334
- ( __param(9, IViewDescriptorService)),
335
- ( __param(10, IKeybindingService)),
336
- ( __param(11, IContextMenuService)),
337
- ( __param(12, IConfigurationService)),
338
- ( __param(13, IOpenerService)),
339
- ( __param(14, IThemeService)),
340
- ( __param(15, ITelemetryService))
341
- ], BulkEditPane));
320
+ BulkEditPane = BulkEditPane_1 = ( (__decorate([
321
+ ( (__param(1, IInstantiationService))),
322
+ ( (__param(2, IEditorService))),
323
+ ( (__param(3, ILabelService))),
324
+ ( (__param(4, ITextModelService))),
325
+ ( (__param(5, IDialogService))),
326
+ ( (__param(6, IContextMenuService))),
327
+ ( (__param(7, IStorageService))),
328
+ ( (__param(8, IContextKeyService))),
329
+ ( (__param(9, IViewDescriptorService))),
330
+ ( (__param(10, IKeybindingService))),
331
+ ( (__param(11, IContextMenuService))),
332
+ ( (__param(12, IConfigurationService))),
333
+ ( (__param(13, IOpenerService))),
334
+ ( (__param(14, IThemeService))),
335
+ ( (__param(15, ITelemetryService)))
336
+ ], BulkEditPane)));
342
337
 
343
338
  export { BulkEditPane };
@@ -22,11 +22,12 @@ import { SnippetParser } from 'vscode/vscode/vs/editor/contrib/snippet/browser/s
22
22
  import { MicrotaskDelay } from 'vscode/vscode/vs/base/common/symbols';
23
23
 
24
24
  var BulkFileOperations_1, BulkEditPreviewProvider_1;
25
+ const _moduleId = "vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPreview";
25
26
  class CheckedStates {
26
27
  constructor() {
27
- this._states = ( new WeakMap());
28
+ this._states = ( (new WeakMap()));
28
29
  this._checkedCount = 0;
29
- this._onDidChange = ( new Emitter());
30
+ this._onDidChange = ( (new Emitter()));
30
31
  this.onDidChange = this._onDidChange.event;
31
32
  }
32
33
  dispose() {
@@ -72,13 +73,13 @@ class BulkFileOperation {
72
73
  this.parent = parent;
73
74
  this.type = 0;
74
75
  this.textEdits = [];
75
- this.originalEdits = ( new Map());
76
+ this.originalEdits = ( (new Map()));
76
77
  }
77
78
  addEdit(index, type, edit) {
78
79
  this.type |= type;
79
80
  this.originalEdits.set(index, edit);
80
81
  if (edit instanceof ResourceTextEdit) {
81
- this.textEdits.push(( new BulkTextEdit(this, edit)));
82
+ this.textEdits.push(( (new BulkTextEdit(this, edit))));
82
83
  }
83
84
  else if (type === 8 ) {
84
85
  this.newUri = edit.newResource;
@@ -94,24 +95,22 @@ class BulkFileOperation {
94
95
  }
95
96
  }
96
97
  class BulkCategory {
97
- static { this._defaultMetadata = ( Object.freeze({
98
- label: ( localizeWithPath(
99
- 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPreview',
100
- 'default',
101
- "Other"
102
- )),
98
+ static { this._defaultMetadata = ( (Object.freeze({
99
+ label: ( localizeWithPath(_moduleId, 0, "Other")),
103
100
  icon: Codicon.symbolFile,
104
101
  needsConfirmation: false
105
- })); }
102
+ }))); }
106
103
  static keyOf(metadata) {
107
104
  return metadata?.label || '<default>';
108
105
  }
109
106
  constructor(metadata = BulkCategory._defaultMetadata) {
110
107
  this.metadata = metadata;
111
- this.operationByResource = ( new Map());
108
+ this.operationByResource = ( (new Map()));
112
109
  }
113
110
  get fileOperations() {
114
- return ( this.operationByResource.values());
111
+ return (
112
+ (this.operationByResource.values())
113
+ );
115
114
  }
116
115
  }
117
116
  let BulkFileOperations = BulkFileOperations_1 = class BulkFileOperations {
@@ -122,7 +121,7 @@ let BulkFileOperations = BulkFileOperations_1 = class BulkFileOperations {
122
121
  constructor(_bulkEdit, _fileService, instaService) {
123
122
  this._bulkEdit = _bulkEdit;
124
123
  this._fileService = _fileService;
125
- this.checked = ( new CheckedStates());
124
+ this.checked = ( (new CheckedStates()));
126
125
  this.fileOperations = [];
127
126
  this.categories = [];
128
127
  this.conflicts = instaService.createInstance(ConflictDetector, _bulkEdit);
@@ -132,9 +131,9 @@ let BulkFileOperations = BulkFileOperations_1 = class BulkFileOperations {
132
131
  this.conflicts.dispose();
133
132
  }
134
133
  async _init() {
135
- const operationByResource = ( new Map());
136
- const operationByCategory = ( new Map());
137
- const newToOldUri = ( new ResourceMap());
134
+ const operationByResource = ( (new Map()));
135
+ const operationByCategory = ( (new Map()));
136
+ const newToOldUri = ( (new ResourceMap()));
138
137
  for (let idx = 0; idx < this._bulkEdit.length; idx++) {
139
138
  const edit = this._bulkEdit[idx];
140
139
  let uri;
@@ -177,13 +176,13 @@ let BulkFileOperations = BulkFileOperations_1 = class BulkFileOperations {
177
176
  const insert = (uri, map) => {
178
177
  let key = extUri.getComparisonKey(uri, true);
179
178
  let operation = map.get(key);
180
- if (!operation && ( newToOldUri.has(uri))) {
179
+ if (!operation && ( (newToOldUri.has(uri)))) {
181
180
  uri = newToOldUri.get(uri);
182
181
  key = extUri.getComparisonKey(uri, true);
183
182
  operation = map.get(key);
184
183
  }
185
184
  if (!operation) {
186
- operation = ( new BulkFileOperation(uri, this));
185
+ operation = ( (new BulkFileOperation(uri, this)));
187
186
  map.set(key, operation);
188
187
  }
189
188
  operation.addEdit(idx, type, edit);
@@ -192,7 +191,7 @@ let BulkFileOperations = BulkFileOperations_1 = class BulkFileOperations {
192
191
  const key = BulkCategory.keyOf(edit.metadata);
193
192
  let category = operationByCategory.get(key);
194
193
  if (!category) {
195
- category = ( new BulkCategory(edit.metadata));
194
+ category = ( (new BulkCategory(edit.metadata)));
196
195
  operationByCategory.set(key, category);
197
196
  }
198
197
  insert(uri, category.operationByResource);
@@ -202,13 +201,13 @@ let BulkFileOperations = BulkFileOperations_1 = class BulkFileOperations {
202
201
  for (const file of this.fileOperations) {
203
202
  if (file.type !== 1 ) {
204
203
  let checked = true;
205
- for (const edit of ( file.originalEdits.values())) {
204
+ for (const edit of ( (file.originalEdits.values()))) {
206
205
  if (edit instanceof ResourceFileEdit) {
207
206
  checked = checked && this.checked.isChecked(edit);
208
207
  }
209
208
  }
210
209
  if (!checked) {
211
- for (const edit of ( file.originalEdits.values())) {
210
+ for (const edit of ( (file.originalEdits.values()))) {
212
211
  this.checked.updateChecked(edit, checked);
213
212
  }
214
213
  }
@@ -246,10 +245,10 @@ let BulkFileOperations = BulkFileOperations_1 = class BulkFileOperations {
246
245
  }
247
246
  getFileEdits(uri) {
248
247
  for (const file of this.fileOperations) {
249
- if (( file.uri.toString()) === ( uri.toString())) {
248
+ if (( (file.uri.toString())) === ( (uri.toString()))) {
250
249
  const result = [];
251
250
  let ignoreAll = false;
252
- for (const edit of ( file.originalEdits.values())) {
251
+ for (const edit of ( (file.originalEdits.values()))) {
253
252
  if (edit instanceof ResourceTextEdit) {
254
253
  if (this.checked.isChecked(edit)) {
255
254
  result.push(EditOperation.replaceMove(Range.lift(edit.textEdit.range), !edit.textEdit.insertAsSnippet ? edit.textEdit.text : SnippetParser.asInsertText(edit.textEdit.text)));
@@ -269,33 +268,35 @@ let BulkFileOperations = BulkFileOperations_1 = class BulkFileOperations {
269
268
  }
270
269
  getUriOfEdit(edit) {
271
270
  for (const file of this.fileOperations) {
272
- for (const value of ( file.originalEdits.values())) {
271
+ for (const value of ( (file.originalEdits.values()))) {
273
272
  if (value === edit) {
274
273
  return file.uri;
275
274
  }
276
275
  }
277
276
  }
278
- throw new Error('invalid edit');
277
+ throw ( (new Error('invalid edit')));
279
278
  }
280
279
  };
281
- BulkFileOperations = BulkFileOperations_1 = ( __decorate([
282
- ( __param(1, IFileService)),
283
- ( __param(2, IInstantiationService))
284
- ], BulkFileOperations));
280
+ BulkFileOperations = BulkFileOperations_1 = ( (__decorate([
281
+ ( (__param(1, IFileService))),
282
+ ( (__param(2, IInstantiationService)))
283
+ ], BulkFileOperations)));
285
284
  let BulkEditPreviewProvider = class BulkEditPreviewProvider {
286
285
  static { BulkEditPreviewProvider_1 = this; }
287
286
  static { this.Schema = 'vscode-bulkeditpreview-editor'; }
288
- static { this.emptyPreview = ( URI.from({ scheme: BulkEditPreviewProvider_1.Schema, fragment: 'empty' })); }
287
+ static { this.emptyPreview = ( (URI.from({ scheme: BulkEditPreviewProvider_1.Schema, fragment: 'empty' }))); }
289
288
  static fromPreviewUri(uri) {
290
- return ( URI.parse(uri.query));
289
+ return (
290
+ (URI.parse(uri.query))
291
+ );
291
292
  }
292
293
  constructor(_operations, _languageService, _modelService, _textModelResolverService) {
293
294
  this._operations = _operations;
294
295
  this._languageService = _languageService;
295
296
  this._modelService = _modelService;
296
297
  this._textModelResolverService = _textModelResolverService;
297
- this._disposables = ( new DisposableStore());
298
- this._modelPreviewEdits = ( new Map());
298
+ this._disposables = ( (new DisposableStore()));
299
+ this._modelPreviewEdits = ( (new Map()));
299
300
  this._instanceId = generateUuid();
300
301
  this._disposables.add(this._textModelResolverService.registerTextModelContentProvider(BulkEditPreviewProvider_1.Schema, this));
301
302
  this._ready = this._init();
@@ -304,9 +305,11 @@ let BulkEditPreviewProvider = class BulkEditPreviewProvider {
304
305
  this._disposables.dispose();
305
306
  }
306
307
  asPreviewUri(uri) {
307
- return ( URI.from(
308
- { scheme: BulkEditPreviewProvider_1.Schema, authority: this._instanceId, path: uri.path, query: ( uri.toString()) }
309
- ));
308
+ return (
309
+ (URI.from(
310
+ { scheme: BulkEditPreviewProvider_1.Schema, authority: this._instanceId, path: uri.path, query: ( (uri.toString())) }
311
+ ))
312
+ );
310
313
  }
311
314
  async _init() {
312
315
  for (const operation of this._operations.fileOperations) {
@@ -347,17 +350,17 @@ let BulkEditPreviewProvider = class BulkEditPreviewProvider {
347
350
  return model;
348
351
  }
349
352
  async provideTextContent(previewUri) {
350
- if (( previewUri.toString()) === ( BulkEditPreviewProvider_1.emptyPreview.toString())) {
353
+ if (( (previewUri.toString())) === ( (BulkEditPreviewProvider_1.emptyPreview.toString()))) {
351
354
  return this._modelService.createModel('', null, previewUri);
352
355
  }
353
356
  await this._ready;
354
357
  return this._modelService.getModel(previewUri);
355
358
  }
356
359
  };
357
- BulkEditPreviewProvider = BulkEditPreviewProvider_1 = ( __decorate([
358
- ( __param(1, ILanguageService)),
359
- ( __param(2, IModelService)),
360
- ( __param(3, ITextModelService))
361
- ], BulkEditPreviewProvider));
360
+ BulkEditPreviewProvider = BulkEditPreviewProvider_1 = ( (__decorate([
361
+ ( (__param(1, ILanguageService))),
362
+ ( (__param(2, IModelService))),
363
+ ( (__param(3, ITextModelService)))
364
+ ], BulkEditPreviewProvider)));
362
365
 
363
366
  export { BulkCategory, BulkEditPreviewProvider, BulkFileOperation, BulkFileOperations, BulkTextEdit, CheckedStates };