@codingame/monaco-vscode-bulk-edit-service-override 4.1.0 → 4.1.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.
@@ -0,0 +1,657 @@
1
+ import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
3
+ import { createMatches } from 'vscode/vscode/vs/base/common/filters';
4
+ import { HighlightedLabel } from 'vscode/vscode/vs/base/browser/ui/highlightedlabel/highlightedLabel';
5
+ import { Range } from 'vscode/vscode/vs/editor/common/core/range';
6
+ import { asCSSUrl, addDisposableListener } from 'vscode/vscode/vs/base/browser/dom';
7
+ import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
8
+ import { TextModel } from 'vscode/vscode/vs/editor/common/model/textModel';
9
+ import { BulkFileOperations } from './bulkEditPreview.js';
10
+ import { FileKind } from 'vscode/vscode/vs/platform/files/common/files';
11
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
12
+ import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
13
+ import { IconLabel } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabel';
14
+ import { basename } from 'vscode/vscode/vs/base/common/resources';
15
+ import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
16
+ import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
17
+ import { compare } from 'vscode/vscode/vs/base/common/strings';
18
+ import { URI } from 'vscode/vscode/vs/base/common/uri';
19
+ import { IUndoRedoService } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo';
20
+ import { ResourceFileEdit } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
21
+ import { ILanguageConfigurationService } from 'vscode/vscode/vs/editor/common/languages/languageConfigurationRegistry';
22
+ import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
23
+ import { PLAINTEXT_LANGUAGE_ID } from 'vscode/vscode/vs/editor/common/languages/modesRegistry';
24
+ import { SnippetParser } from 'vscode/vscode/vs/editor/contrib/snippet/browser/snippetParser';
25
+
26
+ var CategoryElementRenderer_1, FileElementRenderer_1, TextEditElementRenderer_1;
27
+ class CategoryElement {
28
+ constructor(parent, category) {
29
+ this.parent = parent;
30
+ this.category = category;
31
+ }
32
+ isChecked() {
33
+ const model = this.parent;
34
+ let checked = true;
35
+ for (const file of this.category.fileOperations) {
36
+ for (const edit of ( file.originalEdits.values())) {
37
+ checked = checked && model.checked.isChecked(edit);
38
+ }
39
+ }
40
+ return checked;
41
+ }
42
+ setChecked(value) {
43
+ const model = this.parent;
44
+ for (const file of this.category.fileOperations) {
45
+ for (const edit of ( file.originalEdits.values())) {
46
+ model.checked.updateChecked(edit, value);
47
+ }
48
+ }
49
+ }
50
+ }
51
+ class FileElement {
52
+ constructor(parent, edit) {
53
+ this.parent = parent;
54
+ this.edit = edit;
55
+ }
56
+ isChecked() {
57
+ const model = this.parent instanceof CategoryElement ? this.parent.parent : this.parent;
58
+ let checked = true;
59
+ if (this.edit.type === 1 ) {
60
+ checked = !this.edit.textEdits.every(edit => !model.checked.isChecked(edit.textEdit));
61
+ }
62
+ for (const edit of ( this.edit.originalEdits.values())) {
63
+ if (edit instanceof ResourceFileEdit) {
64
+ checked = checked && model.checked.isChecked(edit);
65
+ }
66
+ }
67
+ if (this.parent instanceof CategoryElement && this.edit.type === 1 ) {
68
+ for (const category of model.categories) {
69
+ for (const file of category.fileOperations) {
70
+ if (( file.uri.toString()) === ( this.edit.uri.toString())) {
71
+ for (const edit of ( file.originalEdits.values())) {
72
+ if (edit instanceof ResourceFileEdit) {
73
+ checked = checked && model.checked.isChecked(edit);
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ return checked;
81
+ }
82
+ setChecked(value) {
83
+ const model = this.parent instanceof CategoryElement ? this.parent.parent : this.parent;
84
+ for (const edit of ( this.edit.originalEdits.values())) {
85
+ model.checked.updateChecked(edit, value);
86
+ }
87
+ if (this.parent instanceof CategoryElement && this.edit.type !== 1 ) {
88
+ for (const category of model.categories) {
89
+ for (const file of category.fileOperations) {
90
+ if (( file.uri.toString()) === ( this.edit.uri.toString())) {
91
+ for (const edit of ( file.originalEdits.values())) {
92
+ model.checked.updateChecked(edit, value);
93
+ }
94
+ }
95
+ }
96
+ }
97
+ }
98
+ }
99
+ isDisabled() {
100
+ if (this.parent instanceof CategoryElement && this.edit.type === 1 ) {
101
+ const model = this.parent.parent;
102
+ let checked = true;
103
+ for (const category of model.categories) {
104
+ for (const file of category.fileOperations) {
105
+ if (( file.uri.toString()) === ( this.edit.uri.toString())) {
106
+ for (const edit of ( file.originalEdits.values())) {
107
+ if (edit instanceof ResourceFileEdit) {
108
+ checked = checked && model.checked.isChecked(edit);
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ return !checked;
115
+ }
116
+ return false;
117
+ }
118
+ }
119
+ class TextEditElement {
120
+ constructor(parent, idx, edit, prefix, selecting, inserting, suffix) {
121
+ this.parent = parent;
122
+ this.idx = idx;
123
+ this.edit = edit;
124
+ this.prefix = prefix;
125
+ this.selecting = selecting;
126
+ this.inserting = inserting;
127
+ this.suffix = suffix;
128
+ }
129
+ isChecked() {
130
+ let model = this.parent.parent;
131
+ if (model instanceof CategoryElement) {
132
+ model = model.parent;
133
+ }
134
+ return model.checked.isChecked(this.edit.textEdit);
135
+ }
136
+ setChecked(value) {
137
+ let model = this.parent.parent;
138
+ if (model instanceof CategoryElement) {
139
+ model = model.parent;
140
+ }
141
+ model.checked.updateChecked(this.edit.textEdit, value);
142
+ if (value) {
143
+ for (const edit of ( this.parent.edit.originalEdits.values())) {
144
+ if (edit instanceof ResourceFileEdit) {
145
+ model.checked.updateChecked(edit, value);
146
+ }
147
+ }
148
+ }
149
+ }
150
+ isDisabled() {
151
+ return this.parent.isDisabled();
152
+ }
153
+ }
154
+ let BulkEditDataSource = class BulkEditDataSource {
155
+ constructor(_textModelService, _undoRedoService, _languageService, _languageConfigurationService) {
156
+ this._textModelService = _textModelService;
157
+ this._undoRedoService = _undoRedoService;
158
+ this._languageService = _languageService;
159
+ this._languageConfigurationService = _languageConfigurationService;
160
+ this.groupByFile = true;
161
+ }
162
+ hasChildren(element) {
163
+ if (element instanceof FileElement) {
164
+ return element.edit.textEdits.length > 0;
165
+ }
166
+ if (element instanceof TextEditElement) {
167
+ return false;
168
+ }
169
+ return true;
170
+ }
171
+ async getChildren(element) {
172
+ if (element instanceof BulkFileOperations) {
173
+ return this.groupByFile
174
+ ? ( element.fileOperations.map(op => ( new FileElement(element, op))))
175
+ : ( element.categories.map(cat => ( new CategoryElement(element, cat))));
176
+ }
177
+ if (element instanceof CategoryElement) {
178
+ return Array.from(element.category.fileOperations, op => ( new FileElement(element, op)));
179
+ }
180
+ if (element instanceof FileElement && element.edit.textEdits.length > 0) {
181
+ let textModel;
182
+ let textModelDisposable;
183
+ try {
184
+ const ref = await this._textModelService.createModelReference(element.edit.uri);
185
+ textModel = ref.object.textEditorModel;
186
+ textModelDisposable = ref;
187
+ }
188
+ catch {
189
+ textModel = ( new TextModel(
190
+ '',
191
+ PLAINTEXT_LANGUAGE_ID,
192
+ TextModel.DEFAULT_CREATION_OPTIONS,
193
+ null,
194
+ this._undoRedoService,
195
+ this._languageService,
196
+ this._languageConfigurationService
197
+ ));
198
+ textModelDisposable = textModel;
199
+ }
200
+ const result = ( element.edit.textEdits.map((edit, idx) => {
201
+ const range = textModel.validateRange(edit.textEdit.textEdit.range);
202
+ const startTokens = textModel.tokenization.getLineTokens(range.startLineNumber);
203
+ let prefixLen = 23;
204
+ for (let idx = startTokens.findTokenIndexAtOffset(range.startColumn - 1) - 1; prefixLen < 50 && idx >= 0; idx--) {
205
+ prefixLen = range.startColumn - startTokens.getStartOffset(idx);
206
+ }
207
+ const endTokens = textModel.tokenization.getLineTokens(range.endLineNumber);
208
+ let suffixLen = 0;
209
+ for (let idx = endTokens.findTokenIndexAtOffset(range.endColumn - 1); suffixLen < 50 && idx < endTokens.getCount(); idx++) {
210
+ suffixLen += endTokens.getEndOffset(idx) - endTokens.getStartOffset(idx);
211
+ }
212
+ return ( new TextEditElement(element, idx, edit, textModel.getValueInRange(( new Range(
213
+ range.startLineNumber,
214
+ range.startColumn - prefixLen,
215
+ range.startLineNumber,
216
+ range.startColumn
217
+ ))), textModel.getValueInRange(range), !edit.textEdit.textEdit.insertAsSnippet ? edit.textEdit.textEdit.text : SnippetParser.asInsertText(edit.textEdit.textEdit.text), textModel.getValueInRange(( new Range(
218
+ range.endLineNumber,
219
+ range.endColumn,
220
+ range.endLineNumber,
221
+ range.endColumn + suffixLen
222
+ )))));
223
+ }));
224
+ textModelDisposable.dispose();
225
+ return result;
226
+ }
227
+ return [];
228
+ }
229
+ };
230
+ BulkEditDataSource = ( __decorate([
231
+ ( __param(0, ITextModelService)),
232
+ ( __param(1, IUndoRedoService)),
233
+ ( __param(2, ILanguageService)),
234
+ ( __param(3, ILanguageConfigurationService))
235
+ ], BulkEditDataSource));
236
+ class BulkEditSorter {
237
+ compare(a, b) {
238
+ if (a instanceof FileElement && b instanceof FileElement) {
239
+ return compareBulkFileOperations(a.edit, b.edit);
240
+ }
241
+ if (a instanceof TextEditElement && b instanceof TextEditElement) {
242
+ return Range.compareRangesUsingStarts(a.edit.textEdit.textEdit.range, b.edit.textEdit.textEdit.range);
243
+ }
244
+ return 0;
245
+ }
246
+ }
247
+ function compareBulkFileOperations(a, b) {
248
+ return compare(( a.uri.toString()), ( b.uri.toString()));
249
+ }
250
+ let BulkEditAccessibilityProvider = class BulkEditAccessibilityProvider {
251
+ constructor(_labelService) {
252
+ this._labelService = _labelService;
253
+ }
254
+ getWidgetAriaLabel() {
255
+ return ( localizeWithPath(
256
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
257
+ 'bulkEdit',
258
+ "Bulk Edit"
259
+ ));
260
+ }
261
+ getRole(_element) {
262
+ return 'checkbox';
263
+ }
264
+ getAriaLabel(element) {
265
+ if (element instanceof FileElement) {
266
+ if (element.edit.textEdits.length > 0) {
267
+ if (element.edit.type & 8 && element.edit.newUri) {
268
+ return ( localizeWithPath(
269
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
270
+ 'aria.renameAndEdit',
271
+ "Renaming {0} to {1}, also making text edits",
272
+ this._labelService.getUriLabel(element.edit.uri, { relative: true }),
273
+ this._labelService.getUriLabel(element.edit.newUri, { relative: true })
274
+ ));
275
+ }
276
+ else if (element.edit.type & 2 ) {
277
+ return ( localizeWithPath(
278
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
279
+ 'aria.createAndEdit',
280
+ "Creating {0}, also making text edits",
281
+ this._labelService.getUriLabel(element.edit.uri, { relative: true })
282
+ ));
283
+ }
284
+ else if (element.edit.type & 4 ) {
285
+ return ( localizeWithPath(
286
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
287
+ 'aria.deleteAndEdit',
288
+ "Deleting {0}, also making text edits",
289
+ this._labelService.getUriLabel(element.edit.uri, { relative: true })
290
+ ));
291
+ }
292
+ else {
293
+ return ( localizeWithPath(
294
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
295
+ 'aria.editOnly',
296
+ "{0}, making text edits",
297
+ this._labelService.getUriLabel(element.edit.uri, { relative: true })
298
+ ));
299
+ }
300
+ }
301
+ else {
302
+ if (element.edit.type & 8 && element.edit.newUri) {
303
+ return ( localizeWithPath(
304
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
305
+ 'aria.rename',
306
+ "Renaming {0} to {1}",
307
+ this._labelService.getUriLabel(element.edit.uri, { relative: true }),
308
+ this._labelService.getUriLabel(element.edit.newUri, { relative: true })
309
+ ));
310
+ }
311
+ else if (element.edit.type & 2 ) {
312
+ return ( localizeWithPath(
313
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
314
+ 'aria.create',
315
+ "Creating {0}",
316
+ this._labelService.getUriLabel(element.edit.uri, { relative: true })
317
+ ));
318
+ }
319
+ else if (element.edit.type & 4 ) {
320
+ return ( localizeWithPath(
321
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
322
+ 'aria.delete',
323
+ "Deleting {0}",
324
+ this._labelService.getUriLabel(element.edit.uri, { relative: true })
325
+ ));
326
+ }
327
+ }
328
+ }
329
+ if (element instanceof TextEditElement) {
330
+ if (element.selecting.length > 0 && element.inserting.length > 0) {
331
+ return ( localizeWithPath(
332
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
333
+ 'aria.replace',
334
+ "line {0}, replacing {1} with {2}",
335
+ element.edit.textEdit.textEdit.range.startLineNumber,
336
+ element.selecting,
337
+ element.inserting
338
+ ));
339
+ }
340
+ else if (element.selecting.length > 0 && element.inserting.length === 0) {
341
+ return ( localizeWithPath(
342
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
343
+ 'aria.del',
344
+ "line {0}, removing {1}",
345
+ element.edit.textEdit.textEdit.range.startLineNumber,
346
+ element.selecting
347
+ ));
348
+ }
349
+ else if (element.selecting.length === 0 && element.inserting.length > 0) {
350
+ return ( localizeWithPath(
351
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
352
+ 'aria.insert',
353
+ "line {0}, inserting {1}",
354
+ element.edit.textEdit.textEdit.range.startLineNumber,
355
+ element.selecting
356
+ ));
357
+ }
358
+ }
359
+ return null;
360
+ }
361
+ };
362
+ BulkEditAccessibilityProvider = ( __decorate([
363
+ ( __param(0, ILabelService))
364
+ ], BulkEditAccessibilityProvider));
365
+ class BulkEditIdentityProvider {
366
+ getId(element) {
367
+ if (element instanceof FileElement) {
368
+ return element.edit.uri + (element.parent instanceof CategoryElement ? JSON.stringify(element.parent.category.metadata) : '');
369
+ }
370
+ else if (element instanceof TextEditElement) {
371
+ return ( element.parent.edit.uri.toString()) + element.idx;
372
+ }
373
+ else {
374
+ return JSON.stringify(element.category.metadata);
375
+ }
376
+ }
377
+ }
378
+ class CategoryElementTemplate {
379
+ constructor(container) {
380
+ container.classList.add('category');
381
+ this.icon = document.createElement('div');
382
+ container.appendChild(this.icon);
383
+ this.label = ( new IconLabel(container));
384
+ }
385
+ }
386
+ let CategoryElementRenderer = class CategoryElementRenderer {
387
+ static { CategoryElementRenderer_1 = this; }
388
+ static { this.id = 'CategoryElementRenderer'; }
389
+ constructor(_themeService) {
390
+ this._themeService = _themeService;
391
+ this.templateId = CategoryElementRenderer_1.id;
392
+ }
393
+ renderTemplate(container) {
394
+ return ( new CategoryElementTemplate(container));
395
+ }
396
+ renderElement(node, _index, template) {
397
+ template.icon.style.setProperty('--background-dark', null);
398
+ template.icon.style.setProperty('--background-light', null);
399
+ template.icon.style.color = '';
400
+ const { metadata } = node.element.category;
401
+ if (ThemeIcon.isThemeIcon(metadata.iconPath)) {
402
+ const className = ThemeIcon.asClassName(metadata.iconPath);
403
+ template.icon.className = className ? `theme-icon ${className}` : '';
404
+ template.icon.style.color = metadata.iconPath.color ? this._themeService.getColorTheme().getColor(metadata.iconPath.color.id)?.toString() ?? '' : '';
405
+ }
406
+ else if (URI.isUri(metadata.iconPath)) {
407
+ template.icon.className = 'uri-icon';
408
+ template.icon.style.setProperty('--background-dark', asCSSUrl(metadata.iconPath));
409
+ template.icon.style.setProperty('--background-light', asCSSUrl(metadata.iconPath));
410
+ }
411
+ else if (metadata.iconPath) {
412
+ template.icon.className = 'uri-icon';
413
+ template.icon.style.setProperty('--background-dark', asCSSUrl(metadata.iconPath.dark));
414
+ template.icon.style.setProperty('--background-light', asCSSUrl(metadata.iconPath.light));
415
+ }
416
+ template.label.setLabel(metadata.label, metadata.description, {
417
+ descriptionMatches: createMatches(node.filterData),
418
+ });
419
+ }
420
+ disposeTemplate(template) {
421
+ template.label.dispose();
422
+ }
423
+ };
424
+ CategoryElementRenderer = CategoryElementRenderer_1 = ( __decorate([
425
+ ( __param(0, IThemeService))
426
+ ], CategoryElementRenderer));
427
+ let FileElementTemplate = class FileElementTemplate {
428
+ constructor(container, resourceLabels, _labelService) {
429
+ this._labelService = _labelService;
430
+ this._disposables = ( new DisposableStore());
431
+ this._localDisposables = ( new DisposableStore());
432
+ this._checkbox = document.createElement('input');
433
+ this._checkbox.className = 'edit-checkbox';
434
+ this._checkbox.type = 'checkbox';
435
+ this._checkbox.setAttribute('role', 'checkbox');
436
+ container.appendChild(this._checkbox);
437
+ this._label = resourceLabels.create(container, { supportHighlights: true });
438
+ this._details = document.createElement('span');
439
+ this._details.className = 'details';
440
+ container.appendChild(this._details);
441
+ }
442
+ dispose() {
443
+ this._localDisposables.dispose();
444
+ this._disposables.dispose();
445
+ this._label.dispose();
446
+ }
447
+ set(element, score) {
448
+ this._localDisposables.clear();
449
+ this._checkbox.checked = element.isChecked();
450
+ this._checkbox.disabled = element.isDisabled();
451
+ this._localDisposables.add(addDisposableListener(this._checkbox, 'change', () => {
452
+ element.setChecked(this._checkbox.checked);
453
+ }));
454
+ if (element.edit.type & 8 && element.edit.newUri) {
455
+ this._label.setResource({
456
+ resource: element.edit.uri,
457
+ name: ( localizeWithPath(
458
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
459
+ 'rename.label',
460
+ "{0} → {1}",
461
+ this._labelService.getUriLabel(element.edit.uri, { relative: true }),
462
+ this._labelService.getUriLabel(element.edit.newUri, { relative: true })
463
+ )),
464
+ }, {
465
+ fileDecorations: { colors: true, badges: false }
466
+ });
467
+ this._details.innerText = ( localizeWithPath(
468
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
469
+ 'detail.rename',
470
+ "(renaming)"
471
+ ));
472
+ }
473
+ else {
474
+ const options = {
475
+ matches: createMatches(score),
476
+ fileKind: FileKind.FILE,
477
+ fileDecorations: { colors: true, badges: false },
478
+ extraClasses: []
479
+ };
480
+ if (element.edit.type & 2 ) {
481
+ this._details.innerText = ( localizeWithPath(
482
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
483
+ 'detail.create',
484
+ "(creating)"
485
+ ));
486
+ }
487
+ else if (element.edit.type & 4 ) {
488
+ this._details.innerText = ( localizeWithPath(
489
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
490
+ 'detail.del',
491
+ "(deleting)"
492
+ ));
493
+ options.extraClasses.push('delete');
494
+ }
495
+ else {
496
+ this._details.innerText = '';
497
+ }
498
+ this._label.setFile(element.edit.uri, options);
499
+ }
500
+ }
501
+ };
502
+ FileElementTemplate = ( __decorate([
503
+ ( __param(2, ILabelService))
504
+ ], FileElementTemplate));
505
+ let FileElementRenderer = class FileElementRenderer {
506
+ static { FileElementRenderer_1 = this; }
507
+ static { this.id = 'FileElementRenderer'; }
508
+ constructor(_resourceLabels, _labelService) {
509
+ this._resourceLabels = _resourceLabels;
510
+ this._labelService = _labelService;
511
+ this.templateId = FileElementRenderer_1.id;
512
+ }
513
+ renderTemplate(container) {
514
+ return ( new FileElementTemplate(container, this._resourceLabels, this._labelService));
515
+ }
516
+ renderElement(node, _index, template) {
517
+ template.set(node.element, node.filterData);
518
+ }
519
+ disposeTemplate(template) {
520
+ template.dispose();
521
+ }
522
+ };
523
+ FileElementRenderer = FileElementRenderer_1 = ( __decorate([
524
+ ( __param(1, ILabelService))
525
+ ], FileElementRenderer));
526
+ let TextEditElementTemplate = class TextEditElementTemplate {
527
+ constructor(container, _themeService) {
528
+ this._themeService = _themeService;
529
+ this._disposables = ( new DisposableStore());
530
+ this._localDisposables = ( new DisposableStore());
531
+ container.classList.add('textedit');
532
+ this._checkbox = document.createElement('input');
533
+ this._checkbox.className = 'edit-checkbox';
534
+ this._checkbox.type = 'checkbox';
535
+ this._checkbox.setAttribute('role', 'checkbox');
536
+ container.appendChild(this._checkbox);
537
+ this._icon = document.createElement('div');
538
+ container.appendChild(this._icon);
539
+ this._label = this._disposables.add(( new HighlightedLabel(container)));
540
+ }
541
+ dispose() {
542
+ this._localDisposables.dispose();
543
+ this._disposables.dispose();
544
+ }
545
+ set(element) {
546
+ this._localDisposables.clear();
547
+ this._localDisposables.add(addDisposableListener(this._checkbox, 'change', e => {
548
+ element.setChecked(this._checkbox.checked);
549
+ e.preventDefault();
550
+ }));
551
+ if (element.parent.isChecked()) {
552
+ this._checkbox.checked = element.isChecked();
553
+ this._checkbox.disabled = element.isDisabled();
554
+ }
555
+ else {
556
+ this._checkbox.checked = element.isChecked();
557
+ this._checkbox.disabled = element.isDisabled();
558
+ }
559
+ let value = '';
560
+ value += element.prefix;
561
+ value += element.selecting;
562
+ value += element.inserting;
563
+ value += element.suffix;
564
+ const selectHighlight = { start: element.prefix.length, end: element.prefix.length + element.selecting.length, extraClasses: ['remove'] };
565
+ const insertHighlight = { start: selectHighlight.end, end: selectHighlight.end + element.inserting.length, extraClasses: ['insert'] };
566
+ let title;
567
+ const { metadata } = element.edit.textEdit;
568
+ if (metadata && metadata.description) {
569
+ title = ( localizeWithPath(
570
+ 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree',
571
+ 'title',
572
+ "{0} - {1}",
573
+ metadata.label,
574
+ metadata.description
575
+ ));
576
+ }
577
+ else if (metadata) {
578
+ title = metadata.label;
579
+ }
580
+ const iconPath = metadata?.iconPath;
581
+ if (!iconPath) {
582
+ this._icon.style.display = 'none';
583
+ }
584
+ else {
585
+ this._icon.style.display = 'block';
586
+ this._icon.style.setProperty('--background-dark', null);
587
+ this._icon.style.setProperty('--background-light', null);
588
+ if (ThemeIcon.isThemeIcon(iconPath)) {
589
+ const className = ThemeIcon.asClassName(iconPath);
590
+ this._icon.className = className ? `theme-icon ${className}` : '';
591
+ this._icon.style.color = iconPath.color ? this._themeService.getColorTheme().getColor(iconPath.color.id)?.toString() ?? '' : '';
592
+ }
593
+ else if (URI.isUri(iconPath)) {
594
+ this._icon.className = 'uri-icon';
595
+ this._icon.style.setProperty('--background-dark', asCSSUrl(iconPath));
596
+ this._icon.style.setProperty('--background-light', asCSSUrl(iconPath));
597
+ }
598
+ else {
599
+ this._icon.className = 'uri-icon';
600
+ this._icon.style.setProperty('--background-dark', asCSSUrl(iconPath.dark));
601
+ this._icon.style.setProperty('--background-light', asCSSUrl(iconPath.light));
602
+ }
603
+ }
604
+ this._label.set(value, [selectHighlight, insertHighlight], title, true);
605
+ this._icon.title = title || '';
606
+ }
607
+ };
608
+ TextEditElementTemplate = ( __decorate([
609
+ ( __param(1, IThemeService))
610
+ ], TextEditElementTemplate));
611
+ let TextEditElementRenderer = class TextEditElementRenderer {
612
+ static { TextEditElementRenderer_1 = this; }
613
+ static { this.id = 'TextEditElementRenderer'; }
614
+ constructor(_themeService) {
615
+ this._themeService = _themeService;
616
+ this.templateId = TextEditElementRenderer_1.id;
617
+ }
618
+ renderTemplate(container) {
619
+ return ( new TextEditElementTemplate(container, this._themeService));
620
+ }
621
+ renderElement({ element }, _index, template) {
622
+ template.set(element);
623
+ }
624
+ disposeTemplate(_template) { }
625
+ };
626
+ TextEditElementRenderer = TextEditElementRenderer_1 = ( __decorate([
627
+ ( __param(0, IThemeService))
628
+ ], TextEditElementRenderer));
629
+ class BulkEditDelegate {
630
+ getHeight() {
631
+ return 23;
632
+ }
633
+ getTemplateId(element) {
634
+ if (element instanceof FileElement) {
635
+ return FileElementRenderer.id;
636
+ }
637
+ else if (element instanceof TextEditElement) {
638
+ return TextEditElementRenderer.id;
639
+ }
640
+ else {
641
+ return CategoryElementRenderer.id;
642
+ }
643
+ }
644
+ }
645
+ class BulkEditNaviLabelProvider {
646
+ getKeyboardNavigationLabel(element) {
647
+ if (element instanceof FileElement) {
648
+ return basename(element.edit.uri);
649
+ }
650
+ else if (element instanceof CategoryElement) {
651
+ return element.category.metadata.label;
652
+ }
653
+ return undefined;
654
+ }
655
+ }
656
+
657
+ export { BulkEditAccessibilityProvider, BulkEditDataSource, BulkEditDelegate, BulkEditIdentityProvider, BulkEditNaviLabelProvider, BulkEditSorter, CategoryElement, CategoryElementRenderer, FileElement, FileElementRenderer, TextEditElement, TextEditElementRenderer, compareBulkFileOperations };