@codingame/monaco-vscode-bulk-edit-service-override 2.2.2 → 3.1.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 +1 -1
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane.js +61 -65
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPreview.js +1 -1
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree.js +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-bulk-edit-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,7 +18,7 @@
|
|
|
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@3.1.0",
|
|
22
22
|
"vscode-marked": "npm:marked@=3.0.2"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -211,7 +211,7 @@ let BulkEditService = class BulkEditService {
|
|
|
211
211
|
codeEditor = candidate.getModifiedEditor();
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
if (codeEditor && codeEditor.getOption(
|
|
214
|
+
if (codeEditor && codeEditor.getOption(91 )) {
|
|
215
215
|
codeEditor = undefined;
|
|
216
216
|
}
|
|
217
217
|
let undoRedoGroup;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
2
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
3
|
-
import {
|
|
3
|
+
import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
4
4
|
import { IBulkEditService } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
|
|
5
5
|
import { BulkEditPane } from './bulkEditPane.js';
|
|
6
|
-
import { Extensions
|
|
6
|
+
import { Extensions } from 'vscode/vscode/vs/workbench/common/views';
|
|
7
7
|
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
8
8
|
import { FocusedViewContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
9
9
|
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
10
10
|
import { ViewPaneContainer } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
|
|
11
11
|
import { RawContextKey, ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
12
12
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
13
|
-
import { BulkEditPreviewProvider } from './bulkEditPreview.js';
|
|
14
13
|
import { WorkbenchListFocusContextKey } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
15
14
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
16
15
|
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
@@ -51,7 +50,7 @@ let UXState = class UXState {
|
|
|
51
50
|
const previewEditors = [];
|
|
52
51
|
for (const input of group.editors) {
|
|
53
52
|
const resource = EditorResourceAccessor.getCanonicalUri(input, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
54
|
-
if (resource?.scheme ===
|
|
53
|
+
if (resource?.scheme === BulkEditPane.Schema) {
|
|
55
54
|
previewEditors.push(input);
|
|
56
55
|
}
|
|
57
56
|
}
|
|
@@ -74,6 +73,7 @@ class PreviewSession {
|
|
|
74
73
|
}
|
|
75
74
|
let BulkEditPreviewContribution = class BulkEditPreviewContribution {
|
|
76
75
|
static { BulkEditPreviewContribution_1 = this; }
|
|
76
|
+
static { this.ID = 'workbench.contrib.bulkEditPreview'; }
|
|
77
77
|
static { this.ctxEnabled = ( new RawContextKey('refactorPreview.enabled', false)); }
|
|
78
78
|
constructor(_paneCompositeService, _viewsService, _editorGroupsService, _dialogService, bulkEditService, contextKeyService) {
|
|
79
79
|
this._paneCompositeService = _paneCompositeService;
|
|
@@ -331,13 +331,13 @@ registerAction2(class ToggleGrouping extends Action2 {
|
|
|
331
331
|
view?.toggleGrouping();
|
|
332
332
|
}
|
|
333
333
|
});
|
|
334
|
-
(
|
|
334
|
+
registerWorkbenchContribution2(BulkEditPreviewContribution.ID, BulkEditPreviewContribution, 2 );
|
|
335
335
|
const refactorPreviewViewIcon = registerIcon('refactor-preview-view-icon', Codicon.lightbulb, ( localizeWithPath(
|
|
336
336
|
'vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution',
|
|
337
337
|
'refactorPreviewViewIcon',
|
|
338
338
|
'View icon of the refactor preview view.'
|
|
339
339
|
)));
|
|
340
|
-
const container = ( Registry.as(Extensions
|
|
340
|
+
const container = ( Registry.as(Extensions.ViewContainersRegistry)).registerViewContainer({
|
|
341
341
|
id: BulkEditPane.ID,
|
|
342
342
|
title: ( localize2WithPath(
|
|
343
343
|
'vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution',
|
|
@@ -352,7 +352,7 @@ const container = ( Registry.as(Extensions$1.ViewContainersRegistry)).registerVi
|
|
|
352
352
|
icon: refactorPreviewViewIcon,
|
|
353
353
|
storageId: BulkEditPane.ID
|
|
354
354
|
}, 1 );
|
|
355
|
-
( Registry.as(Extensions
|
|
355
|
+
( Registry.as(Extensions.ViewsRegistry)).registerViews([{
|
|
356
356
|
id: BulkEditPane.ID,
|
|
357
357
|
name: ( localize2WithPath(
|
|
358
358
|
'vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution',
|
|
@@ -1,7 +1,7 @@
|
|
|
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 } from './bulkEditTree.js';
|
|
4
|
+
import { BulkEditDataSource, BulkEditDelegate, TextEditElementRenderer, FileElementRenderer, CategoryElementRenderer, BulkEditAccessibilityProvider, BulkEditIdentityProvider, BulkEditNaviLabelProvider, BulkEditSorter, FileElement, CategoryElement, TextEditElement, compareBulkFileOperations } 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';
|
|
@@ -10,6 +10,7 @@ import { SIDE_GROUP, ACTIVE_GROUP, IEditorService } from 'vscode/vscode/vs/workb
|
|
|
10
10
|
import { BulkFileOperations, BulkEditPreviewProvider } 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
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
13
14
|
import { ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
14
15
|
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
15
16
|
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
|
|
@@ -17,7 +18,6 @@ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/c
|
|
|
17
18
|
import { RawContextKey, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
18
19
|
import { ResourceLabels } from 'vscode/vscode/vs/workbench/browser/labels';
|
|
19
20
|
import '../../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
20
|
-
import { basename, dirname } from 'vscode/vscode/vs/base/common/resources';
|
|
21
21
|
import { MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
22
22
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
23
23
|
import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
|
|
@@ -31,6 +31,7 @@ var BulkEditPane_1;
|
|
|
31
31
|
let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
32
32
|
static { BulkEditPane_1 = this; }
|
|
33
33
|
static { this.ID = 'refactorPreview'; }
|
|
34
|
+
static { this.Schema = 'vscode-bulkeditpreview-multieditor'; }
|
|
34
35
|
static { this.ctxHasCategories = ( new RawContextKey('refactorPreview.hasCategories', false)); }
|
|
35
36
|
static { this.ctxGroupByFile = ( new RawContextKey('refactorPreview.groupByFile', true)); }
|
|
36
37
|
static { this.ctxHasCheckedChanges = ( new RawContextKey('refactorPreview.hasCheckedChanges', true)); }
|
|
@@ -79,7 +80,7 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
79
80
|
selectionNavigation: true
|
|
80
81
|
});
|
|
81
82
|
this._disposables.add(this._tree.onContextMenu(this._onContextMenu, this));
|
|
82
|
-
this._disposables.add(this._tree.onDidOpen(e => this.
|
|
83
|
+
this._disposables.add(this._tree.onDidOpen(e => this._openElementInMultiDiffEditor(e)));
|
|
83
84
|
const buttonsContainer = document.createElement('div');
|
|
84
85
|
buttonsContainer.className = 'buttons';
|
|
85
86
|
contentContainer.appendChild(buttonsContainer);
|
|
@@ -231,83 +232,78 @@ let BulkEditPane = class BulkEditPane extends ViewPane {
|
|
|
231
232
|
this._ctxGroupByFile.set(this._treeDataSource.groupByFile);
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
|
-
async
|
|
235
|
-
const
|
|
235
|
+
async _openElementInMultiDiffEditor(e) {
|
|
236
|
+
const fileOperations = this._currentInput?.fileOperations;
|
|
237
|
+
if (!fileOperations) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
let selection = undefined;
|
|
236
241
|
let fileElement;
|
|
237
242
|
if (e.element instanceof TextEditElement) {
|
|
238
243
|
fileElement = e.element.parent;
|
|
239
|
-
|
|
244
|
+
selection = e.element.edit.textEdit.textEdit.range;
|
|
240
245
|
}
|
|
241
246
|
else if (e.element instanceof FileElement) {
|
|
242
247
|
fileElement = e.element;
|
|
243
|
-
|
|
248
|
+
selection = e.element.edit.textEdits[0]?.textEdit.textEdit.range;
|
|
244
249
|
}
|
|
245
250
|
else {
|
|
246
251
|
return;
|
|
247
252
|
}
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
)),
|
|
257
|
-
resource: previewUri,
|
|
258
|
-
options
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
let leftResource;
|
|
263
|
-
try {
|
|
264
|
-
(await this._textModelService.createModelReference(fileElement.edit.uri)).dispose();
|
|
265
|
-
leftResource = fileElement.edit.uri;
|
|
266
|
-
}
|
|
267
|
-
catch {
|
|
268
|
-
leftResource = BulkEditPreviewProvider.emptyPreview;
|
|
253
|
+
const resources = await this._resolveResources(fileOperations);
|
|
254
|
+
const options = {
|
|
255
|
+
...e.editorOptions,
|
|
256
|
+
viewState: {
|
|
257
|
+
revealData: {
|
|
258
|
+
resource: { original: fileElement.edit.uri },
|
|
259
|
+
range: selection,
|
|
260
|
+
}
|
|
269
261
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
262
|
+
};
|
|
263
|
+
const multiDiffSource = ( URI.from({ scheme: BulkEditPane_1.Schema }));
|
|
264
|
+
const label = 'Refactor Preview';
|
|
265
|
+
this._editorService.openEditor({
|
|
266
|
+
multiDiffSource,
|
|
267
|
+
resources,
|
|
268
|
+
label,
|
|
269
|
+
options,
|
|
270
|
+
isTransient: true,
|
|
271
|
+
description: label
|
|
272
|
+
}, e.sideBySide ? SIDE_GROUP : ACTIVE_GROUP);
|
|
273
|
+
}
|
|
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
|
+
});
|
|
294
288
|
}
|
|
295
289
|
else {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
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
302
|
}
|
|
303
|
-
this._editorService.openEditor({
|
|
304
|
-
original: { resource: leftResource },
|
|
305
|
-
modified: { resource: previewUri },
|
|
306
|
-
label,
|
|
307
|
-
description: this._labelService.getUriLabel(dirname(leftResource), { relative: true }),
|
|
308
|
-
options
|
|
309
|
-
}, e.sideBySide ? SIDE_GROUP : ACTIVE_GROUP);
|
|
310
303
|
}
|
|
304
|
+
this._fileOperations = fileOperations;
|
|
305
|
+
this._resources = resources;
|
|
306
|
+
return resources;
|
|
311
307
|
}
|
|
312
308
|
_onContextMenu(e) {
|
|
313
309
|
this._contextMenuService.showContextMenu({
|
|
@@ -284,7 +284,7 @@ BulkFileOperations = BulkFileOperations_1 = ( __decorate([
|
|
|
284
284
|
], BulkFileOperations));
|
|
285
285
|
let BulkEditPreviewProvider = class BulkEditPreviewProvider {
|
|
286
286
|
static { BulkEditPreviewProvider_1 = this; }
|
|
287
|
-
static { this.Schema = 'vscode-bulkeditpreview'; }
|
|
287
|
+
static { this.Schema = 'vscode-bulkeditpreview-editor'; }
|
|
288
288
|
static { this.emptyPreview = ( URI.from({ scheme: BulkEditPreviewProvider_1.Schema, fragment: 'empty' })); }
|
|
289
289
|
static fromPreviewUri(uri) {
|
|
290
290
|
return ( URI.parse(uri.query));
|
|
@@ -236,7 +236,7 @@ BulkEditDataSource = ( __decorate([
|
|
|
236
236
|
class BulkEditSorter {
|
|
237
237
|
compare(a, b) {
|
|
238
238
|
if (a instanceof FileElement && b instanceof FileElement) {
|
|
239
|
-
return
|
|
239
|
+
return compareBulkFileOperations(a.edit, b.edit);
|
|
240
240
|
}
|
|
241
241
|
if (a instanceof TextEditElement && b instanceof TextEditElement) {
|
|
242
242
|
return Range.compareRangesUsingStarts(a.edit.textEdit.textEdit.range, b.edit.textEdit.textEdit.range);
|
|
@@ -244,6 +244,9 @@ class BulkEditSorter {
|
|
|
244
244
|
return 0;
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
+
function compareBulkFileOperations(a, b) {
|
|
248
|
+
return compare(( a.uri.toString()), ( b.uri.toString()));
|
|
249
|
+
}
|
|
247
250
|
let BulkEditAccessibilityProvider = class BulkEditAccessibilityProvider {
|
|
248
251
|
constructor(_labelService) {
|
|
249
252
|
this._labelService = _labelService;
|
|
@@ -651,4 +654,4 @@ class BulkEditNaviLabelProvider {
|
|
|
651
654
|
}
|
|
652
655
|
}
|
|
653
656
|
|
|
654
|
-
export { BulkEditAccessibilityProvider, BulkEditDataSource, BulkEditDelegate, BulkEditIdentityProvider, BulkEditNaviLabelProvider, BulkEditSorter, CategoryElement, CategoryElementRenderer, FileElement, FileElementRenderer, TextEditElement, TextEditElementRenderer };
|
|
657
|
+
export { BulkEditAccessibilityProvider, BulkEditDataSource, BulkEditDelegate, BulkEditIdentityProvider, BulkEditNaviLabelProvider, BulkEditSorter, CategoryElement, CategoryElementRenderer, FileElement, FileElementRenderer, TextEditElement, TextEditElementRenderer, compareBulkFileOperations };
|