@codingame/monaco-vscode-bulk-edit-service-override 37.1.0 → 37.3.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.
@@ -1,311 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/registry/common/platform';
4
- import { registerWorkbenchContribution2, WorkbenchPhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
5
- import { IBulkEditService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/bulkEditService.service';
6
- import { BulkEditPane } from './bulkEditPane.js';
7
- import { ViewContainerLocation, Extensions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views';
8
- import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
9
- import { FocusedViewContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contextkeys';
10
- import { localize, localize2 } from '@codingame/monaco-vscode-api/vscode/vs/nls';
11
- import { ViewPaneContainer } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
12
- import { RawContextKey, ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
13
- import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
14
- import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
15
- import { KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
16
- import { KeyMod, KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
17
- import { WorkbenchListFocusContextKey } from '@codingame/monaco-vscode-api/vscode/vs/platform/list/browser/listService';
18
- import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
19
- import { registerAction2, Action2, MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
20
- import { EditorResourceAccessor, SideBySideEditor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
21
- import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
22
- import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
23
- import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
24
- import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
25
- import { registerIcon } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/iconRegistry';
26
- import { IPaneCompositePartService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/panecomposite/browser/panecomposite.service';
27
-
28
- var BulkEditPreviewContribution_1;
29
- async function getBulkEditPane(viewsService) {
30
- const view = await viewsService.openView(BulkEditPane.ID, true);
31
- if (view instanceof BulkEditPane) {
32
- return view;
33
- }
34
- return undefined;
35
- }
36
- let UXState = class UXState {
37
- constructor(_paneCompositeService, _editorGroupsService) {
38
- this._paneCompositeService = _paneCompositeService;
39
- this._editorGroupsService = _editorGroupsService;
40
- this._activePanel = _paneCompositeService.getActivePaneComposite(ViewContainerLocation.Panel)?.getId();
41
- }
42
- async restore(panels, editors) {
43
- if (panels) {
44
- if (typeof this._activePanel === "string") {
45
- await this._paneCompositeService.openPaneComposite(this._activePanel, ViewContainerLocation.Panel);
46
- } else {
47
- this._paneCompositeService.hideActivePaneComposite(ViewContainerLocation.Panel);
48
- }
49
- }
50
- if (editors) {
51
- for (const group of this._editorGroupsService.groups) {
52
- const previewEditors = [];
53
- for (const input of group.editors) {
54
- const resource = EditorResourceAccessor.getCanonicalUri(input, {
55
- supportSideBySide: SideBySideEditor.PRIMARY
56
- });
57
- if (resource?.scheme === BulkEditPane.Schema) {
58
- previewEditors.push(input);
59
- }
60
- }
61
- if (previewEditors.length) {
62
- group.closeEditors(previewEditors, {
63
- preserveFocus: true
64
- });
65
- }
66
- }
67
- }
68
- }
69
- };
70
- UXState = ( __decorate([( __param(0, IPaneCompositePartService)), ( __param(1, IEditorGroupsService))], UXState));
71
- class PreviewSession {
72
- constructor(
73
- uxState,
74
- cts = ( new CancellationTokenSource())
75
- ) {
76
- this.uxState = uxState;
77
- this.cts = cts;
78
- }
79
- }
80
- let BulkEditPreviewContribution = class BulkEditPreviewContribution {
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
- ) {
98
- this._paneCompositeService = _paneCompositeService;
99
- this._viewsService = _viewsService;
100
- this._editorGroupsService = _editorGroupsService;
101
- this._dialogService = _dialogService;
102
- bulkEditService.setPreviewHandler(edits => this._previewEdit(edits));
103
- this._ctxEnabled = BulkEditPreviewContribution_1.ctxEnabled.bindTo(contextKeyService);
104
- }
105
- async _previewEdit(edits) {
106
- this._ctxEnabled.set(true);
107
- const uxState = this._activeSession?.uxState ?? ( new UXState(this._paneCompositeService, this._editorGroupsService));
108
- const view = await getBulkEditPane(this._viewsService);
109
- if (!view) {
110
- this._ctxEnabled.set(false);
111
- return edits;
112
- }
113
- if (view.hasInput()) {
114
- const {
115
- confirmed
116
- } = await this._dialogService.confirm({
117
- type: Severity.Info,
118
- message: ( localize(5376, "Another refactoring is being previewed.")),
119
- detail: ( localize(
120
- 5377,
121
- "Press 'Continue' to discard the previous refactoring and continue with the current refactoring."
122
- )),
123
- primaryButton: ( localize(5378, "&&Continue"))
124
- });
125
- if (!confirmed) {
126
- return [];
127
- }
128
- }
129
- let session;
130
- if (this._activeSession) {
131
- await this._activeSession.uxState.restore(false, true);
132
- this._activeSession.cts.dispose(true);
133
- session = ( new PreviewSession(uxState));
134
- } else {
135
- session = ( new PreviewSession(uxState));
136
- }
137
- this._activeSession = session;
138
- try {
139
- return (await view.setInput(edits, session.cts.token)) ?? [];
140
- } finally {
141
- if (this._activeSession === session) {
142
- await this._activeSession.uxState.restore(true, true);
143
- this._activeSession.cts.dispose();
144
- this._ctxEnabled.set(false);
145
- this._activeSession = undefined;
146
- }
147
- }
148
- }
149
- };
150
- BulkEditPreviewContribution = BulkEditPreviewContribution_1 = ( __decorate([( __param(0, IPaneCompositePartService)), ( __param(1, IViewsService)), ( __param(2, IEditorGroupsService)), ( __param(3, IDialogService)), ( __param(4, IBulkEditService)), ( __param(5, IContextKeyService))], BulkEditPreviewContribution));
151
- registerAction2(class ApplyAction extends Action2 {
152
- constructor() {
153
- super({
154
- id: "refactorPreview.apply",
155
- title: ( localize2(5379, "Apply Refactoring")),
156
- category: ( localize2(5380, "Refactor Preview")),
157
- icon: Codicon.check,
158
- precondition: ( ContextKeyExpr.and(BulkEditPreviewContribution.ctxEnabled, BulkEditPane.ctxHasCheckedChanges)),
159
- menu: [{
160
- id: MenuId.BulkEditContext,
161
- order: 1
162
- }],
163
- keybinding: {
164
- weight: KeybindingWeight.EditorContrib - 10,
165
- when: ( ContextKeyExpr.and(BulkEditPreviewContribution.ctxEnabled, ( FocusedViewContext.isEqualTo(BulkEditPane.ID)))),
166
- primary: KeyMod.CtrlCmd + KeyCode.Enter
167
- }
168
- });
169
- }
170
- async run(accessor) {
171
- const viewsService = accessor.get(IViewsService);
172
- const view = await getBulkEditPane(viewsService);
173
- view?.accept();
174
- }
175
- });
176
- registerAction2(class DiscardAction extends Action2 {
177
- constructor() {
178
- super({
179
- id: "refactorPreview.discard",
180
- title: ( localize2(5381, "Discard Refactoring")),
181
- category: ( localize2(5380, "Refactor Preview")),
182
- icon: Codicon.clearAll,
183
- precondition: BulkEditPreviewContribution.ctxEnabled,
184
- menu: [{
185
- id: MenuId.BulkEditContext,
186
- order: 2
187
- }]
188
- });
189
- }
190
- async run(accessor) {
191
- const viewsService = accessor.get(IViewsService);
192
- const view = await getBulkEditPane(viewsService);
193
- view?.discard();
194
- }
195
- });
196
- registerAction2(class ToggleAction extends Action2 {
197
- constructor() {
198
- super({
199
- id: "refactorPreview.toggleCheckedState",
200
- title: ( localize2(5382, "Toggle Change")),
201
- category: ( localize2(5380, "Refactor Preview")),
202
- precondition: BulkEditPreviewContribution.ctxEnabled,
203
- keybinding: {
204
- weight: KeybindingWeight.WorkbenchContrib,
205
- when: WorkbenchListFocusContextKey,
206
- primary: KeyCode.Space
207
- },
208
- menu: {
209
- id: MenuId.BulkEditContext,
210
- group: "navigation"
211
- }
212
- });
213
- }
214
- async run(accessor) {
215
- const viewsService = accessor.get(IViewsService);
216
- const view = await getBulkEditPane(viewsService);
217
- view?.toggleChecked();
218
- }
219
- });
220
- registerAction2(class GroupByFile extends Action2 {
221
- constructor() {
222
- super({
223
- id: "refactorPreview.groupByFile",
224
- title: ( localize2(5383, "Group Changes By File")),
225
- category: ( localize2(5380, "Refactor Preview")),
226
- icon: Codicon.ungroupByRefType,
227
- precondition: ( ContextKeyExpr.and(BulkEditPane.ctxHasCategories, ( BulkEditPane.ctxGroupByFile.negate()), BulkEditPreviewContribution.ctxEnabled)),
228
- menu: [{
229
- id: MenuId.BulkEditTitle,
230
- when: ( ContextKeyExpr.and(BulkEditPane.ctxHasCategories, ( BulkEditPane.ctxGroupByFile.negate()))),
231
- group: "navigation",
232
- order: 3
233
- }]
234
- });
235
- }
236
- async run(accessor) {
237
- const viewsService = accessor.get(IViewsService);
238
- const view = await getBulkEditPane(viewsService);
239
- view?.groupByFile();
240
- }
241
- });
242
- registerAction2(class GroupByType extends Action2 {
243
- constructor() {
244
- super({
245
- id: "refactorPreview.groupByType",
246
- title: ( localize2(5384, "Group Changes By Type")),
247
- category: ( localize2(5380, "Refactor Preview")),
248
- icon: Codicon.groupByRefType,
249
- precondition: ( ContextKeyExpr.and(
250
- BulkEditPane.ctxHasCategories,
251
- BulkEditPane.ctxGroupByFile,
252
- BulkEditPreviewContribution.ctxEnabled
253
- )),
254
- menu: [{
255
- id: MenuId.BulkEditTitle,
256
- when: ( ContextKeyExpr.and(BulkEditPane.ctxHasCategories, BulkEditPane.ctxGroupByFile)),
257
- group: "navigation",
258
- order: 3
259
- }]
260
- });
261
- }
262
- async run(accessor) {
263
- const viewsService = accessor.get(IViewsService);
264
- const view = await getBulkEditPane(viewsService);
265
- view?.groupByType();
266
- }
267
- });
268
- registerAction2(class ToggleGrouping extends Action2 {
269
- constructor() {
270
- super({
271
- id: "refactorPreview.toggleGrouping",
272
- title: ( localize2(5384, "Group Changes By Type")),
273
- category: ( localize2(5380, "Refactor Preview")),
274
- icon: Codicon.listTree,
275
- toggled: ( BulkEditPane.ctxGroupByFile.negate()),
276
- precondition: ( ContextKeyExpr.and(BulkEditPane.ctxHasCategories, BulkEditPreviewContribution.ctxEnabled)),
277
- menu: [{
278
- id: MenuId.BulkEditContext,
279
- order: 3
280
- }]
281
- });
282
- }
283
- async run(accessor) {
284
- const viewsService = accessor.get(IViewsService);
285
- const view = await getBulkEditPane(viewsService);
286
- view?.toggleGrouping();
287
- }
288
- });
289
- registerWorkbenchContribution2(
290
- BulkEditPreviewContribution.ID,
291
- BulkEditPreviewContribution,
292
- WorkbenchPhase.BlockRestore
293
- );
294
- const refactorPreviewViewIcon = registerIcon("refactor-preview-view-icon", Codicon.lightbulb, ( localize(5385, "View icon of the refactor preview view.")));
295
- const container = ( Registry.as(Extensions.ViewContainersRegistry)).registerViewContainer({
296
- id: BulkEditPane.ID,
297
- title: ( localize2(5386, "Refactor Preview")),
298
- hideIfEmpty: true,
299
- ctorDescriptor: ( new SyncDescriptor(ViewPaneContainer, [BulkEditPane.ID, {
300
- mergeViewWithContainerWhenSingleView: true
301
- }])),
302
- icon: refactorPreviewViewIcon,
303
- storageId: BulkEditPane.ID
304
- }, ViewContainerLocation.Panel);
305
- ( Registry.as(Extensions.ViewsRegistry)).registerViews([{
306
- id: BulkEditPane.ID,
307
- name: ( localize2(5386, "Refactor Preview")),
308
- when: BulkEditPreviewContribution.ctxEnabled,
309
- ctorDescriptor: ( new SyncDescriptor(BulkEditPane)),
310
- containerIcon: refactorPreviewViewIcon
311
- }], container);
@@ -1,104 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
-
6
- .monaco-workbench .bulk-edit-panel .highlight.insert {
7
- background-color: var(--vscode-diffEditor-insertedTextBackground);
8
- }
9
-
10
- .monaco-workbench .bulk-edit-panel .highlight.remove {
11
- text-decoration: line-through;
12
- background-color: var(--vscode-diffEditor-removedTextBackground);
13
- }
14
-
15
- .monaco-workbench .bulk-edit-panel .message {
16
- padding: 10px 20px
17
- }
18
-
19
- .monaco-workbench .bulk-edit-panel[data-state="message"] .message,
20
- .monaco-workbench .bulk-edit-panel[data-state="data"] .content
21
- {
22
- display: flex;
23
- }
24
-
25
- .monaco-workbench .bulk-edit-panel[data-state="data"] .message,
26
- .monaco-workbench .bulk-edit-panel[data-state="message"] .content
27
- {
28
- display: none;
29
- }
30
-
31
- .monaco-workbench .bulk-edit-panel .content {
32
- display: flex;
33
- flex-direction: column;
34
- justify-content: space-between;
35
- }
36
-
37
- .monaco-workbench .bulk-edit-panel .content .buttons {
38
- padding-left: 20px;
39
- padding-top: 10px;
40
- }
41
-
42
- .monaco-workbench .bulk-edit-panel .content .buttons .monaco-button {
43
- display: inline-flex;
44
- width: inherit;
45
- margin: 0 4px;
46
- }
47
-
48
- .monaco-workbench .bulk-edit-panel .monaco-tl-contents {
49
- display: flex;
50
- }
51
-
52
- .monaco-workbench .bulk-edit-panel .monaco-tl-contents .edit-checkbox {
53
- align-self: center;
54
- }
55
-
56
- .monaco-workbench .bulk-edit-panel .monaco-tl-contents .monaco-icon-label.delete .monaco-icon-label-container {
57
- text-decoration: line-through;
58
- }
59
-
60
- .monaco-workbench .bulk-edit-panel .monaco-tl-contents .details {
61
- margin-left: .5em;
62
- opacity: .7;
63
- font-size: 0.9em;
64
- white-space: pre
65
- }
66
-
67
- .monaco-workbench .bulk-edit-panel .monaco-tl-contents.category {
68
- display: flex;
69
- flex: 1;
70
- flex-flow: row nowrap;
71
- align-items: center;
72
- }
73
-
74
- .monaco-workbench .bulk-edit-panel .monaco-tl-contents.category .theme-icon,
75
- .monaco-workbench .bulk-edit-panel .monaco-tl-contents.textedit .theme-icon {
76
- margin-right: 4px;
77
- }
78
-
79
- .monaco-workbench .bulk-edit-panel .monaco-tl-contents.category .uri-icon,
80
- .monaco-workbench .bulk-edit-panel .monaco-tl-contents.textedit .uri-icon,
81
- .monaco-workbench.hc-light .bulk-edit-panel .monaco-tl-contents.category .uri-icon,
82
- .monaco-workbench.hc-light .bulk-edit-panel .monaco-tl-contents.textedit .uri-icon {
83
- background-repeat: no-repeat;
84
- background-image: var(--background-light);
85
- background-position: left center;
86
- background-size: contain;
87
- margin-right: 4px;
88
- height: 100%;
89
- width: 16px;
90
- min-width: 16px;
91
- }
92
-
93
- .monaco-workbench.vs-dark .bulk-edit-panel .monaco-tl-contents.category .uri-icon,
94
- .monaco-workbench.hc-black .bulk-edit-panel .monaco-tl-contents.category .uri-icon,
95
- .monaco-workbench.vs-dark .bulk-edit-panel .monaco-tl-contents.textedit .uri-icon,
96
- .monaco-workbench.hc-black .bulk-edit-panel .monaco-tl-contents.textedit .uri-icon
97
- {
98
- background-image: var(--background-dark);
99
- }
100
-
101
- .monaco-workbench .bulk-edit-panel .monaco-tl-contents.textedit .monaco-highlighted-label {
102
- overflow: hidden;
103
- text-overflow: ellipsis;
104
- }
@@ -1,64 +0,0 @@
1
- import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
2
- import { ResourceEdit } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/bulkEditService";
3
- import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service";
4
- import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
5
- import { RawContextKey } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey";
6
- import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
7
- import { IContextMenuService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service";
8
- import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
9
- import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service";
10
- import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
11
- import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
12
- import { ILabelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service";
13
- import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
14
- import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
15
- import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service";
16
- import { ViewPane } from "@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/views/viewPane";
17
- import { IViewletViewOptions } from "@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/views/viewsViewlet";
18
- import { IViewDescriptorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service";
19
- import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
20
- export declare class BulkEditPane extends ViewPane {
21
- private readonly _instaService;
22
- private readonly _editorService;
23
- private readonly _labelService;
24
- private readonly _textModelService;
25
- private readonly _dialogService;
26
- private readonly _contextMenuService;
27
- private readonly _storageService;
28
- static readonly ID = "refactorPreview";
29
- static readonly Schema = "vscode-bulkeditpreview-multieditor";
30
- static readonly ctxHasCategories: RawContextKey<false>;
31
- static readonly ctxGroupByFile: RawContextKey<true>;
32
- static readonly ctxHasCheckedChanges: RawContextKey<true>;
33
- private static readonly _memGroupByFile;
34
- private _tree;
35
- private _treeDataSource;
36
- private _treeViewStates;
37
- private _message;
38
- private readonly _ctxHasCategories;
39
- private readonly _ctxGroupByFile;
40
- private readonly _ctxHasCheckedChanges;
41
- private readonly _disposables;
42
- private readonly _sessionDisposables;
43
- private _currentResolve?;
44
- private _currentInput?;
45
- private _currentProvider?;
46
- constructor(options: IViewletViewOptions, _instaService: IInstantiationService, _editorService: IEditorService, _labelService: ILabelService, _textModelService: ITextModelService, _dialogService: IDialogService, _contextMenuService: IContextMenuService, _storageService: IStorageService, contextKeyService: IContextKeyService, viewDescriptorService: IViewDescriptorService, keybindingService: IKeybindingService, contextMenuService: IContextMenuService, configurationService: IConfigurationService, openerService: IOpenerService, themeService: IThemeService, hoverService: IHoverService);
47
- dispose(): void;
48
- protected renderBody(parent: HTMLElement): void;
49
- protected layoutBody(height: number, width: number): void;
50
- private _setState;
51
- setInput(edit: ResourceEdit[], token: CancellationToken): Promise<ResourceEdit[] | undefined>;
52
- hasInput(): boolean;
53
- private _setTreeInput;
54
- accept(): void;
55
- discard(): void;
56
- private _done;
57
- toggleChecked(): void;
58
- groupByFile(): void;
59
- groupByType(): void;
60
- toggleGrouping(): void;
61
- private _openElementInMultiDiffEditor;
62
- private readonly _computeResourceDiffEditorInputs;
63
- private _onContextMenu;
64
- }