@codingame/monaco-vscode-bulk-edit-service-override 25.1.2 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.js +117 -84
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkFileEdits.js +119 -91
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.js +54 -36
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/conflicts.js +8 -16
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/opaqueEdits.js +15 -13
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.js +95 -83
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.css +0 -1
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane.js +118 -71
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPreview.js +73 -59
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree.js +183 -171
|
@@ -41,10 +41,9 @@ let UXState = class UXState {
|
|
|
41
41
|
}
|
|
42
42
|
async restore(panels, editors) {
|
|
43
43
|
if (panels) {
|
|
44
|
-
if (typeof this._activePanel ===
|
|
44
|
+
if (typeof this._activePanel === "string") {
|
|
45
45
|
await this._paneCompositeService.openPaneComposite(this._activePanel, ViewContainerLocation.Panel);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
46
|
+
} else {
|
|
48
47
|
this._paneCompositeService.hideActivePaneComposite(ViewContainerLocation.Panel);
|
|
49
48
|
}
|
|
50
49
|
}
|
|
@@ -52,33 +51,50 @@ let UXState = class UXState {
|
|
|
52
51
|
for (const group of this._editorGroupsService.groups) {
|
|
53
52
|
const previewEditors = [];
|
|
54
53
|
for (const input of group.editors) {
|
|
55
|
-
const resource = EditorResourceAccessor.getCanonicalUri(input, {
|
|
54
|
+
const resource = EditorResourceAccessor.getCanonicalUri(input, {
|
|
55
|
+
supportSideBySide: SideBySideEditor.PRIMARY
|
|
56
|
+
});
|
|
56
57
|
if (resource?.scheme === BulkEditPane.Schema) {
|
|
57
58
|
previewEditors.push(input);
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
if (previewEditors.length) {
|
|
61
|
-
group.closeEditors(previewEditors, {
|
|
62
|
+
group.closeEditors(previewEditors, {
|
|
63
|
+
preserveFocus: true
|
|
64
|
+
});
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
};
|
|
67
|
-
UXState = ( __decorate([
|
|
68
|
-
( __param(0, IPaneCompositePartService)),
|
|
69
|
-
( __param(1, IEditorGroupsService))
|
|
70
|
-
], UXState));
|
|
70
|
+
UXState = ( __decorate([( __param(0, IPaneCompositePartService)), ( __param(1, IEditorGroupsService))], UXState));
|
|
71
71
|
class PreviewSession {
|
|
72
|
-
constructor(
|
|
72
|
+
constructor(
|
|
73
|
+
uxState,
|
|
74
|
+
cts = ( new CancellationTokenSource())
|
|
75
|
+
) {
|
|
73
76
|
this.uxState = uxState;
|
|
74
77
|
this.cts = cts;
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
let BulkEditPreviewContribution = class BulkEditPreviewContribution {
|
|
78
|
-
static {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
static {
|
|
82
|
+
BulkEditPreviewContribution_1 = this;
|
|
83
|
+
}
|
|
84
|
+
static {
|
|
85
|
+
this.ID = "workbench.contrib.bulkEditPreview";
|
|
86
|
+
}
|
|
87
|
+
static {
|
|
88
|
+
this.ctxEnabled = ( new RawContextKey("refactorPreview.enabled", false));
|
|
89
|
+
}
|
|
90
|
+
constructor(
|
|
91
|
+
_paneCompositeService,
|
|
92
|
+
_viewsService,
|
|
93
|
+
_editorGroupsService,
|
|
94
|
+
_dialogService,
|
|
95
|
+
bulkEditService,
|
|
96
|
+
contextKeyService
|
|
97
|
+
) {
|
|
82
98
|
this._paneCompositeService = _paneCompositeService;
|
|
83
99
|
this._viewsService = _viewsService;
|
|
84
100
|
this._editorGroupsService = _editorGroupsService;
|
|
@@ -95,14 +111,16 @@ let BulkEditPreviewContribution = class BulkEditPreviewContribution {
|
|
|
95
111
|
return edits;
|
|
96
112
|
}
|
|
97
113
|
if (view.hasInput()) {
|
|
98
|
-
const {
|
|
114
|
+
const {
|
|
115
|
+
confirmed
|
|
116
|
+
} = await this._dialogService.confirm({
|
|
99
117
|
type: Severity.Info,
|
|
100
|
-
message: ( localize(
|
|
118
|
+
message: ( localize(4530, "Another refactoring is being previewed.")),
|
|
101
119
|
detail: ( localize(
|
|
102
|
-
|
|
120
|
+
4531,
|
|
103
121
|
"Press 'Continue' to discard the previous refactoring and continue with the current refactoring."
|
|
104
122
|
)),
|
|
105
|
-
primaryButton: ( localize(
|
|
123
|
+
primaryButton: ( localize(4532, "&&Continue"))
|
|
106
124
|
});
|
|
107
125
|
if (!confirmed) {
|
|
108
126
|
return [];
|
|
@@ -113,15 +131,13 @@ let BulkEditPreviewContribution = class BulkEditPreviewContribution {
|
|
|
113
131
|
await this._activeSession.uxState.restore(false, true);
|
|
114
132
|
this._activeSession.cts.dispose(true);
|
|
115
133
|
session = ( new PreviewSession(uxState));
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
134
|
+
} else {
|
|
118
135
|
session = ( new PreviewSession(uxState));
|
|
119
136
|
}
|
|
120
137
|
this._activeSession = session;
|
|
121
138
|
try {
|
|
122
139
|
return (await view.setInput(edits, session.cts.token)) ?? [];
|
|
123
|
-
}
|
|
124
|
-
finally {
|
|
140
|
+
} finally {
|
|
125
141
|
if (this._activeSession === session) {
|
|
126
142
|
await this._activeSession.uxState.restore(true, true);
|
|
127
143
|
this._activeSession.cts.dispose();
|
|
@@ -131,30 +147,23 @@ let BulkEditPreviewContribution = class BulkEditPreviewContribution {
|
|
|
131
147
|
}
|
|
132
148
|
}
|
|
133
149
|
};
|
|
134
|
-
BulkEditPreviewContribution = BulkEditPreviewContribution_1 = ( __decorate([
|
|
135
|
-
( __param(0, IPaneCompositePartService)),
|
|
136
|
-
( __param(1, IViewsService)),
|
|
137
|
-
( __param(2, IEditorGroupsService)),
|
|
138
|
-
( __param(3, IDialogService)),
|
|
139
|
-
( __param(4, IBulkEditService)),
|
|
140
|
-
( __param(5, IContextKeyService))
|
|
141
|
-
], BulkEditPreviewContribution));
|
|
150
|
+
BulkEditPreviewContribution = BulkEditPreviewContribution_1 = ( __decorate([( __param(0, IPaneCompositePartService)), ( __param(1, IViewsService)), ( __param(2, IEditorGroupsService)), ( __param(3, IDialogService)), ( __param(4, IBulkEditService)), ( __param(5, IContextKeyService))], BulkEditPreviewContribution));
|
|
142
151
|
registerAction2(class ApplyAction extends Action2 {
|
|
143
152
|
constructor() {
|
|
144
153
|
super({
|
|
145
|
-
id:
|
|
146
|
-
title: ( localize2(
|
|
147
|
-
category: ( localize2(
|
|
154
|
+
id: "refactorPreview.apply",
|
|
155
|
+
title: ( localize2(4533, "Apply Refactoring")),
|
|
156
|
+
category: ( localize2(4534, "Refactor Preview")),
|
|
148
157
|
icon: Codicon.check,
|
|
149
158
|
precondition: ( ContextKeyExpr.and(BulkEditPreviewContribution.ctxEnabled, BulkEditPane.ctxHasCheckedChanges)),
|
|
150
159
|
menu: [{
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
160
|
+
id: MenuId.BulkEditContext,
|
|
161
|
+
order: 1
|
|
162
|
+
}],
|
|
154
163
|
keybinding: {
|
|
155
164
|
weight: KeybindingWeight.EditorContrib - 10,
|
|
156
165
|
when: ( ContextKeyExpr.and(BulkEditPreviewContribution.ctxEnabled, ( FocusedViewContext.isEqualTo(BulkEditPane.ID)))),
|
|
157
|
-
primary: KeyMod.CtrlCmd + KeyCode.Enter
|
|
166
|
+
primary: KeyMod.CtrlCmd + KeyCode.Enter
|
|
158
167
|
}
|
|
159
168
|
});
|
|
160
169
|
}
|
|
@@ -167,15 +176,15 @@ registerAction2(class ApplyAction extends Action2 {
|
|
|
167
176
|
registerAction2(class DiscardAction extends Action2 {
|
|
168
177
|
constructor() {
|
|
169
178
|
super({
|
|
170
|
-
id:
|
|
171
|
-
title: ( localize2(
|
|
172
|
-
category: ( localize2(
|
|
179
|
+
id: "refactorPreview.discard",
|
|
180
|
+
title: ( localize2(4535, "Discard Refactoring")),
|
|
181
|
+
category: ( localize2(4534, "Refactor Preview")),
|
|
173
182
|
icon: Codicon.clearAll,
|
|
174
183
|
precondition: BulkEditPreviewContribution.ctxEnabled,
|
|
175
184
|
menu: [{
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
185
|
+
id: MenuId.BulkEditContext,
|
|
186
|
+
order: 2
|
|
187
|
+
}]
|
|
179
188
|
});
|
|
180
189
|
}
|
|
181
190
|
async run(accessor) {
|
|
@@ -187,18 +196,18 @@ registerAction2(class DiscardAction extends Action2 {
|
|
|
187
196
|
registerAction2(class ToggleAction extends Action2 {
|
|
188
197
|
constructor() {
|
|
189
198
|
super({
|
|
190
|
-
id:
|
|
191
|
-
title: ( localize2(
|
|
192
|
-
category: ( localize2(
|
|
199
|
+
id: "refactorPreview.toggleCheckedState",
|
|
200
|
+
title: ( localize2(4536, "Toggle Change")),
|
|
201
|
+
category: ( localize2(4534, "Refactor Preview")),
|
|
193
202
|
precondition: BulkEditPreviewContribution.ctxEnabled,
|
|
194
203
|
keybinding: {
|
|
195
204
|
weight: KeybindingWeight.WorkbenchContrib,
|
|
196
205
|
when: WorkbenchListFocusContextKey,
|
|
197
|
-
primary: KeyCode.Space
|
|
206
|
+
primary: KeyCode.Space
|
|
198
207
|
},
|
|
199
208
|
menu: {
|
|
200
209
|
id: MenuId.BulkEditContext,
|
|
201
|
-
group:
|
|
210
|
+
group: "navigation"
|
|
202
211
|
}
|
|
203
212
|
});
|
|
204
213
|
}
|
|
@@ -211,17 +220,17 @@ registerAction2(class ToggleAction extends Action2 {
|
|
|
211
220
|
registerAction2(class GroupByFile extends Action2 {
|
|
212
221
|
constructor() {
|
|
213
222
|
super({
|
|
214
|
-
id:
|
|
215
|
-
title: ( localize2(
|
|
216
|
-
category: ( localize2(
|
|
223
|
+
id: "refactorPreview.groupByFile",
|
|
224
|
+
title: ( localize2(4537, "Group Changes By File")),
|
|
225
|
+
category: ( localize2(4534, "Refactor Preview")),
|
|
217
226
|
icon: Codicon.ungroupByRefType,
|
|
218
227
|
precondition: ( ContextKeyExpr.and(BulkEditPane.ctxHasCategories, ( BulkEditPane.ctxGroupByFile.negate()), BulkEditPreviewContribution.ctxEnabled)),
|
|
219
228
|
menu: [{
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
229
|
+
id: MenuId.BulkEditTitle,
|
|
230
|
+
when: ( ContextKeyExpr.and(BulkEditPane.ctxHasCategories, ( BulkEditPane.ctxGroupByFile.negate()))),
|
|
231
|
+
group: "navigation",
|
|
232
|
+
order: 3
|
|
233
|
+
}]
|
|
225
234
|
});
|
|
226
235
|
}
|
|
227
236
|
async run(accessor) {
|
|
@@ -233,9 +242,9 @@ registerAction2(class GroupByFile extends Action2 {
|
|
|
233
242
|
registerAction2(class GroupByType extends Action2 {
|
|
234
243
|
constructor() {
|
|
235
244
|
super({
|
|
236
|
-
id:
|
|
237
|
-
title: ( localize2(
|
|
238
|
-
category: ( localize2(
|
|
245
|
+
id: "refactorPreview.groupByType",
|
|
246
|
+
title: ( localize2(4538, "Group Changes By Type")),
|
|
247
|
+
category: ( localize2(4534, "Refactor Preview")),
|
|
239
248
|
icon: Codicon.groupByRefType,
|
|
240
249
|
precondition: ( ContextKeyExpr.and(
|
|
241
250
|
BulkEditPane.ctxHasCategories,
|
|
@@ -243,11 +252,11 @@ registerAction2(class GroupByType extends Action2 {
|
|
|
243
252
|
BulkEditPreviewContribution.ctxEnabled
|
|
244
253
|
)),
|
|
245
254
|
menu: [{
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
255
|
+
id: MenuId.BulkEditTitle,
|
|
256
|
+
when: ( ContextKeyExpr.and(BulkEditPane.ctxHasCategories, BulkEditPane.ctxGroupByFile)),
|
|
257
|
+
group: "navigation",
|
|
258
|
+
order: 3
|
|
259
|
+
}]
|
|
251
260
|
});
|
|
252
261
|
}
|
|
253
262
|
async run(accessor) {
|
|
@@ -259,16 +268,16 @@ registerAction2(class GroupByType extends Action2 {
|
|
|
259
268
|
registerAction2(class ToggleGrouping extends Action2 {
|
|
260
269
|
constructor() {
|
|
261
270
|
super({
|
|
262
|
-
id:
|
|
263
|
-
title: ( localize2(
|
|
264
|
-
category: ( localize2(
|
|
271
|
+
id: "refactorPreview.toggleGrouping",
|
|
272
|
+
title: ( localize2(4538, "Group Changes By Type")),
|
|
273
|
+
category: ( localize2(4534, "Refactor Preview")),
|
|
265
274
|
icon: Codicon.listTree,
|
|
266
275
|
toggled: ( BulkEditPane.ctxGroupByFile.negate()),
|
|
267
276
|
precondition: ( ContextKeyExpr.and(BulkEditPane.ctxHasCategories, BulkEditPreviewContribution.ctxEnabled)),
|
|
268
277
|
menu: [{
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
278
|
+
id: MenuId.BulkEditContext,
|
|
279
|
+
order: 3
|
|
280
|
+
}]
|
|
272
281
|
});
|
|
273
282
|
}
|
|
274
283
|
async run(accessor) {
|
|
@@ -277,23 +286,26 @@ registerAction2(class ToggleGrouping extends Action2 {
|
|
|
277
286
|
view?.toggleGrouping();
|
|
278
287
|
}
|
|
279
288
|
});
|
|
280
|
-
registerWorkbenchContribution2(
|
|
281
|
-
|
|
289
|
+
registerWorkbenchContribution2(
|
|
290
|
+
BulkEditPreviewContribution.ID,
|
|
291
|
+
BulkEditPreviewContribution,
|
|
292
|
+
WorkbenchPhase.BlockRestore
|
|
293
|
+
);
|
|
294
|
+
const refactorPreviewViewIcon = registerIcon("refactor-preview-view-icon", Codicon.lightbulb, ( localize(4539, "View icon of the refactor preview view.")));
|
|
282
295
|
const container = ( Registry.as(Extensions.ViewContainersRegistry)).registerViewContainer({
|
|
283
296
|
id: BulkEditPane.ID,
|
|
284
|
-
title: ( localize2(
|
|
297
|
+
title: ( localize2(4540, "Refactor Preview")),
|
|
285
298
|
hideIfEmpty: true,
|
|
286
|
-
ctorDescriptor: ( new SyncDescriptor(
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
)),
|
|
299
|
+
ctorDescriptor: ( new SyncDescriptor(ViewPaneContainer, [BulkEditPane.ID, {
|
|
300
|
+
mergeViewWithContainerWhenSingleView: true
|
|
301
|
+
}])),
|
|
290
302
|
icon: refactorPreviewViewIcon,
|
|
291
303
|
storageId: BulkEditPane.ID
|
|
292
304
|
}, ViewContainerLocation.Panel);
|
|
293
305
|
( Registry.as(Extensions.ViewsRegistry)).registerViews([{
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
306
|
+
id: BulkEditPane.ID,
|
|
307
|
+
name: ( localize2(4540, "Refactor Preview")),
|
|
308
|
+
when: BulkEditPreviewContribution.ctxEnabled,
|
|
309
|
+
ctorDescriptor: ( new SyncDescriptor(BulkEditPane)),
|
|
310
|
+
containerIcon: refactorPreviewViewIcon
|
|
311
|
+
}], container);
|
|
@@ -36,20 +36,54 @@ import { createElement } from '@codingame/monaco-vscode-api/vscode/vs/base/brows
|
|
|
36
36
|
var BulkEditPane_1;
|
|
37
37
|
registerCss(bulkEdit);
|
|
38
38
|
var State;
|
|
39
|
-
(function
|
|
39
|
+
(function(State) {
|
|
40
40
|
State["Data"] = "data";
|
|
41
41
|
State["Message"] = "message";
|
|
42
42
|
})(State || (State = {}));
|
|
43
43
|
let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
44
|
-
static {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
static {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
static {
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
static {
|
|
45
|
+
BulkEditPane_1 = this;
|
|
46
|
+
}
|
|
47
|
+
static {
|
|
48
|
+
this.ID = "refactorPreview";
|
|
49
|
+
}
|
|
50
|
+
static {
|
|
51
|
+
this.Schema = "vscode-bulkeditpreview-multieditor";
|
|
52
|
+
}
|
|
53
|
+
static {
|
|
54
|
+
this.ctxHasCategories = ( new RawContextKey("refactorPreview.hasCategories", false));
|
|
55
|
+
}
|
|
56
|
+
static {
|
|
57
|
+
this.ctxGroupByFile = ( new RawContextKey("refactorPreview.groupByFile", true));
|
|
58
|
+
}
|
|
59
|
+
static {
|
|
60
|
+
this.ctxHasCheckedChanges = ( new RawContextKey("refactorPreview.hasCheckedChanges", true));
|
|
61
|
+
}
|
|
62
|
+
static {
|
|
63
|
+
this._memGroupByFile = `${this.ID}.groupByFile`;
|
|
64
|
+
}
|
|
65
|
+
constructor(
|
|
66
|
+
options,
|
|
67
|
+
_instaService,
|
|
68
|
+
_editorService,
|
|
69
|
+
_labelService,
|
|
70
|
+
_textModelService,
|
|
71
|
+
_dialogService,
|
|
72
|
+
_contextMenuService,
|
|
73
|
+
_storageService,
|
|
74
|
+
contextKeyService,
|
|
75
|
+
viewDescriptorService,
|
|
76
|
+
keybindingService,
|
|
77
|
+
contextMenuService,
|
|
78
|
+
configurationService,
|
|
79
|
+
openerService,
|
|
80
|
+
themeService,
|
|
81
|
+
hoverService
|
|
82
|
+
) {
|
|
83
|
+
super({
|
|
84
|
+
...options,
|
|
85
|
+
titleMenuId: MenuId.BulkEditTitle
|
|
86
|
+
}, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, _instaService, openerService, themeService, hoverService);
|
|
53
87
|
this._instaService = _instaService;
|
|
54
88
|
this._editorService = _editorService;
|
|
55
89
|
this._labelService = _labelService;
|
|
@@ -60,15 +94,19 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
60
94
|
this._treeViewStates = ( new Map());
|
|
61
95
|
this._disposables = ( new DisposableStore());
|
|
62
96
|
this._sessionDisposables = ( new DisposableStore());
|
|
63
|
-
this._computeResourceDiffEditorInputs = ( new LRUCachedFunction(async
|
|
64
|
-
const computeDiffEditorInput = ( new CachedFunction(async
|
|
97
|
+
this._computeResourceDiffEditorInputs = ( new LRUCachedFunction(async fileOperations => {
|
|
98
|
+
const computeDiffEditorInput = ( new CachedFunction(async fileOperation => {
|
|
65
99
|
const fileOperationUri = fileOperation.uri;
|
|
66
100
|
const previewUri = this._currentProvider.asPreviewUri(fileOperationUri);
|
|
67
101
|
if (fileOperation.type & BulkFileOperationType.Delete) {
|
|
68
102
|
return {
|
|
69
|
-
original: {
|
|
70
|
-
|
|
71
|
-
|
|
103
|
+
original: {
|
|
104
|
+
resource: URI.revive(previewUri)
|
|
105
|
+
},
|
|
106
|
+
modified: {
|
|
107
|
+
resource: undefined
|
|
108
|
+
},
|
|
109
|
+
goToFileResource: fileOperation.uri
|
|
72
110
|
};
|
|
73
111
|
}
|
|
74
112
|
else {
|
|
@@ -76,14 +114,17 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
76
114
|
try {
|
|
77
115
|
(await this._textModelService.createModelReference(fileOperationUri)).dispose();
|
|
78
116
|
leftResource = fileOperationUri;
|
|
79
|
-
}
|
|
80
|
-
catch {
|
|
117
|
+
} catch {
|
|
81
118
|
leftResource = BulkEditPreviewProvider.emptyPreview;
|
|
82
119
|
}
|
|
83
120
|
return {
|
|
84
|
-
original: {
|
|
85
|
-
|
|
86
|
-
|
|
121
|
+
original: {
|
|
122
|
+
resource: URI.revive(leftResource)
|
|
123
|
+
},
|
|
124
|
+
modified: {
|
|
125
|
+
resource: URI.revive(previewUri)
|
|
126
|
+
},
|
|
127
|
+
goToFileResource: leftResource
|
|
87
128
|
};
|
|
88
129
|
}
|
|
89
130
|
}));
|
|
@@ -92,16 +133,19 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
92
133
|
for (const operation of sortedFileOperations) {
|
|
93
134
|
resources.push(await computeDiffEditorInput.get(operation));
|
|
94
135
|
}
|
|
95
|
-
const getResourceDiffEditorInputIdOfOperation = async
|
|
136
|
+
const getResourceDiffEditorInputIdOfOperation = async operation => {
|
|
96
137
|
const resource = await computeDiffEditorInput.get(operation);
|
|
97
|
-
return {
|
|
138
|
+
return {
|
|
139
|
+
original: resource.original.resource,
|
|
140
|
+
modified: resource.modified.resource
|
|
141
|
+
};
|
|
98
142
|
};
|
|
99
143
|
return {
|
|
100
144
|
resources,
|
|
101
145
|
getResourceDiffEditorInputIdOfOperation
|
|
102
146
|
};
|
|
103
147
|
}));
|
|
104
|
-
this.element.classList.add(
|
|
148
|
+
this.element.classList.add("bulk-edit-panel", "show-file-icons");
|
|
105
149
|
this._ctxHasCategories = BulkEditPane_1.ctxHasCategories.bindTo(contextKeyService);
|
|
106
150
|
this._ctxGroupByFile = BulkEditPane_1.ctxGroupByFile.bindTo(contextKeyService);
|
|
107
151
|
this._ctxHasCheckedChanges = BulkEditPane_1.ctxHasCheckedChanges.bindTo(contextKeyService);
|
|
@@ -113,17 +157,23 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
113
157
|
}
|
|
114
158
|
renderBody(parent) {
|
|
115
159
|
super.renderBody(parent);
|
|
116
|
-
const resourceLabels = this._instaService.createInstance(ResourceLabels, {
|
|
160
|
+
const resourceLabels = this._instaService.createInstance(ResourceLabels, {
|
|
161
|
+
onDidChangeVisibility: this.onDidChangeBodyVisibility
|
|
162
|
+
});
|
|
117
163
|
this._disposables.add(resourceLabels);
|
|
118
|
-
const contentContainer = createElement(
|
|
119
|
-
contentContainer.className =
|
|
164
|
+
const contentContainer = createElement("div");
|
|
165
|
+
contentContainer.className = "content";
|
|
120
166
|
parent.appendChild(contentContainer);
|
|
121
|
-
const treeContainer = createElement(
|
|
167
|
+
const treeContainer = createElement("div");
|
|
122
168
|
contentContainer.appendChild(treeContainer);
|
|
123
169
|
this._treeDataSource = this._instaService.createInstance(BulkEditDataSource);
|
|
124
170
|
this._treeDataSource.groupByFile = this._storageService.getBoolean(BulkEditPane_1._memGroupByFile, StorageScope.PROFILE, true);
|
|
125
171
|
this._ctxGroupByFile.set(this._treeDataSource.groupByFile);
|
|
126
|
-
this._tree = this._instaService.createInstance(
|
|
172
|
+
this._tree = this._instaService.createInstance(WorkbenchAsyncDataTree, this.id, treeContainer, ( new BulkEditDelegate()), [
|
|
173
|
+
this._instaService.createInstance(TextEditElementRenderer),
|
|
174
|
+
this._instaService.createInstance(FileElementRenderer, resourceLabels),
|
|
175
|
+
this._instaService.createInstance(CategoryElementRenderer)
|
|
176
|
+
], this._treeDataSource, {
|
|
127
177
|
accessibilityProvider: this._instaService.createInstance(BulkEditAccessibilityProvider),
|
|
128
178
|
identityProvider: ( new BulkEditIdentityProvider()),
|
|
129
179
|
expandOnlyOnTwistieClick: true,
|
|
@@ -134,21 +184,27 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
134
184
|
});
|
|
135
185
|
this._disposables.add(this._tree.onContextMenu(this._onContextMenu, this));
|
|
136
186
|
this._disposables.add(this._tree.onDidOpen(e => this._openElementInMultiDiffEditor(e)));
|
|
137
|
-
const buttonsContainer = createElement(
|
|
138
|
-
buttonsContainer.className =
|
|
187
|
+
const buttonsContainer = createElement("div");
|
|
188
|
+
buttonsContainer.className = "buttons";
|
|
139
189
|
contentContainer.appendChild(buttonsContainer);
|
|
140
190
|
const buttonBar = ( new ButtonBar(buttonsContainer));
|
|
141
191
|
this._disposables.add(buttonBar);
|
|
142
|
-
const btnConfirm = buttonBar.addButton({
|
|
143
|
-
|
|
192
|
+
const btnConfirm = buttonBar.addButton({
|
|
193
|
+
supportIcons: true,
|
|
194
|
+
...defaultButtonStyles
|
|
195
|
+
});
|
|
196
|
+
btnConfirm.label = ( localize(4541, "Apply"));
|
|
144
197
|
btnConfirm.onDidClick(() => this.accept(), this, this._disposables);
|
|
145
|
-
const btnCancel = buttonBar.addButton({
|
|
146
|
-
|
|
198
|
+
const btnCancel = buttonBar.addButton({
|
|
199
|
+
...defaultButtonStyles,
|
|
200
|
+
secondary: true
|
|
201
|
+
});
|
|
202
|
+
btnCancel.label = ( localize(4542, "Discard"));
|
|
147
203
|
btnCancel.onDidClick(() => this.discard(), this, this._disposables);
|
|
148
|
-
this._message = createElement(
|
|
149
|
-
this._message.className =
|
|
204
|
+
this._message = createElement("span");
|
|
205
|
+
this._message.className = "message";
|
|
150
206
|
this._message.innerText = ( localize(
|
|
151
|
-
|
|
207
|
+
4543,
|
|
152
208
|
"Invoke a code action, like rename, to see a preview of its changes here."
|
|
153
209
|
));
|
|
154
210
|
parent.appendChild(this._message);
|
|
@@ -161,7 +217,7 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
161
217
|
this._tree.layout(treeHeight, width);
|
|
162
218
|
}
|
|
163
219
|
_setState(state) {
|
|
164
|
-
this.element.dataset[
|
|
220
|
+
this.element.dataset["state"] = state;
|
|
165
221
|
}
|
|
166
222
|
async setInput(edit, token) {
|
|
167
223
|
this._setState(State.Data);
|
|
@@ -202,7 +258,9 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
202
258
|
}
|
|
203
259
|
const expand = [...this._tree.getNode(input).children].slice(0, 10);
|
|
204
260
|
while (expand.length > 0) {
|
|
205
|
-
const {
|
|
261
|
+
const {
|
|
262
|
+
element
|
|
263
|
+
} = expand.shift();
|
|
206
264
|
if (element instanceof FileElement) {
|
|
207
265
|
await this._tree.expand(element, true);
|
|
208
266
|
}
|
|
@@ -221,14 +279,15 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
221
279
|
let message;
|
|
222
280
|
if (conflicts.length === 1) {
|
|
223
281
|
message = ( localize(
|
|
224
|
-
|
|
282
|
+
4544,
|
|
225
283
|
"Cannot apply refactoring because '{0}' has changed in the meantime.",
|
|
226
|
-
this._labelService.getUriLabel(conflicts[0], {
|
|
284
|
+
this._labelService.getUriLabel(conflicts[0], {
|
|
285
|
+
relative: true
|
|
286
|
+
})
|
|
227
287
|
));
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
288
|
+
} else {
|
|
230
289
|
message = ( localize(
|
|
231
|
-
|
|
290
|
+
4545,
|
|
232
291
|
"Cannot apply refactoring because {0} other files have changed in the meantime.",
|
|
233
292
|
conflicts.length
|
|
234
293
|
));
|
|
@@ -248,8 +307,7 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
248
307
|
const [first] = this._tree.getFocus();
|
|
249
308
|
if ((first instanceof FileElement || first instanceof TextEditElement) && !first.isDisabled()) {
|
|
250
309
|
first.setChecked(!first.isChecked());
|
|
251
|
-
}
|
|
252
|
-
else if (first instanceof CategoryElement) {
|
|
310
|
+
} else if (first instanceof CategoryElement) {
|
|
253
311
|
first.setChecked(!first.isChecked());
|
|
254
312
|
}
|
|
255
313
|
}
|
|
@@ -270,7 +328,12 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
270
328
|
this._treeViewStates.set(this._treeDataSource.groupByFile, oldViewState);
|
|
271
329
|
this._treeDataSource.groupByFile = !this._treeDataSource.groupByFile;
|
|
272
330
|
this._setTreeInput(input);
|
|
273
|
-
this._storageService.store(
|
|
331
|
+
this._storageService.store(
|
|
332
|
+
BulkEditPane_1._memGroupByFile,
|
|
333
|
+
this._treeDataSource.groupByFile,
|
|
334
|
+
StorageScope.PROFILE,
|
|
335
|
+
StorageTarget.USER
|
|
336
|
+
);
|
|
274
337
|
this._ctxGroupByFile.set(this._treeDataSource.groupByFile);
|
|
275
338
|
}
|
|
276
339
|
}
|
|
@@ -284,12 +347,10 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
284
347
|
if (e.element instanceof TextEditElement) {
|
|
285
348
|
fileElement = e.element.parent;
|
|
286
349
|
selection = e.element.edit.textEdit.textEdit.range;
|
|
287
|
-
}
|
|
288
|
-
else if (e.element instanceof FileElement) {
|
|
350
|
+
} else if (e.element instanceof FileElement) {
|
|
289
351
|
fileElement = e.element;
|
|
290
352
|
selection = e.element.edit.textEdits[0]?.textEdit.textEdit.range;
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
353
|
+
} else {
|
|
293
354
|
return;
|
|
294
355
|
}
|
|
295
356
|
const result = await this._computeResourceDiffEditorInputs.get(fileOperations);
|
|
@@ -299,12 +360,14 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
299
360
|
viewState: {
|
|
300
361
|
revealData: {
|
|
301
362
|
resource: resourceId,
|
|
302
|
-
range: selection
|
|
363
|
+
range: selection
|
|
303
364
|
}
|
|
304
365
|
}
|
|
305
366
|
};
|
|
306
|
-
const multiDiffSource = ( URI.from({
|
|
307
|
-
|
|
367
|
+
const multiDiffSource = ( URI.from({
|
|
368
|
+
scheme: BulkEditPane_1.Schema
|
|
369
|
+
}));
|
|
370
|
+
const label = "Refactor Preview";
|
|
308
371
|
this._editorService.openEditor({
|
|
309
372
|
multiDiffSource,
|
|
310
373
|
label,
|
|
@@ -322,22 +385,6 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
322
385
|
});
|
|
323
386
|
}
|
|
324
387
|
};
|
|
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, IHoverService))
|
|
341
|
-
], BulkEditPane));
|
|
388
|
+
BulkEditPane = BulkEditPane_1 = ( __decorate([( __param(1, IInstantiationService)), ( __param(2, IEditorService)), ( __param(3, ILabelService)), ( __param(4, ITextModelService)), ( __param(5, IDialogService)), ( __param(6, IContextMenuService)), ( __param(7, IStorageService)), ( __param(8, IContextKeyService)), ( __param(9, IViewDescriptorService)), ( __param(10, IKeybindingService)), ( __param(11, IContextMenuService)), ( __param(12, IConfigurationService)), ( __param(13, IOpenerService)), ( __param(14, IThemeService)), ( __param(15, IHoverService))], BulkEditPane));
|
|
342
389
|
|
|
343
390
|
export { BulkEditPane };
|