@codingame/monaco-vscode-bulk-edit-service-override 3.2.3 → 4.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/override/vs/platform/dialogs/common/dialogs.js +2 -0
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane.js +48 -40
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-bulk-edit-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@4.0.0"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -16,7 +16,7 @@ import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/acti
|
|
|
16
16
|
import { EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
|
|
17
17
|
import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
18
18
|
import '../../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
19
|
-
import Severity from 'vscode/vscode/vs/base/common/severity';
|
|
19
|
+
import Severity$1 from 'vscode/vscode/vs/base/common/severity';
|
|
20
20
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
21
21
|
import { registerIcon } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
|
|
22
22
|
import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/panecomposite/browser/panecomposite';
|
|
@@ -93,7 +93,7 @@ let BulkEditPreviewContribution = class BulkEditPreviewContribution {
|
|
|
93
93
|
}
|
|
94
94
|
if (view.hasInput()) {
|
|
95
95
|
const { confirmed } = await this._dialogService.confirm({
|
|
96
|
-
type: Severity.Info,
|
|
96
|
+
type: Severity$1.Info,
|
|
97
97
|
message: ( localizeWithPath(
|
|
98
98
|
'vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution',
|
|
99
99
|
'overlap',
|
|
@@ -168,7 +168,7 @@ registerAction2(class ApplyAction extends Action2 {
|
|
|
168
168
|
keybinding: {
|
|
169
169
|
weight: 100 - 10,
|
|
170
170
|
when: ( ContextKeyExpr.and(BulkEditPreviewContribution.ctxEnabled, ( FocusedViewContext.isEqualTo(BulkEditPane.ID)))),
|
|
171
|
-
primary:
|
|
171
|
+
primary: 2048 + 3 ,
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
174
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
2
|
import './bulkEdit.css.js';
|
|
3
3
|
import { WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
4
|
-
import { BulkEditDataSource, BulkEditDelegate, TextEditElementRenderer, FileElementRenderer, CategoryElementRenderer, BulkEditAccessibilityProvider, BulkEditIdentityProvider, BulkEditNaviLabelProvider, BulkEditSorter, FileElement, CategoryElement, TextEditElement
|
|
4
|
+
import { compareBulkFileOperations, BulkEditDataSource, BulkEditDelegate, TextEditElementRenderer, FileElementRenderer, CategoryElementRenderer, BulkEditAccessibilityProvider, BulkEditIdentityProvider, BulkEditNaviLabelProvider, BulkEditSorter, FileElement, CategoryElement, TextEditElement } from './bulkEditTree.js';
|
|
5
5
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
6
6
|
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
7
7
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
8
8
|
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
9
9
|
import { SIDE_GROUP, ACTIVE_GROUP, IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
10
|
-
import {
|
|
10
|
+
import { BulkEditPreviewProvider, BulkFileOperations } from './bulkEditPreview.js';
|
|
11
11
|
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
12
12
|
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
13
13
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
@@ -25,6 +25,7 @@ import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
|
25
25
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
26
26
|
import { ButtonBar } from 'vscode/vscode/vs/base/browser/ui/button/button';
|
|
27
27
|
import { defaultButtonStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
|
|
28
|
+
import { LRUCachedFunction, CachedFunction } from 'vscode/vscode/vs/base/common/cache';
|
|
28
29
|
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
29
30
|
|
|
30
31
|
var BulkEditPane_1;
|
|
@@ -48,10 +49,50 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
48
49
|
this._treeViewStates = ( new Map());
|
|
49
50
|
this._disposables = ( new DisposableStore());
|
|
50
51
|
this._sessionDisposables = ( new DisposableStore());
|
|
52
|
+
this._computeResourceDiffEditorInputs = ( new LRUCachedFunction(async (fileOperations) => {
|
|
53
|
+
const computeDiffEditorInput = ( new CachedFunction(async (fileOperation) => {
|
|
54
|
+
const fileOperationUri = fileOperation.uri;
|
|
55
|
+
const previewUri = this._currentProvider.asPreviewUri(fileOperationUri);
|
|
56
|
+
if (fileOperation.type & 4 ) {
|
|
57
|
+
return {
|
|
58
|
+
original: { resource: URI.revive(previewUri) },
|
|
59
|
+
modified: { resource: undefined }
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
let leftResource;
|
|
64
|
+
try {
|
|
65
|
+
(await this._textModelService.createModelReference(fileOperationUri)).dispose();
|
|
66
|
+
leftResource = fileOperationUri;
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
leftResource = BulkEditPreviewProvider.emptyPreview;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
original: { resource: URI.revive(leftResource) },
|
|
73
|
+
modified: { resource: URI.revive(previewUri) }
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
const sortedFileOperations = fileOperations.slice().sort(compareBulkFileOperations);
|
|
78
|
+
const resources = [];
|
|
79
|
+
for (const operation of sortedFileOperations) {
|
|
80
|
+
resources.push(await computeDiffEditorInput.get(operation));
|
|
81
|
+
}
|
|
82
|
+
const getResourceDiffEditorInputIdOfOperation = async (operation) => {
|
|
83
|
+
const resource = await computeDiffEditorInput.get(operation);
|
|
84
|
+
return { original: resource.original.resource, modified: resource.modified.resource };
|
|
85
|
+
};
|
|
86
|
+
return {
|
|
87
|
+
resources,
|
|
88
|
+
getResourceDiffEditorInputIdOfOperation
|
|
89
|
+
};
|
|
90
|
+
}, key => key));
|
|
51
91
|
this.element.classList.add('bulk-edit-panel', 'show-file-icons');
|
|
52
92
|
this._ctxHasCategories = BulkEditPane_1.ctxHasCategories.bindTo(contextKeyService);
|
|
53
93
|
this._ctxGroupByFile = BulkEditPane_1.ctxGroupByFile.bindTo(contextKeyService);
|
|
54
94
|
this._ctxHasCheckedChanges = BulkEditPane_1.ctxHasCheckedChanges.bindTo(contextKeyService);
|
|
95
|
+
this.telemetryService.publicLog2('views.bulkEditPane');
|
|
55
96
|
}
|
|
56
97
|
dispose() {
|
|
57
98
|
this._tree.dispose();
|
|
@@ -250,12 +291,13 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
250
291
|
else {
|
|
251
292
|
return;
|
|
252
293
|
}
|
|
253
|
-
const
|
|
294
|
+
const result = await this._computeResourceDiffEditorInputs.get(fileOperations);
|
|
295
|
+
const resourceId = await result.getResourceDiffEditorInputIdOfOperation(fileElement.edit);
|
|
254
296
|
const options = {
|
|
255
297
|
...e.editorOptions,
|
|
256
298
|
viewState: {
|
|
257
299
|
revealData: {
|
|
258
|
-
resource:
|
|
300
|
+
resource: resourceId,
|
|
259
301
|
range: selection,
|
|
260
302
|
}
|
|
261
303
|
}
|
|
@@ -264,47 +306,13 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
264
306
|
const label = 'Refactor Preview';
|
|
265
307
|
this._editorService.openEditor({
|
|
266
308
|
multiDiffSource,
|
|
267
|
-
resources,
|
|
268
309
|
label,
|
|
269
310
|
options,
|
|
270
311
|
isTransient: true,
|
|
271
|
-
description: label
|
|
312
|
+
description: label,
|
|
313
|
+
resources: result.resources
|
|
272
314
|
}, e.sideBySide ? SIDE_GROUP : ACTIVE_GROUP);
|
|
273
315
|
}
|
|
274
|
-
async _resolveResources(fileOperations) {
|
|
275
|
-
if (this._fileOperations === fileOperations && this._resources) {
|
|
276
|
-
return this._resources;
|
|
277
|
-
}
|
|
278
|
-
const sortedFileOperations = fileOperations.sort(compareBulkFileOperations);
|
|
279
|
-
const resources = [];
|
|
280
|
-
for (const operation of sortedFileOperations) {
|
|
281
|
-
const operationUri = operation.uri;
|
|
282
|
-
const previewUri = this._currentProvider.asPreviewUri(operationUri);
|
|
283
|
-
if (operation.type & 4 ) {
|
|
284
|
-
resources.push({
|
|
285
|
-
original: { resource: undefined },
|
|
286
|
-
modified: { resource: URI.revive(previewUri) }
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
let leftResource;
|
|
291
|
-
try {
|
|
292
|
-
(await this._textModelService.createModelReference(operationUri)).dispose();
|
|
293
|
-
leftResource = operationUri;
|
|
294
|
-
}
|
|
295
|
-
catch {
|
|
296
|
-
leftResource = BulkEditPreviewProvider.emptyPreview;
|
|
297
|
-
}
|
|
298
|
-
resources.push({
|
|
299
|
-
original: { resource: URI.revive(leftResource) },
|
|
300
|
-
modified: { resource: URI.revive(previewUri) }
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
this._fileOperations = fileOperations;
|
|
305
|
-
this._resources = resources;
|
|
306
|
-
return resources;
|
|
307
|
-
}
|
|
308
316
|
_onContextMenu(e) {
|
|
309
317
|
this._contextMenuService.showContextMenu({
|
|
310
318
|
menuId: MenuId.BulkEditContext,
|
|
@@ -536,7 +536,7 @@ let TextEditElementTemplate = class TextEditElementTemplate {
|
|
|
536
536
|
container.appendChild(this._checkbox);
|
|
537
537
|
this._icon = document.createElement('div');
|
|
538
538
|
container.appendChild(this._icon);
|
|
539
|
-
this._label = ( new HighlightedLabel(container));
|
|
539
|
+
this._label = this._disposables.add(( new HighlightedLabel(container)));
|
|
540
540
|
}
|
|
541
541
|
dispose() {
|
|
542
542
|
this._localDisposables.dispose();
|