@codingame/monaco-vscode-bulk-edit-service-override 11.1.2 → 12.0.1
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/index.d.ts +2 -1
- package/index.js +14 -1
- package/package.json +23 -7
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.js +82 -64
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkFileEdits.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkFileEdits.js +7 -5
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.js +2 -1
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/conflicts.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/conflicts.js +3 -2
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/opaqueEdits.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/opaqueEdits.js +67 -0
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.js +67 -74
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane.d.ts +65 -0
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane.js +65 -60
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPreview.d.ts +87 -0
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPreview.js +56 -54
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree.d.ts +132 -0
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree.js +112 -119
- package/bulkEdit.js +0 -12
package/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type IEditorOverrideServices } from "vscode/vscode/vs/editor/standalone/browser/standaloneServices";
|
|
2
|
+
export default function getServiceOverride(): IEditorOverrideServices;
|
package/index.js
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
|
|
3
|
+
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
4
|
+
import { IBulkEditService } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
|
|
5
|
+
import { BulkEditService } from './vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.js';
|
|
6
|
+
import './vscode/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.js';
|
|
7
|
+
|
|
8
|
+
function getServiceOverride() {
|
|
9
|
+
return {
|
|
10
|
+
[IBulkEditService.toString()]: new SyncDescriptor(BulkEditService, [], true)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { getServiceOverride as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-bulk-edit-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "VSCode public API plugged on the monaco editor - bulk-edit service-override",
|
|
4
6
|
"keywords": [],
|
|
5
7
|
"author": {
|
|
6
8
|
"name": "CodinGame",
|
|
@@ -12,8 +14,20 @@
|
|
|
12
14
|
"url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
|
|
13
15
|
},
|
|
14
16
|
"type": "module",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@codingame/monaco-vscode-271a23cd-c7d7-5761-ae35-a923a42987b8-common": "12.0.1",
|
|
19
|
+
"@codingame/monaco-vscode-65619f8f-0eab-5d8b-855a-43b6353fe527-common": "12.0.1",
|
|
20
|
+
"@codingame/monaco-vscode-9e888134-1a6f-58d9-b0e6-0fc047448366-common": "12.0.1",
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@12.0.1"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@codingame/monaco-vscode-2a94c04a-b85b-5669-b06b-89c1bfa11cb9-common": "12.0.1"
|
|
25
|
+
},
|
|
26
|
+
"peerDependenciesMeta": {
|
|
27
|
+
"@codingame/monaco-vscode-2a94c04a-b85b-5669-b06b-89c1bfa11cb9-common": {
|
|
28
|
+
"optional": true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
17
31
|
"main": "index.js",
|
|
18
32
|
"module": "index.js",
|
|
19
33
|
"types": "index.d.ts",
|
|
@@ -22,10 +36,12 @@
|
|
|
22
36
|
"default": "./index.js"
|
|
23
37
|
},
|
|
24
38
|
"./vscode/*": {
|
|
25
|
-
"default": "./vscode/src/*.js"
|
|
39
|
+
"default": "./vscode/src/*.js",
|
|
40
|
+
"types": "./vscode/src/*.d.ts"
|
|
41
|
+
},
|
|
42
|
+
"./*": {
|
|
43
|
+
"default": "./*.js",
|
|
44
|
+
"types": "./*.d.ts"
|
|
26
45
|
}
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@11.1.2"
|
|
30
46
|
}
|
|
31
47
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IDisposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { IBulkEditOptions, IBulkEditPreviewHandler, IBulkEditResult, IBulkEditService, ResourceEdit } from "vscode/vscode/vs/editor/browser/services/bulkEditService";
|
|
3
|
+
import { WorkspaceEdit } from "vscode/vscode/vs/editor/common/languages";
|
|
4
|
+
import { IConfigurationService } from "vscode/vscode/vs/platform/configuration/common/configuration.service";
|
|
5
|
+
import { IDialogService } from "vscode/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
6
|
+
import { IInstantiationService } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
7
|
+
import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
|
|
8
|
+
import { IEditorService } from "vscode/vscode/vs/workbench/services/editor/common/editorService.service";
|
|
9
|
+
import { ILifecycleService } from "vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service";
|
|
10
|
+
import { IWorkingCopyService } from "vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service";
|
|
11
|
+
export declare class BulkEditService implements IBulkEditService {
|
|
12
|
+
private readonly _instaService;
|
|
13
|
+
private readonly _logService;
|
|
14
|
+
private readonly _editorService;
|
|
15
|
+
private readonly _lifecycleService;
|
|
16
|
+
private readonly _dialogService;
|
|
17
|
+
private readonly _workingCopyService;
|
|
18
|
+
private readonly _configService;
|
|
19
|
+
readonly _serviceBrand: undefined;
|
|
20
|
+
private readonly _activeUndoRedoGroups;
|
|
21
|
+
private _previewHandler?;
|
|
22
|
+
constructor(_instaService: IInstantiationService, _logService: ILogService, _editorService: IEditorService, _lifecycleService: ILifecycleService, _dialogService: IDialogService, _workingCopyService: IWorkingCopyService, _configService: IConfigurationService);
|
|
23
|
+
setPreviewHandler(handler: IBulkEditPreviewHandler): IDisposable;
|
|
24
|
+
hasPreviewHandler(): boolean;
|
|
25
|
+
apply(editsIn: ResourceEdit[] | WorkspaceEdit, options?: IBulkEditOptions): Promise<IBulkEditResult>;
|
|
26
|
+
private _saveAll;
|
|
27
|
+
private _shouldVeto;
|
|
28
|
+
}
|
|
@@ -1,41 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
3
4
|
import { toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
5
|
import { LinkedList } from 'vscode/vscode/vs/base/common/linkedList';
|
|
5
6
|
import { ResourceMap, ResourceSet } from 'vscode/vscode/vs/base/common/map';
|
|
6
7
|
import { isCodeEditor, isDiffEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
|
|
7
8
|
import { ResourceTextEdit, ResourceFileEdit } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
|
|
9
|
+
import { EditorOption } from 'vscode/vscode/vs/editor/common/config/editorOptions';
|
|
8
10
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
9
11
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
10
12
|
import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
11
13
|
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
14
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
12
15
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
13
16
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
14
17
|
import { Progress } from 'vscode/vscode/vs/platform/progress/common/progress';
|
|
15
18
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
16
19
|
import { UndoRedoGroup } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo';
|
|
17
|
-
import { ResourceNotebookCellEdit, BulkCellEdits } from 'vscode/vscode/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
|
|
20
|
+
import { ResourceNotebookCellEdit, BulkCellEdits } from '@codingame/monaco-vscode-271a23cd-c7d7-5761-ae35-a923a42987b8-common/vscode/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
|
|
18
21
|
import { BulkFileEdits } from './bulkFileEdits.js';
|
|
19
22
|
import { BulkTextEdits } from './bulkTextEdits.js';
|
|
20
23
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
24
|
+
import { ShutdownReason } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
21
25
|
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
22
26
|
import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service';
|
|
27
|
+
import { ResourceAttachmentEdit, OpaqueEdits } from './opaqueEdits.js';
|
|
23
28
|
|
|
24
29
|
function liftEdits(edits) {
|
|
25
|
-
return (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
30
|
+
return ( edits.map(edit => {
|
|
31
|
+
if (ResourceTextEdit.is(edit)) {
|
|
32
|
+
return ResourceTextEdit.lift(edit);
|
|
33
|
+
}
|
|
34
|
+
if (ResourceFileEdit.is(edit)) {
|
|
35
|
+
return ResourceFileEdit.lift(edit);
|
|
36
|
+
}
|
|
37
|
+
if (ResourceNotebookCellEdit.is(edit)) {
|
|
38
|
+
return ResourceNotebookCellEdit.lift(edit);
|
|
39
|
+
}
|
|
40
|
+
if (ResourceAttachmentEdit.is(edit)) {
|
|
41
|
+
return ResourceAttachmentEdit.lift(edit);
|
|
42
|
+
}
|
|
43
|
+
throw ( new Error('Unsupported edit'));
|
|
44
|
+
}));
|
|
39
45
|
}
|
|
40
46
|
let BulkEdit = class BulkEdit {
|
|
41
47
|
constructor(_label, _code, _editor, _progress, _token, _edits, _undoRedoGroup, _undoRedoSource, _confirmBeforeUndo, _instaService, _logService) {
|
|
@@ -52,8 +58,8 @@ let BulkEdit = class BulkEdit {
|
|
|
52
58
|
this._logService = _logService;
|
|
53
59
|
}
|
|
54
60
|
ariaMessage() {
|
|
55
|
-
const otherResources = (
|
|
56
|
-
const textEditResources = (
|
|
61
|
+
const otherResources = ( new ResourceMap());
|
|
62
|
+
const textEditResources = ( new ResourceMap());
|
|
57
63
|
let textEditCount = 0;
|
|
58
64
|
for (const edit of this._edits) {
|
|
59
65
|
if (edit instanceof ResourceTextEdit) {
|
|
@@ -65,29 +71,29 @@ let BulkEdit = class BulkEdit {
|
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
73
|
if (this._edits.length === 0) {
|
|
68
|
-
return
|
|
74
|
+
return localize(4061, "Made no edits");
|
|
69
75
|
}
|
|
70
76
|
else if (otherResources.size === 0) {
|
|
71
77
|
if (textEditCount > 1 && textEditResources.size > 1) {
|
|
72
|
-
return
|
|
73
|
-
|
|
78
|
+
return localize(
|
|
79
|
+
4062,
|
|
74
80
|
"Made {0} text edits in {1} files",
|
|
75
81
|
textEditCount,
|
|
76
82
|
textEditResources.size
|
|
77
|
-
)
|
|
83
|
+
);
|
|
78
84
|
}
|
|
79
85
|
else {
|
|
80
|
-
return
|
|
86
|
+
return localize(4063, "Made {0} text edits in one file", textEditCount);
|
|
81
87
|
}
|
|
82
88
|
}
|
|
83
89
|
else {
|
|
84
|
-
return
|
|
85
|
-
|
|
90
|
+
return localize(
|
|
91
|
+
4064,
|
|
86
92
|
"Made {0} text edits in {1} files, also created or deleted {2} files",
|
|
87
93
|
textEditCount,
|
|
88
94
|
textEditResources.size,
|
|
89
95
|
otherResources.size
|
|
90
|
-
)
|
|
96
|
+
);
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
async perform() {
|
|
@@ -122,6 +128,9 @@ let BulkEdit = class BulkEdit {
|
|
|
122
128
|
else if (group[0] instanceof ResourceNotebookCellEdit) {
|
|
123
129
|
resources.push(await this._performCellEdits(group, this._undoRedoGroup, this._undoRedoSource, progress));
|
|
124
130
|
}
|
|
131
|
+
else if (group[0] instanceof ResourceAttachmentEdit) {
|
|
132
|
+
resources.push(await this._performOpaqueEdits(group, this._undoRedoGroup, this._undoRedoSource, progress));
|
|
133
|
+
}
|
|
125
134
|
else {
|
|
126
135
|
console.log('UNKNOWN EDIT');
|
|
127
136
|
}
|
|
@@ -131,12 +140,12 @@ let BulkEdit = class BulkEdit {
|
|
|
131
140
|
}
|
|
132
141
|
async _performFileEdits(edits, undoRedoGroup, undoRedoSource, confirmBeforeUndo, progress) {
|
|
133
142
|
this._logService.debug('_performFileEdits', JSON.stringify(edits));
|
|
134
|
-
const model = this._instaService.createInstance(BulkFileEdits, this._label || ( localize(
|
|
143
|
+
const model = this._instaService.createInstance(BulkFileEdits, this._label || ( localize(4065, "Workspace Edit")), this._code || 'undoredo.workspaceEdit', undoRedoGroup, undoRedoSource, confirmBeforeUndo, progress, this._token, edits);
|
|
135
144
|
return await model.apply();
|
|
136
145
|
}
|
|
137
146
|
async _performTextEdits(edits, undoRedoGroup, undoRedoSource, progress) {
|
|
138
147
|
this._logService.debug('_performTextEdits', JSON.stringify(edits));
|
|
139
|
-
const model = this._instaService.createInstance(BulkTextEdits, this._label || ( localize(
|
|
148
|
+
const model = this._instaService.createInstance(BulkTextEdits, this._label || ( localize(4065, "Workspace Edit")), this._code || 'undoredo.workspaceEdit', this._editor, undoRedoGroup, undoRedoSource, progress, this._token, edits);
|
|
140
149
|
return await model.apply();
|
|
141
150
|
}
|
|
142
151
|
async _performCellEdits(edits, undoRedoGroup, undoRedoSource, progress) {
|
|
@@ -144,11 +153,16 @@ let BulkEdit = class BulkEdit {
|
|
|
144
153
|
const model = this._instaService.createInstance(BulkCellEdits, undoRedoGroup, undoRedoSource, progress, this._token, edits);
|
|
145
154
|
return await model.apply();
|
|
146
155
|
}
|
|
156
|
+
async _performOpaqueEdits(edits, undoRedoGroup, undoRedoSource, progress) {
|
|
157
|
+
this._logService.debug('_performOpaqueEdits', JSON.stringify(edits));
|
|
158
|
+
const model = this._instaService.createInstance(OpaqueEdits, undoRedoGroup, undoRedoSource, progress, this._token, edits);
|
|
159
|
+
return await model.apply();
|
|
160
|
+
}
|
|
147
161
|
};
|
|
148
|
-
BulkEdit = (
|
|
149
|
-
(
|
|
150
|
-
(
|
|
151
|
-
], BulkEdit))
|
|
162
|
+
BulkEdit = ( __decorate([
|
|
163
|
+
( __param(9, IInstantiationService)),
|
|
164
|
+
( __param(10, ILogService))
|
|
165
|
+
], BulkEdit));
|
|
152
166
|
let BulkEditService = class BulkEditService {
|
|
153
167
|
constructor(_instaService, _logService, _editorService, _lifecycleService, _dialogService, _workingCopyService, _configService) {
|
|
154
168
|
this._instaService = _instaService;
|
|
@@ -158,7 +172,7 @@ let BulkEditService = class BulkEditService {
|
|
|
158
172
|
this._dialogService = _dialogService;
|
|
159
173
|
this._workingCopyService = _workingCopyService;
|
|
160
174
|
this._configService = _configService;
|
|
161
|
-
this._activeUndoRedoGroups = (
|
|
175
|
+
this._activeUndoRedoGroups = ( new LinkedList());
|
|
162
176
|
}
|
|
163
177
|
setPreviewHandler(handler) {
|
|
164
178
|
this._previewHandler = handler;
|
|
@@ -174,9 +188,9 @@ let BulkEditService = class BulkEditService {
|
|
|
174
188
|
async apply(editsIn, options) {
|
|
175
189
|
let edits = liftEdits(Array.isArray(editsIn) ? editsIn : editsIn.edits);
|
|
176
190
|
if (edits.length === 0) {
|
|
177
|
-
return { ariaSummary: ( localize(
|
|
191
|
+
return { ariaSummary: ( localize(4066, "Made no edits")), isApplied: false };
|
|
178
192
|
}
|
|
179
|
-
if (this._previewHandler && (options?.showPreview || (
|
|
193
|
+
if (this._previewHandler && (options?.showPreview || ( edits.some(value => value.metadata?.needsConfirmation)))) {
|
|
180
194
|
edits = await this._previewHandler(edits, options);
|
|
181
195
|
}
|
|
182
196
|
let codeEditor = options?.editor;
|
|
@@ -189,7 +203,7 @@ let BulkEditService = class BulkEditService {
|
|
|
189
203
|
codeEditor = candidate.getModifiedEditor();
|
|
190
204
|
}
|
|
191
205
|
}
|
|
192
|
-
if (codeEditor && codeEditor.getOption(
|
|
206
|
+
if (codeEditor && codeEditor.getOption(EditorOption.readOnly)) {
|
|
193
207
|
codeEditor = undefined;
|
|
194
208
|
}
|
|
195
209
|
let undoRedoGroup;
|
|
@@ -203,7 +217,7 @@ let BulkEditService = class BulkEditService {
|
|
|
203
217
|
}
|
|
204
218
|
}
|
|
205
219
|
if (!undoRedoGroup) {
|
|
206
|
-
undoRedoGroup = (
|
|
220
|
+
undoRedoGroup = ( new UndoRedoGroup());
|
|
207
221
|
undoRedoGroupRemove = this._activeUndoRedoGroups.push(undoRedoGroup);
|
|
208
222
|
}
|
|
209
223
|
const label = options?.quotableLabel || options?.label;
|
|
@@ -227,12 +241,12 @@ let BulkEditService = class BulkEditService {
|
|
|
227
241
|
}
|
|
228
242
|
}
|
|
229
243
|
async _saveAll(resources) {
|
|
230
|
-
const set = (
|
|
231
|
-
const saves = (
|
|
232
|
-
if ((
|
|
244
|
+
const set = ( new ResourceSet(resources));
|
|
245
|
+
const saves = ( this._workingCopyService.dirtyWorkingCopies.map(async (copy) => {
|
|
246
|
+
if (( set.has(copy.resource))) {
|
|
233
247
|
await copy.save();
|
|
234
248
|
}
|
|
235
|
-
}))
|
|
249
|
+
}));
|
|
236
250
|
const result = await Promise.allSettled(saves);
|
|
237
251
|
for (const item of result) {
|
|
238
252
|
if (item.status === 'rejected') {
|
|
@@ -244,47 +258,51 @@ let BulkEditService = class BulkEditService {
|
|
|
244
258
|
let message;
|
|
245
259
|
let primaryButton;
|
|
246
260
|
switch (reason) {
|
|
247
|
-
case
|
|
248
|
-
message = ( localize(
|
|
249
|
-
primaryButton = ( localize(
|
|
261
|
+
case ShutdownReason.CLOSE:
|
|
262
|
+
message = ( localize(4067, "Are you sure you want to close the window?"));
|
|
263
|
+
primaryButton = ( localize(4068, "&&Close Window"));
|
|
250
264
|
break;
|
|
251
|
-
case
|
|
252
|
-
message = ( localize(
|
|
253
|
-
primaryButton = ( localize(
|
|
265
|
+
case ShutdownReason.LOAD:
|
|
266
|
+
message = ( localize(4069, "Are you sure you want to change the workspace?"));
|
|
267
|
+
primaryButton = ( localize(4070, "Change &&Workspace"));
|
|
254
268
|
break;
|
|
255
|
-
case
|
|
256
|
-
message = ( localize(
|
|
257
|
-
primaryButton = ( localize(
|
|
269
|
+
case ShutdownReason.RELOAD:
|
|
270
|
+
message = ( localize(4071, "Are you sure you want to reload the window?"));
|
|
271
|
+
primaryButton = ( localize(4072, "&&Reload Window"));
|
|
258
272
|
break;
|
|
259
273
|
default:
|
|
260
|
-
message = ( localize(
|
|
261
|
-
primaryButton = ( localize(
|
|
274
|
+
message = ( localize(4073, "Are you sure you want to quit?"));
|
|
275
|
+
primaryButton = ( localize(4074, "&&Quit"));
|
|
262
276
|
break;
|
|
263
277
|
}
|
|
264
278
|
const result = await this._dialogService.confirm({
|
|
265
279
|
message,
|
|
266
|
-
detail: ( localize(
|
|
280
|
+
detail: ( localize(
|
|
281
|
+
4075,
|
|
282
|
+
"'{0}' is in progress.",
|
|
283
|
+
label || ( localize(4076, "File operation"))
|
|
284
|
+
)),
|
|
267
285
|
primaryButton
|
|
268
286
|
});
|
|
269
287
|
return !result.confirmed;
|
|
270
288
|
}
|
|
271
289
|
};
|
|
272
|
-
BulkEditService = (
|
|
273
|
-
(
|
|
274
|
-
(
|
|
275
|
-
(
|
|
276
|
-
(
|
|
277
|
-
(
|
|
278
|
-
(
|
|
279
|
-
(
|
|
280
|
-
], BulkEditService))
|
|
290
|
+
BulkEditService = ( __decorate([
|
|
291
|
+
( __param(0, IInstantiationService)),
|
|
292
|
+
( __param(1, ILogService)),
|
|
293
|
+
( __param(2, IEditorService)),
|
|
294
|
+
( __param(3, ILifecycleService)),
|
|
295
|
+
( __param(4, IDialogService)),
|
|
296
|
+
( __param(5, IWorkingCopyService)),
|
|
297
|
+
( __param(6, IConfigurationService))
|
|
298
|
+
], BulkEditService));
|
|
281
299
|
const autoSaveSetting = 'files.refactoring.autoSave';
|
|
282
|
-
(
|
|
300
|
+
( Registry.as(Extensions.Configuration)).registerConfiguration({
|
|
283
301
|
id: 'files',
|
|
284
302
|
properties: {
|
|
285
303
|
[autoSaveSetting]: {
|
|
286
304
|
description: ( localize(
|
|
287
|
-
|
|
305
|
+
4077,
|
|
288
306
|
"Controls if files that were part of a refactoring are saved automatically"
|
|
289
307
|
)),
|
|
290
308
|
default: true,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IProgress } from "vscode/vscode/vs/platform/progress/common/progress";
|
|
2
|
+
import { UndoRedoGroup, UndoRedoSource } from "vscode/vscode/vs/platform/undoRedo/common/undoRedo";
|
|
3
|
+
import { IUndoRedoService } from "vscode/vscode/vs/platform/undoRedo/common/undoRedo.service";
|
|
4
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
5
|
+
import { IInstantiationService } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
6
|
+
import { ResourceFileEdit } from "vscode/vscode/vs/editor/browser/services/bulkEditService";
|
|
7
|
+
import { CancellationToken } from "vscode/vscode/vs/base/common/cancellation";
|
|
8
|
+
export declare class BulkFileEdits {
|
|
9
|
+
private readonly _label;
|
|
10
|
+
private readonly _code;
|
|
11
|
+
private readonly _undoRedoGroup;
|
|
12
|
+
private readonly _undoRedoSource;
|
|
13
|
+
private readonly _confirmBeforeUndo;
|
|
14
|
+
private readonly _progress;
|
|
15
|
+
private readonly _token;
|
|
16
|
+
private readonly _edits;
|
|
17
|
+
private readonly _instaService;
|
|
18
|
+
private readonly _undoRedoService;
|
|
19
|
+
constructor(_label: string, _code: string, _undoRedoGroup: UndoRedoGroup, _undoRedoSource: UndoRedoSource | undefined, _confirmBeforeUndo: boolean, _progress: IProgress<void>, _token: CancellationToken, _edits: ResourceFileEdit[], _instaService: IInstantiationService, _undoRedoService: IUndoRedoService);
|
|
20
|
+
apply(): Promise<readonly URI[]>;
|
|
21
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
3
|
+
import { FileSystemProviderCapabilities } from 'vscode/vscode/vs/platform/files/common/files';
|
|
2
4
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
3
5
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
4
6
|
import { IWorkingCopyFileService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service';
|
|
7
|
+
import { UndoRedoElementType } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo';
|
|
5
8
|
import { IUndoRedoService } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo.service';
|
|
6
9
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
7
10
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
8
11
|
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
9
|
-
import { tail } from 'vscode/vscode/vs/base/common/arrays';
|
|
10
12
|
import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles.service';
|
|
11
13
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
12
14
|
|
|
@@ -219,7 +221,7 @@ let DeleteOperation = class DeleteOperation {
|
|
|
219
221
|
deletes.push({
|
|
220
222
|
resource: edit.oldUri,
|
|
221
223
|
recursive: edit.options.recursive,
|
|
222
|
-
useTrash: !edit.options.skipTrashBin && this._fileService.hasCapability(edit.oldUri,
|
|
224
|
+
useTrash: !edit.options.skipTrashBin && this._fileService.hasCapability(edit.oldUri, FileSystemProviderCapabilities.Trash) && this._configurationService.getValue('files.enableTrash')
|
|
223
225
|
});
|
|
224
226
|
let fileContent;
|
|
225
227
|
if (!edit.undoesCreate && !edit.options.folder && !(typeof edit.options.maxSize === 'number' && fileStat.size > edit.options.maxSize)) {
|
|
@@ -260,7 +262,7 @@ class FileUndoRedoElement {
|
|
|
260
262
|
this.code = code;
|
|
261
263
|
this.operations = operations;
|
|
262
264
|
this.confirmBeforeUndo = confirmBeforeUndo;
|
|
263
|
-
this.type =
|
|
265
|
+
this.type = UndoRedoElementType.Workspace;
|
|
264
266
|
this.resources = operations.flatMap(op => op.uris);
|
|
265
267
|
}
|
|
266
268
|
async undo() {
|
|
@@ -318,7 +320,7 @@ let BulkFileEdits = class BulkFileEdits {
|
|
|
318
320
|
groups[0] = [edits[0]];
|
|
319
321
|
for (let i = 1; i < edits.length; i++) {
|
|
320
322
|
const edit = edits[i];
|
|
321
|
-
const lastGroup =
|
|
323
|
+
const lastGroup = groups.at(-1);
|
|
322
324
|
if (lastGroup?.[0].type === edit.type) {
|
|
323
325
|
lastGroup.push(edit);
|
|
324
326
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
2
|
+
import { ICodeEditor } from "vscode/vscode/vs/editor/browser/editorBrowser";
|
|
3
|
+
import { ITextModelService } from "vscode/vscode/vs/editor/common/services/resolverService";
|
|
4
|
+
import { IProgress } from "vscode/vscode/vs/platform/progress/common/progress";
|
|
5
|
+
import { IEditorWorkerService } from "vscode/vscode/vs/editor/common/services/editorWorker";
|
|
6
|
+
import { UndoRedoGroup, UndoRedoSource } from "vscode/vscode/vs/platform/undoRedo/common/undoRedo";
|
|
7
|
+
import { IUndoRedoService } from "vscode/vscode/vs/platform/undoRedo/common/undoRedo.service";
|
|
8
|
+
import { IModelService } from "vscode/vscode/vs/editor/common/services/model";
|
|
9
|
+
import { ResourceTextEdit } from "vscode/vscode/vs/editor/browser/services/bulkEditService";
|
|
10
|
+
import { CancellationToken } from "vscode/vscode/vs/base/common/cancellation";
|
|
11
|
+
export declare class BulkTextEdits {
|
|
12
|
+
private readonly _label;
|
|
13
|
+
private readonly _code;
|
|
14
|
+
private readonly _editor;
|
|
15
|
+
private readonly _undoRedoGroup;
|
|
16
|
+
private readonly _undoRedoSource;
|
|
17
|
+
private readonly _progress;
|
|
18
|
+
private readonly _token;
|
|
19
|
+
private readonly _editorWorker;
|
|
20
|
+
private readonly _modelService;
|
|
21
|
+
private readonly _textModelResolverService;
|
|
22
|
+
private readonly _undoRedoService;
|
|
23
|
+
private readonly _edits;
|
|
24
|
+
constructor(_label: string, _code: string, _editor: ICodeEditor | undefined, _undoRedoGroup: UndoRedoGroup, _undoRedoSource: UndoRedoSource | undefined, _progress: IProgress<void>, _token: CancellationToken, edits: ResourceTextEdit[], _editorWorker: IEditorWorkerService, _modelService: IModelService, _textModelResolverService: ITextModelService, _undoRedoService: IUndoRedoService);
|
|
25
|
+
private _validateBeforePrepare;
|
|
26
|
+
private _createEditsTasks;
|
|
27
|
+
private _validateTasks;
|
|
28
|
+
apply(): Promise<readonly URI[]>;
|
|
29
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
4
|
import { EditOperation } from 'vscode/vscode/vs/editor/common/core/editOperation';
|
|
4
5
|
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IFileService } from "vscode/vscode/vs/platform/files/common/files.service";
|
|
2
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
3
|
+
import { IModelService } from "vscode/vscode/vs/editor/common/services/model";
|
|
4
|
+
import { Event } from "vscode/vscode/vs/base/common/event";
|
|
5
|
+
import { ResourceEdit } from "vscode/vscode/vs/editor/browser/services/bulkEditService";
|
|
6
|
+
import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
|
|
7
|
+
export declare class ConflictDetector {
|
|
8
|
+
private readonly _conflicts;
|
|
9
|
+
private readonly _disposables;
|
|
10
|
+
private readonly _onDidConflict;
|
|
11
|
+
readonly onDidConflict: Event<this>;
|
|
12
|
+
constructor(edits: ResourceEdit[], fileService: IFileService, modelService: IModelService, logService: ILogService);
|
|
13
|
+
dispose(): void;
|
|
14
|
+
list(): URI[];
|
|
15
|
+
hasConflicts(): boolean;
|
|
16
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
3
4
|
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
4
5
|
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
5
6
|
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
6
7
|
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
7
8
|
import { ResourceTextEdit, ResourceFileEdit } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
|
|
8
|
-
import { ResourceNotebookCellEdit } from 'vscode/vscode/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
|
|
9
|
+
import { ResourceNotebookCellEdit } from '@codingame/monaco-vscode-271a23cd-c7d7-5761-ae35-a923a42987b8-common/vscode/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
|
|
9
10
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
10
11
|
|
|
11
12
|
let ConflictDetector = class ConflictDetector {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CancellationToken } from "vscode/vscode/vs/base/common/cancellation";
|
|
2
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
3
|
+
import { ResourceEdit } from "vscode/vscode/vs/editor/browser/services/bulkEditService";
|
|
4
|
+
import { ICustomEdit, WorkspaceEditMetadata } from "vscode/vscode/vs/editor/common/languages";
|
|
5
|
+
import { IProgress } from "vscode/vscode/vs/platform/progress/common/progress";
|
|
6
|
+
import { UndoRedoGroup, UndoRedoSource } from "vscode/vscode/vs/platform/undoRedo/common/undoRedo";
|
|
7
|
+
import { IUndoRedoService } from "vscode/vscode/vs/platform/undoRedo/common/undoRedo.service";
|
|
8
|
+
export declare class ResourceAttachmentEdit extends ResourceEdit implements ICustomEdit {
|
|
9
|
+
readonly resource: URI;
|
|
10
|
+
readonly undo: () => Promise<void> | void;
|
|
11
|
+
readonly redo: () => Promise<void> | void;
|
|
12
|
+
static is(candidate: any): candidate is ICustomEdit;
|
|
13
|
+
static lift(edit: ICustomEdit): ResourceAttachmentEdit;
|
|
14
|
+
constructor(resource: URI, undo: () => Promise<void> | void, redo: () => Promise<void> | void, metadata?: WorkspaceEditMetadata);
|
|
15
|
+
}
|
|
16
|
+
export declare class OpaqueEdits {
|
|
17
|
+
private readonly _undoRedoGroup;
|
|
18
|
+
private readonly _undoRedoSource;
|
|
19
|
+
private readonly _progress;
|
|
20
|
+
private readonly _token;
|
|
21
|
+
private readonly _edits;
|
|
22
|
+
private readonly _undoRedoService;
|
|
23
|
+
constructor(_undoRedoGroup: UndoRedoGroup, _undoRedoSource: UndoRedoSource | undefined, _progress: IProgress<void>, _token: CancellationToken, _edits: ResourceAttachmentEdit[], _undoRedoService: IUndoRedoService);
|
|
24
|
+
apply(): Promise<readonly URI[]>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
3
|
+
import { isObject } from 'vscode/vscode/vs/base/common/types';
|
|
4
|
+
import { ResourceEdit } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
|
|
5
|
+
import { UndoRedoElementType } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo';
|
|
6
|
+
import { IUndoRedoService } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo.service';
|
|
7
|
+
|
|
8
|
+
class ResourceAttachmentEdit extends ResourceEdit {
|
|
9
|
+
static is(candidate) {
|
|
10
|
+
if (candidate instanceof ResourceAttachmentEdit) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return isObject(candidate)
|
|
15
|
+
&& (Boolean(candidate.undo && candidate.redo));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
static lift(edit) {
|
|
19
|
+
if (edit instanceof ResourceAttachmentEdit) {
|
|
20
|
+
return edit;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return ( new ResourceAttachmentEdit(edit.resource, edit.undo, edit.redo, edit.metadata));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
constructor(resource, undo, redo, metadata) {
|
|
27
|
+
super(metadata);
|
|
28
|
+
this.resource = resource;
|
|
29
|
+
this.undo = undo;
|
|
30
|
+
this.redo = redo;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
let OpaqueEdits = class OpaqueEdits {
|
|
34
|
+
constructor(_undoRedoGroup, _undoRedoSource, _progress, _token, _edits, _undoRedoService) {
|
|
35
|
+
this._undoRedoGroup = _undoRedoGroup;
|
|
36
|
+
this._undoRedoSource = _undoRedoSource;
|
|
37
|
+
this._progress = _progress;
|
|
38
|
+
this._token = _token;
|
|
39
|
+
this._edits = _edits;
|
|
40
|
+
this._undoRedoService = _undoRedoService;
|
|
41
|
+
}
|
|
42
|
+
async apply() {
|
|
43
|
+
const resources = [];
|
|
44
|
+
for (const edit of this._edits) {
|
|
45
|
+
if (this._token.isCancellationRequested) {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
await edit.redo();
|
|
49
|
+
this._undoRedoService.pushElement({
|
|
50
|
+
type: UndoRedoElementType.Resource,
|
|
51
|
+
resource: edit.resource,
|
|
52
|
+
label: edit.metadata?.label || 'Custom Edit',
|
|
53
|
+
code: 'paste',
|
|
54
|
+
undo: edit.undo,
|
|
55
|
+
redo: edit.redo,
|
|
56
|
+
}, this._undoRedoGroup, this._undoRedoSource);
|
|
57
|
+
this._progress.report(undefined);
|
|
58
|
+
resources.push(edit.resource);
|
|
59
|
+
}
|
|
60
|
+
return resources;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
OpaqueEdits = ( __decorate([
|
|
64
|
+
( __param(5, IUndoRedoService))
|
|
65
|
+
], OpaqueEdits));
|
|
66
|
+
|
|
67
|
+
export { OpaqueEdits, ResourceAttachmentEdit };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|