@codingame/monaco-vscode-bulk-edit-service-override 4.5.1 → 5.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.
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.js +58 -117
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkFileEdits.js +2 -2
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.js +2 -2
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.js +61 -118
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane.js +57 -60
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPreview.js +46 -43
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree.js +100 -113
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-bulk-edit-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@5.0.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -21,19 +21,22 @@ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/commo
|
|
|
21
21
|
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
22
22
|
import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service';
|
|
23
23
|
|
|
24
|
+
const _moduleId = "vs/workbench/contrib/bulkEdit/browser/bulkEditService";
|
|
24
25
|
function liftEdits(edits) {
|
|
25
|
-
return (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
return (
|
|
27
|
+
(edits.map(edit => {
|
|
28
|
+
if (ResourceTextEdit.is(edit)) {
|
|
29
|
+
return ResourceTextEdit.lift(edit);
|
|
30
|
+
}
|
|
31
|
+
if (ResourceFileEdit.is(edit)) {
|
|
32
|
+
return ResourceFileEdit.lift(edit);
|
|
33
|
+
}
|
|
34
|
+
if (ResourceNotebookCellEdit.is(edit)) {
|
|
35
|
+
return ResourceNotebookCellEdit.lift(edit);
|
|
36
|
+
}
|
|
37
|
+
throw ( (new Error('Unsupported edit')));
|
|
38
|
+
}))
|
|
39
|
+
);
|
|
37
40
|
}
|
|
38
41
|
let BulkEdit = class BulkEdit {
|
|
39
42
|
constructor(_label, _code, _editor, _progress, _token, _edits, _undoRedoGroup, _undoRedoSource, _confirmBeforeUndo, _instaService, _logService) {
|
|
@@ -50,8 +53,8 @@ let BulkEdit = class BulkEdit {
|
|
|
50
53
|
this._logService = _logService;
|
|
51
54
|
}
|
|
52
55
|
ariaMessage() {
|
|
53
|
-
const otherResources = ( new ResourceMap());
|
|
54
|
-
const textEditResources = ( new ResourceMap());
|
|
56
|
+
const otherResources = ( (new ResourceMap()));
|
|
57
|
+
const textEditResources = ( (new ResourceMap()));
|
|
55
58
|
let textEditCount = 0;
|
|
56
59
|
for (const edit of this._edits) {
|
|
57
60
|
if (edit instanceof ResourceTextEdit) {
|
|
@@ -63,35 +66,26 @@ let BulkEdit = class BulkEdit {
|
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
if (this._edits.length === 0) {
|
|
66
|
-
return ( localizeWithPath(
|
|
67
|
-
'vs/workbench/contrib/bulkEdit/browser/bulkEditService',
|
|
68
|
-
'summary.0',
|
|
69
|
-
"Made no edits"
|
|
70
|
-
));
|
|
69
|
+
return ( localizeWithPath(_moduleId, 0, "Made no edits"));
|
|
71
70
|
}
|
|
72
71
|
else if (otherResources.size === 0) {
|
|
73
72
|
if (textEditCount > 1 && textEditResources.size > 1) {
|
|
74
73
|
return ( localizeWithPath(
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
_moduleId,
|
|
75
|
+
1,
|
|
77
76
|
"Made {0} text edits in {1} files",
|
|
78
77
|
textEditCount,
|
|
79
78
|
textEditResources.size
|
|
80
79
|
));
|
|
81
80
|
}
|
|
82
81
|
else {
|
|
83
|
-
return ( localizeWithPath(
|
|
84
|
-
'vs/workbench/contrib/bulkEdit/browser/bulkEditService',
|
|
85
|
-
'summary.n0',
|
|
86
|
-
"Made {0} text edits in one file",
|
|
87
|
-
textEditCount
|
|
88
|
-
));
|
|
82
|
+
return ( localizeWithPath(_moduleId, 2, "Made {0} text edits in one file", textEditCount));
|
|
89
83
|
}
|
|
90
84
|
}
|
|
91
85
|
else {
|
|
92
86
|
return ( localizeWithPath(
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
_moduleId,
|
|
88
|
+
3,
|
|
95
89
|
"Made {0} text edits in {1} files, also created or deleted {2} files",
|
|
96
90
|
textEditCount,
|
|
97
91
|
textEditResources.size,
|
|
@@ -140,20 +134,12 @@ let BulkEdit = class BulkEdit {
|
|
|
140
134
|
}
|
|
141
135
|
async _performFileEdits(edits, undoRedoGroup, undoRedoSource, confirmBeforeUndo, progress) {
|
|
142
136
|
this._logService.debug('_performFileEdits', JSON.stringify(edits));
|
|
143
|
-
const model = this._instaService.createInstance(BulkFileEdits, this._label || ( localizeWithPath(
|
|
144
|
-
'vs/workbench/contrib/bulkEdit/browser/bulkEditService',
|
|
145
|
-
'workspaceEdit',
|
|
146
|
-
"Workspace Edit"
|
|
147
|
-
)), this._code || 'undoredo.workspaceEdit', undoRedoGroup, undoRedoSource, confirmBeforeUndo, progress, this._token, edits);
|
|
137
|
+
const model = this._instaService.createInstance(BulkFileEdits, this._label || ( localizeWithPath(_moduleId, 4, "Workspace Edit")), this._code || 'undoredo.workspaceEdit', undoRedoGroup, undoRedoSource, confirmBeforeUndo, progress, this._token, edits);
|
|
148
138
|
return await model.apply();
|
|
149
139
|
}
|
|
150
140
|
async _performTextEdits(edits, undoRedoGroup, undoRedoSource, progress) {
|
|
151
141
|
this._logService.debug('_performTextEdits', JSON.stringify(edits));
|
|
152
|
-
const model = this._instaService.createInstance(BulkTextEdits, this._label || ( localizeWithPath(
|
|
153
|
-
'vs/workbench/contrib/bulkEdit/browser/bulkEditService',
|
|
154
|
-
'workspaceEdit',
|
|
155
|
-
"Workspace Edit"
|
|
156
|
-
)), this._code || 'undoredo.workspaceEdit', this._editor, undoRedoGroup, undoRedoSource, progress, this._token, edits);
|
|
142
|
+
const model = this._instaService.createInstance(BulkTextEdits, this._label || ( localizeWithPath(_moduleId, 4, "Workspace Edit")), this._code || 'undoredo.workspaceEdit', this._editor, undoRedoGroup, undoRedoSource, progress, this._token, edits);
|
|
157
143
|
return await model.apply();
|
|
158
144
|
}
|
|
159
145
|
async _performCellEdits(edits, undoRedoGroup, undoRedoSource, progress) {
|
|
@@ -162,10 +148,10 @@ let BulkEdit = class BulkEdit {
|
|
|
162
148
|
return await model.apply();
|
|
163
149
|
}
|
|
164
150
|
};
|
|
165
|
-
BulkEdit = ( __decorate([
|
|
166
|
-
( __param(9, IInstantiationService)),
|
|
167
|
-
( __param(10, ILogService))
|
|
168
|
-
], BulkEdit));
|
|
151
|
+
BulkEdit = ( (__decorate([
|
|
152
|
+
( (__param(9, IInstantiationService))),
|
|
153
|
+
( (__param(10, ILogService)))
|
|
154
|
+
], BulkEdit)));
|
|
169
155
|
let BulkEditService = class BulkEditService {
|
|
170
156
|
constructor(_instaService, _logService, _editorService, _lifecycleService, _dialogService, _workingCopyService, _configService) {
|
|
171
157
|
this._instaService = _instaService;
|
|
@@ -175,7 +161,7 @@ let BulkEditService = class BulkEditService {
|
|
|
175
161
|
this._dialogService = _dialogService;
|
|
176
162
|
this._workingCopyService = _workingCopyService;
|
|
177
163
|
this._configService = _configService;
|
|
178
|
-
this._activeUndoRedoGroups = ( new LinkedList());
|
|
164
|
+
this._activeUndoRedoGroups = ( (new LinkedList()));
|
|
179
165
|
}
|
|
180
166
|
setPreviewHandler(handler) {
|
|
181
167
|
this._previewHandler = handler;
|
|
@@ -191,13 +177,9 @@ let BulkEditService = class BulkEditService {
|
|
|
191
177
|
async apply(editsIn, options) {
|
|
192
178
|
let edits = liftEdits(Array.isArray(editsIn) ? editsIn : editsIn.edits);
|
|
193
179
|
if (edits.length === 0) {
|
|
194
|
-
return { ariaSummary: ( localizeWithPath(
|
|
195
|
-
'vs/workbench/contrib/bulkEdit/browser/bulkEditService',
|
|
196
|
-
'nothing',
|
|
197
|
-
"Made no edits"
|
|
198
|
-
)), isApplied: false };
|
|
180
|
+
return { ariaSummary: ( localizeWithPath(_moduleId, 5, "Made no edits")), isApplied: false };
|
|
199
181
|
}
|
|
200
|
-
if (this._previewHandler && (options?.showPreview || ( edits.some(value => value.metadata?.needsConfirmation)))) {
|
|
182
|
+
if (this._previewHandler && (options?.showPreview || ( (edits.some(value => value.metadata?.needsConfirmation))))) {
|
|
201
183
|
edits = await this._previewHandler(edits, options);
|
|
202
184
|
}
|
|
203
185
|
let codeEditor = options?.editor;
|
|
@@ -224,7 +206,7 @@ let BulkEditService = class BulkEditService {
|
|
|
224
206
|
}
|
|
225
207
|
}
|
|
226
208
|
if (!undoRedoGroup) {
|
|
227
|
-
undoRedoGroup = ( new UndoRedoGroup());
|
|
209
|
+
undoRedoGroup = ( (new UndoRedoGroup()));
|
|
228
210
|
undoRedoGroupRemove = this._activeUndoRedoGroups.push(undoRedoGroup);
|
|
229
211
|
}
|
|
230
212
|
const label = options?.quotableLabel || options?.label;
|
|
@@ -248,12 +230,12 @@ let BulkEditService = class BulkEditService {
|
|
|
248
230
|
}
|
|
249
231
|
}
|
|
250
232
|
async _saveAll(resources) {
|
|
251
|
-
const set = ( new ResourceSet(resources));
|
|
252
|
-
const saves = ( this._workingCopyService.dirtyWorkingCopies.map(async (copy) => {
|
|
253
|
-
if (( set.has(copy.resource))) {
|
|
233
|
+
const set = ( (new ResourceSet(resources)));
|
|
234
|
+
const saves = ( (this._workingCopyService.dirtyWorkingCopies.map(async (copy) => {
|
|
235
|
+
if (( (set.has(copy.resource)))) {
|
|
254
236
|
await copy.save();
|
|
255
237
|
}
|
|
256
|
-
}));
|
|
238
|
+
})));
|
|
257
239
|
const result = await Promise.allSettled(saves);
|
|
258
240
|
for (const item of result) {
|
|
259
241
|
if (item.status === 'rejected') {
|
|
@@ -266,88 +248,47 @@ let BulkEditService = class BulkEditService {
|
|
|
266
248
|
let primaryButton;
|
|
267
249
|
switch (reason) {
|
|
268
250
|
case 1 :
|
|
269
|
-
message = ( localizeWithPath(
|
|
270
|
-
|
|
271
|
-
'closeTheWindow.message',
|
|
272
|
-
"Are you sure you want to close the window?"
|
|
273
|
-
));
|
|
274
|
-
primaryButton = ( localizeWithPath(
|
|
275
|
-
'vs/workbench/contrib/bulkEdit/browser/bulkEditService',
|
|
276
|
-
{ key: 'closeTheWindow', comment: ['&& denotes a mnemonic'] },
|
|
277
|
-
"&&Close Window"
|
|
278
|
-
));
|
|
251
|
+
message = ( localizeWithPath(_moduleId, 6, "Are you sure you want to close the window?"));
|
|
252
|
+
primaryButton = ( localizeWithPath(_moduleId, 7, "&&Close Window"));
|
|
279
253
|
break;
|
|
280
254
|
case 4 :
|
|
281
|
-
message = ( localizeWithPath(
|
|
282
|
-
|
|
283
|
-
'changeWorkspace.message',
|
|
284
|
-
"Are you sure you want to change the workspace?"
|
|
285
|
-
));
|
|
286
|
-
primaryButton = ( localizeWithPath(
|
|
287
|
-
'vs/workbench/contrib/bulkEdit/browser/bulkEditService',
|
|
288
|
-
{ key: 'changeWorkspace', comment: ['&& denotes a mnemonic'] },
|
|
289
|
-
"Change &&Workspace"
|
|
290
|
-
));
|
|
255
|
+
message = ( localizeWithPath(_moduleId, 8, "Are you sure you want to change the workspace?"));
|
|
256
|
+
primaryButton = ( localizeWithPath(_moduleId, 9, "Change &&Workspace"));
|
|
291
257
|
break;
|
|
292
258
|
case 3 :
|
|
293
|
-
message = ( localizeWithPath(
|
|
294
|
-
|
|
295
|
-
'reloadTheWindow.message',
|
|
296
|
-
"Are you sure you want to reload the window?"
|
|
297
|
-
));
|
|
298
|
-
primaryButton = ( localizeWithPath(
|
|
299
|
-
'vs/workbench/contrib/bulkEdit/browser/bulkEditService',
|
|
300
|
-
{ key: 'reloadTheWindow', comment: ['&& denotes a mnemonic'] },
|
|
301
|
-
"&&Reload Window"
|
|
302
|
-
));
|
|
259
|
+
message = ( localizeWithPath(_moduleId, 10, "Are you sure you want to reload the window?"));
|
|
260
|
+
primaryButton = ( localizeWithPath(_moduleId, 11, "&&Reload Window"));
|
|
303
261
|
break;
|
|
304
262
|
default:
|
|
305
|
-
message = ( localizeWithPath(
|
|
306
|
-
|
|
307
|
-
'quit.message',
|
|
308
|
-
"Are you sure you want to quit?"
|
|
309
|
-
));
|
|
310
|
-
primaryButton = ( localizeWithPath(
|
|
311
|
-
'vs/workbench/contrib/bulkEdit/browser/bulkEditService',
|
|
312
|
-
{ key: 'quit', comment: ['&& denotes a mnemonic'] },
|
|
313
|
-
"&&Quit"
|
|
314
|
-
));
|
|
263
|
+
message = ( localizeWithPath(_moduleId, 12, "Are you sure you want to quit?"));
|
|
264
|
+
primaryButton = ( localizeWithPath(_moduleId, 13, "&&Quit"));
|
|
315
265
|
break;
|
|
316
266
|
}
|
|
317
267
|
const result = await this._dialogService.confirm({
|
|
318
268
|
message,
|
|
319
|
-
detail: ( localizeWithPath(
|
|
320
|
-
'vs/workbench/contrib/bulkEdit/browser/bulkEditService',
|
|
321
|
-
'areYouSureQuiteBulkEdit.detail',
|
|
322
|
-
"'{0}' is in progress.",
|
|
323
|
-
label || ( localizeWithPath(
|
|
324
|
-
'vs/workbench/contrib/bulkEdit/browser/bulkEditService',
|
|
325
|
-
'fileOperation',
|
|
326
|
-
"File operation"
|
|
327
|
-
))
|
|
328
|
-
)),
|
|
269
|
+
detail: ( localizeWithPath(_moduleId, 14, "'{0}' is in progress.", label || ( localizeWithPath(_moduleId, 15, "File operation")))),
|
|
329
270
|
primaryButton
|
|
330
271
|
});
|
|
331
272
|
return !result.confirmed;
|
|
332
273
|
}
|
|
333
274
|
};
|
|
334
|
-
BulkEditService = ( __decorate([
|
|
335
|
-
( __param(0, IInstantiationService)),
|
|
336
|
-
( __param(1, ILogService)),
|
|
337
|
-
( __param(2, IEditorService)),
|
|
338
|
-
( __param(3, ILifecycleService)),
|
|
339
|
-
( __param(4, IDialogService)),
|
|
340
|
-
( __param(5, IWorkingCopyService)),
|
|
341
|
-
( __param(6, IConfigurationService))
|
|
342
|
-
], BulkEditService));
|
|
275
|
+
BulkEditService = ( (__decorate([
|
|
276
|
+
( (__param(0, IInstantiationService))),
|
|
277
|
+
( (__param(1, ILogService))),
|
|
278
|
+
( (__param(2, IEditorService))),
|
|
279
|
+
( (__param(3, ILifecycleService))),
|
|
280
|
+
( (__param(4, IDialogService))),
|
|
281
|
+
( (__param(5, IWorkingCopyService))),
|
|
282
|
+
( (__param(6, IConfigurationService)))
|
|
283
|
+
], BulkEditService)));
|
|
343
284
|
const autoSaveSetting = 'files.refactoring.autoSave';
|
|
344
|
-
( Registry.as(Extensions.Configuration)).registerConfiguration({
|
|
285
|
+
( (Registry.as(Extensions.Configuration))).registerConfiguration({
|
|
345
286
|
id: 'files',
|
|
346
287
|
properties: {
|
|
347
288
|
[autoSaveSetting]: {
|
|
348
289
|
description: ( localizeWithPath(
|
|
349
|
-
|
|
350
|
-
|
|
290
|
+
_moduleId,
|
|
291
|
+
16,
|
|
351
292
|
"Controls if files that were part of a refactoring are saved automatically"
|
|
352
293
|
)),
|
|
353
294
|
default: true,
|
|
@@ -212,7 +212,7 @@ let DeleteOperation = class DeleteOperation {
|
|
|
212
212
|
}
|
|
213
213
|
catch (err) {
|
|
214
214
|
if (!edit.options.ignoreIfNotExists) {
|
|
215
|
-
throw new Error(`${edit.oldUri} does not exist and can not be deleted`);
|
|
215
|
+
throw ( new Error(`${edit.oldUri} does not exist and can not be deleted`));
|
|
216
216
|
}
|
|
217
217
|
continue;
|
|
218
218
|
}
|
|
@@ -319,7 +319,7 @@ let BulkFileEdits = class BulkFileEdits {
|
|
|
319
319
|
for (let i = 1; i < edits.length; i++) {
|
|
320
320
|
const edit = edits[i];
|
|
321
321
|
const lastGroup = tail(groups);
|
|
322
|
-
if (lastGroup[0].type === edit.type) {
|
|
322
|
+
if (lastGroup?.[0].type === edit.type) {
|
|
323
323
|
lastGroup.push(edit);
|
|
324
324
|
}
|
|
325
325
|
else {
|
|
@@ -157,7 +157,7 @@ let BulkTextEdits = class BulkTextEdits {
|
|
|
157
157
|
if (typeof edit.versionId === 'number') {
|
|
158
158
|
const model = this._modelService.getModel(edit.resource);
|
|
159
159
|
if (model && model.getVersionId() !== edit.versionId) {
|
|
160
|
-
throw new Error(`${model.uri.toString()} has changed in the meantime`);
|
|
160
|
+
throw ( new Error(`${( model.uri.toString())} has changed in the meantime`));
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
}
|
|
@@ -227,7 +227,7 @@ let BulkTextEdits = class BulkTextEdits {
|
|
|
227
227
|
const resources = [];
|
|
228
228
|
const validation = this._validateTasks(tasks);
|
|
229
229
|
if (!validation.canApply) {
|
|
230
|
-
throw new Error(`${validation.reason.toString()} has changed in the meantime`);
|
|
230
|
+
throw ( new Error(`${( validation.reason.toString())} has changed in the meantime`));
|
|
231
231
|
}
|
|
232
232
|
if (tasks.length === 1) {
|
|
233
233
|
const task = tasks[0];
|
|
@@ -23,6 +23,7 @@ import { registerIcon } from 'vscode/vscode/vs/platform/theme/common/iconRegistr
|
|
|
23
23
|
import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/panecomposite/browser/panecomposite.service';
|
|
24
24
|
|
|
25
25
|
var BulkEditPreviewContribution_1;
|
|
26
|
+
const _moduleId = "vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution";
|
|
26
27
|
async function getBulkEditPane(viewsService) {
|
|
27
28
|
const view = await viewsService.openView(BulkEditPane.ID, true);
|
|
28
29
|
if (view instanceof BulkEditPane) {
|
|
@@ -61,12 +62,12 @@ let UXState = class UXState {
|
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
};
|
|
64
|
-
UXState = ( __decorate([
|
|
65
|
-
( __param(0, IPaneCompositePartService)),
|
|
66
|
-
( __param(1, IEditorGroupsService))
|
|
67
|
-
], UXState));
|
|
65
|
+
UXState = ( (__decorate([
|
|
66
|
+
( (__param(0, IPaneCompositePartService))),
|
|
67
|
+
( (__param(1, IEditorGroupsService)))
|
|
68
|
+
], UXState)));
|
|
68
69
|
class PreviewSession {
|
|
69
|
-
constructor(uxState, cts = ( new CancellationTokenSource())) {
|
|
70
|
+
constructor(uxState, cts = ( (new CancellationTokenSource()))) {
|
|
70
71
|
this.uxState = uxState;
|
|
71
72
|
this.cts = cts;
|
|
72
73
|
}
|
|
@@ -74,7 +75,7 @@ class PreviewSession {
|
|
|
74
75
|
let BulkEditPreviewContribution = class BulkEditPreviewContribution {
|
|
75
76
|
static { BulkEditPreviewContribution_1 = this; }
|
|
76
77
|
static { this.ID = 'workbench.contrib.bulkEditPreview'; }
|
|
77
|
-
static { this.ctxEnabled = ( new RawContextKey('refactorPreview.enabled', false)); }
|
|
78
|
+
static { this.ctxEnabled = ( (new RawContextKey('refactorPreview.enabled', false))); }
|
|
78
79
|
constructor(_paneCompositeService, _viewsService, _editorGroupsService, _dialogService, bulkEditService, contextKeyService) {
|
|
79
80
|
this._paneCompositeService = _paneCompositeService;
|
|
80
81
|
this._viewsService = _viewsService;
|
|
@@ -85,7 +86,7 @@ let BulkEditPreviewContribution = class BulkEditPreviewContribution {
|
|
|
85
86
|
}
|
|
86
87
|
async _previewEdit(edits) {
|
|
87
88
|
this._ctxEnabled.set(true);
|
|
88
|
-
const uxState = this._activeSession?.uxState ?? ( new UXState(this._paneCompositeService, this._editorGroupsService));
|
|
89
|
+
const uxState = this._activeSession?.uxState ?? ( (new UXState(this._paneCompositeService, this._editorGroupsService)));
|
|
89
90
|
const view = await getBulkEditPane(this._viewsService);
|
|
90
91
|
if (!view) {
|
|
91
92
|
this._ctxEnabled.set(false);
|
|
@@ -94,21 +95,13 @@ let BulkEditPreviewContribution = class BulkEditPreviewContribution {
|
|
|
94
95
|
if (view.hasInput()) {
|
|
95
96
|
const { confirmed } = await this._dialogService.confirm({
|
|
96
97
|
type: Severity$1.Info,
|
|
97
|
-
message: ( localizeWithPath(
|
|
98
|
-
'vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution',
|
|
99
|
-
'overlap',
|
|
100
|
-
"Another refactoring is being previewed."
|
|
101
|
-
)),
|
|
98
|
+
message: ( localizeWithPath(_moduleId, 0, "Another refactoring is being previewed.")),
|
|
102
99
|
detail: ( localizeWithPath(
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
_moduleId,
|
|
101
|
+
1,
|
|
105
102
|
"Press 'Continue' to discard the previous refactoring and continue with the current refactoring."
|
|
106
103
|
)),
|
|
107
|
-
primaryButton: ( localizeWithPath(
|
|
108
|
-
'vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution',
|
|
109
|
-
{ key: 'continue', comment: ['&& denotes a mnemonic'] },
|
|
110
|
-
"&&Continue"
|
|
111
|
-
))
|
|
104
|
+
primaryButton: ( localizeWithPath(_moduleId, 2, "&&Continue"))
|
|
112
105
|
});
|
|
113
106
|
if (!confirmed) {
|
|
114
107
|
return [];
|
|
@@ -118,10 +111,10 @@ let BulkEditPreviewContribution = class BulkEditPreviewContribution {
|
|
|
118
111
|
if (this._activeSession) {
|
|
119
112
|
await this._activeSession.uxState.restore(false, true);
|
|
120
113
|
this._activeSession.cts.dispose(true);
|
|
121
|
-
session = ( new PreviewSession(uxState));
|
|
114
|
+
session = ( (new PreviewSession(uxState)));
|
|
122
115
|
}
|
|
123
116
|
else {
|
|
124
|
-
session = ( new PreviewSession(uxState));
|
|
117
|
+
session = ( (new PreviewSession(uxState)));
|
|
125
118
|
}
|
|
126
119
|
this._activeSession = session;
|
|
127
120
|
try {
|
|
@@ -137,37 +130,32 @@ let BulkEditPreviewContribution = class BulkEditPreviewContribution {
|
|
|
137
130
|
}
|
|
138
131
|
}
|
|
139
132
|
};
|
|
140
|
-
BulkEditPreviewContribution = BulkEditPreviewContribution_1 = ( __decorate([
|
|
141
|
-
( __param(0, IPaneCompositePartService)),
|
|
142
|
-
( __param(1, IViewsService)),
|
|
143
|
-
( __param(2, IEditorGroupsService)),
|
|
144
|
-
( __param(3, IDialogService)),
|
|
145
|
-
( __param(4, IBulkEditService)),
|
|
146
|
-
( __param(5, IContextKeyService))
|
|
147
|
-
], BulkEditPreviewContribution));
|
|
133
|
+
BulkEditPreviewContribution = BulkEditPreviewContribution_1 = ( (__decorate([
|
|
134
|
+
( (__param(0, IPaneCompositePartService))),
|
|
135
|
+
( (__param(1, IViewsService))),
|
|
136
|
+
( (__param(2, IEditorGroupsService))),
|
|
137
|
+
( (__param(3, IDialogService))),
|
|
138
|
+
( (__param(4, IBulkEditService))),
|
|
139
|
+
( (__param(5, IContextKeyService)))
|
|
140
|
+
], BulkEditPreviewContribution)));
|
|
148
141
|
registerAction2(class ApplyAction extends Action2 {
|
|
149
142
|
constructor() {
|
|
150
143
|
super({
|
|
151
144
|
id: 'refactorPreview.apply',
|
|
152
|
-
title: ( localize2WithPath(
|
|
153
|
-
|
|
154
|
-
'apply',
|
|
155
|
-
"Apply Refactoring"
|
|
156
|
-
)),
|
|
157
|
-
category: ( localize2WithPath(
|
|
158
|
-
'vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution',
|
|
159
|
-
'cat',
|
|
160
|
-
"Refactor Preview"
|
|
161
|
-
)),
|
|
145
|
+
title: ( localize2WithPath(_moduleId, 3, "Apply Refactoring")),
|
|
146
|
+
category: ( localize2WithPath(_moduleId, 4, "Refactor Preview")),
|
|
162
147
|
icon: Codicon.check,
|
|
163
|
-
precondition: ( ContextKeyExpr.and(BulkEditPreviewContribution.ctxEnabled, BulkEditPane.ctxHasCheckedChanges)),
|
|
148
|
+
precondition: ( (ContextKeyExpr.and(BulkEditPreviewContribution.ctxEnabled, BulkEditPane.ctxHasCheckedChanges))),
|
|
164
149
|
menu: [{
|
|
165
150
|
id: MenuId.BulkEditContext,
|
|
166
151
|
order: 1
|
|
167
152
|
}],
|
|
168
153
|
keybinding: {
|
|
169
154
|
weight: 100 - 10,
|
|
170
|
-
when: ( ContextKeyExpr.and(
|
|
155
|
+
when: ( (ContextKeyExpr.and(
|
|
156
|
+
BulkEditPreviewContribution.ctxEnabled,
|
|
157
|
+
(FocusedViewContext.isEqualTo(BulkEditPane.ID))
|
|
158
|
+
))),
|
|
171
159
|
primary: 2048 + 3 ,
|
|
172
160
|
}
|
|
173
161
|
});
|
|
@@ -182,16 +170,8 @@ registerAction2(class DiscardAction extends Action2 {
|
|
|
182
170
|
constructor() {
|
|
183
171
|
super({
|
|
184
172
|
id: 'refactorPreview.discard',
|
|
185
|
-
title: ( localize2WithPath(
|
|
186
|
-
|
|
187
|
-
'Discard',
|
|
188
|
-
"Discard Refactoring"
|
|
189
|
-
)),
|
|
190
|
-
category: ( localize2WithPath(
|
|
191
|
-
'vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution',
|
|
192
|
-
'cat',
|
|
193
|
-
"Refactor Preview"
|
|
194
|
-
)),
|
|
173
|
+
title: ( localize2WithPath(_moduleId, 5, "Discard Refactoring")),
|
|
174
|
+
category: ( localize2WithPath(_moduleId, 4, "Refactor Preview")),
|
|
195
175
|
icon: Codicon.clearAll,
|
|
196
176
|
precondition: BulkEditPreviewContribution.ctxEnabled,
|
|
197
177
|
menu: [{
|
|
@@ -210,16 +190,8 @@ registerAction2(class ToggleAction extends Action2 {
|
|
|
210
190
|
constructor() {
|
|
211
191
|
super({
|
|
212
192
|
id: 'refactorPreview.toggleCheckedState',
|
|
213
|
-
title: ( localize2WithPath(
|
|
214
|
-
|
|
215
|
-
'toogleSelection',
|
|
216
|
-
"Toggle Change"
|
|
217
|
-
)),
|
|
218
|
-
category: ( localize2WithPath(
|
|
219
|
-
'vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution',
|
|
220
|
-
'cat',
|
|
221
|
-
"Refactor Preview"
|
|
222
|
-
)),
|
|
193
|
+
title: ( localize2WithPath(_moduleId, 6, "Toggle Change")),
|
|
194
|
+
category: ( localize2WithPath(_moduleId, 4, "Refactor Preview")),
|
|
223
195
|
precondition: BulkEditPreviewContribution.ctxEnabled,
|
|
224
196
|
keybinding: {
|
|
225
197
|
weight: 200 ,
|
|
@@ -242,21 +214,20 @@ registerAction2(class GroupByFile extends Action2 {
|
|
|
242
214
|
constructor() {
|
|
243
215
|
super({
|
|
244
216
|
id: 'refactorPreview.groupByFile',
|
|
245
|
-
title: ( localize2WithPath(
|
|
246
|
-
|
|
247
|
-
'groupByFile',
|
|
248
|
-
"Group Changes By File"
|
|
249
|
-
)),
|
|
250
|
-
category: ( localize2WithPath(
|
|
251
|
-
'vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution',
|
|
252
|
-
'cat',
|
|
253
|
-
"Refactor Preview"
|
|
254
|
-
)),
|
|
217
|
+
title: ( localize2WithPath(_moduleId, 7, "Group Changes By File")),
|
|
218
|
+
category: ( localize2WithPath(_moduleId, 4, "Refactor Preview")),
|
|
255
219
|
icon: Codicon.ungroupByRefType,
|
|
256
|
-
precondition: ( ContextKeyExpr.and(
|
|
220
|
+
precondition: ( (ContextKeyExpr.and(
|
|
221
|
+
BulkEditPane.ctxHasCategories,
|
|
222
|
+
(BulkEditPane.ctxGroupByFile.negate()),
|
|
223
|
+
BulkEditPreviewContribution.ctxEnabled
|
|
224
|
+
))),
|
|
257
225
|
menu: [{
|
|
258
226
|
id: MenuId.BulkEditTitle,
|
|
259
|
-
when: ( ContextKeyExpr.and(
|
|
227
|
+
when: ( (ContextKeyExpr.and(
|
|
228
|
+
BulkEditPane.ctxHasCategories,
|
|
229
|
+
(BulkEditPane.ctxGroupByFile.negate())
|
|
230
|
+
))),
|
|
260
231
|
group: 'navigation',
|
|
261
232
|
order: 3,
|
|
262
233
|
}]
|
|
@@ -272,25 +243,17 @@ registerAction2(class GroupByType extends Action2 {
|
|
|
272
243
|
constructor() {
|
|
273
244
|
super({
|
|
274
245
|
id: 'refactorPreview.groupByType',
|
|
275
|
-
title: ( localize2WithPath(
|
|
276
|
-
|
|
277
|
-
'groupByType',
|
|
278
|
-
"Group Changes By Type"
|
|
279
|
-
)),
|
|
280
|
-
category: ( localize2WithPath(
|
|
281
|
-
'vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution',
|
|
282
|
-
'cat',
|
|
283
|
-
"Refactor Preview"
|
|
284
|
-
)),
|
|
246
|
+
title: ( localize2WithPath(_moduleId, 8, "Group Changes By Type")),
|
|
247
|
+
category: ( localize2WithPath(_moduleId, 4, "Refactor Preview")),
|
|
285
248
|
icon: Codicon.groupByRefType,
|
|
286
|
-
precondition: ( ContextKeyExpr.and(
|
|
249
|
+
precondition: ( (ContextKeyExpr.and(
|
|
287
250
|
BulkEditPane.ctxHasCategories,
|
|
288
251
|
BulkEditPane.ctxGroupByFile,
|
|
289
252
|
BulkEditPreviewContribution.ctxEnabled
|
|
290
|
-
)),
|
|
253
|
+
))),
|
|
291
254
|
menu: [{
|
|
292
255
|
id: MenuId.BulkEditTitle,
|
|
293
|
-
when: ( ContextKeyExpr.and(BulkEditPane.ctxHasCategories, BulkEditPane.ctxGroupByFile)),
|
|
256
|
+
when: ( (ContextKeyExpr.and(BulkEditPane.ctxHasCategories, BulkEditPane.ctxGroupByFile))),
|
|
294
257
|
group: 'navigation',
|
|
295
258
|
order: 3
|
|
296
259
|
}]
|
|
@@ -306,19 +269,11 @@ registerAction2(class ToggleGrouping extends Action2 {
|
|
|
306
269
|
constructor() {
|
|
307
270
|
super({
|
|
308
271
|
id: 'refactorPreview.toggleGrouping',
|
|
309
|
-
title: ( localize2WithPath(
|
|
310
|
-
|
|
311
|
-
'groupByType',
|
|
312
|
-
"Group Changes By Type"
|
|
313
|
-
)),
|
|
314
|
-
category: ( localize2WithPath(
|
|
315
|
-
'vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution',
|
|
316
|
-
'cat',
|
|
317
|
-
"Refactor Preview"
|
|
318
|
-
)),
|
|
272
|
+
title: ( localize2WithPath(_moduleId, 8, "Group Changes By Type")),
|
|
273
|
+
category: ( localize2WithPath(_moduleId, 4, "Refactor Preview")),
|
|
319
274
|
icon: Codicon.listTree,
|
|
320
|
-
toggled: ( BulkEditPane.ctxGroupByFile.negate()),
|
|
321
|
-
precondition: ( ContextKeyExpr.and(BulkEditPane.ctxHasCategories, BulkEditPreviewContribution.ctxEnabled)),
|
|
275
|
+
toggled: ( (BulkEditPane.ctxGroupByFile.negate())),
|
|
276
|
+
precondition: ( (ContextKeyExpr.and(BulkEditPane.ctxHasCategories, BulkEditPreviewContribution.ctxEnabled))),
|
|
322
277
|
menu: [{
|
|
323
278
|
id: MenuId.BulkEditContext,
|
|
324
279
|
order: 3
|
|
@@ -332,34 +287,22 @@ registerAction2(class ToggleGrouping extends Action2 {
|
|
|
332
287
|
}
|
|
333
288
|
});
|
|
334
289
|
registerWorkbenchContribution2(BulkEditPreviewContribution.ID, BulkEditPreviewContribution, 2 );
|
|
335
|
-
const refactorPreviewViewIcon = registerIcon('refactor-preview-view-icon', Codicon.lightbulb, ( localizeWithPath(
|
|
336
|
-
|
|
337
|
-
'refactorPreviewViewIcon',
|
|
338
|
-
'View icon of the refactor preview view.'
|
|
339
|
-
)));
|
|
340
|
-
const container = ( Registry.as(Extensions.ViewContainersRegistry)).registerViewContainer({
|
|
290
|
+
const refactorPreviewViewIcon = registerIcon('refactor-preview-view-icon', Codicon.lightbulb, ( localizeWithPath(_moduleId, 9, 'View icon of the refactor preview view.')));
|
|
291
|
+
const container = ( (Registry.as(Extensions.ViewContainersRegistry))).registerViewContainer({
|
|
341
292
|
id: BulkEditPane.ID,
|
|
342
|
-
title: ( localize2WithPath(
|
|
343
|
-
'vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution',
|
|
344
|
-
'panel',
|
|
345
|
-
"Refactor Preview"
|
|
346
|
-
)),
|
|
293
|
+
title: ( localize2WithPath(_moduleId, 10, "Refactor Preview")),
|
|
347
294
|
hideIfEmpty: true,
|
|
348
|
-
ctorDescriptor: ( new SyncDescriptor(
|
|
295
|
+
ctorDescriptor: ( (new SyncDescriptor(
|
|
349
296
|
ViewPaneContainer,
|
|
350
297
|
[BulkEditPane.ID, { mergeViewWithContainerWhenSingleView: true }]
|
|
351
|
-
)),
|
|
298
|
+
))),
|
|
352
299
|
icon: refactorPreviewViewIcon,
|
|
353
300
|
storageId: BulkEditPane.ID
|
|
354
301
|
}, 1 );
|
|
355
|
-
( Registry.as(Extensions.ViewsRegistry)).registerViews([{
|
|
302
|
+
( (Registry.as(Extensions.ViewsRegistry))).registerViews([{
|
|
356
303
|
id: BulkEditPane.ID,
|
|
357
|
-
name: ( localize2WithPath(
|
|
358
|
-
'vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution',
|
|
359
|
-
'panel',
|
|
360
|
-
"Refactor Preview"
|
|
361
|
-
)),
|
|
304
|
+
name: ( localize2WithPath(_moduleId, 10, "Refactor Preview")),
|
|
362
305
|
when: BulkEditPreviewContribution.ctxEnabled,
|
|
363
|
-
ctorDescriptor: ( new SyncDescriptor(BulkEditPane)),
|
|
306
|
+
ctorDescriptor: ( (new SyncDescriptor(BulkEditPane))),
|
|
364
307
|
containerIcon: refactorPreviewViewIcon,
|
|
365
308
|
}], container);
|