@codingame/monaco-vscode-api 1.83.1 → 1.83.2
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/monaco-editor-treemending.patch +555 -555
- package/package.json +1 -1
- package/vscode/src/vs/platform/extensionManagement/common/extensionNls.js +1 -1
- package/vscode/src/vs/platform/workspaces/common/workspaces.js +15 -15
- package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +49 -51
- package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +58 -69
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +23 -23
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +16 -16
- package/vscode/src/vs/workbench/api/common/extHostCommands.js +59 -65
- package/vscode/src/vs/workbench/api/common/extHostConsoleForwarder.js +8 -8
- package/vscode/src/vs/workbench/api/common/extHostLanguageFeatures.js +151 -215
- package/vscode/src/vs/workbench/api/common/extHostSCM.js +54 -58
- package/vscode/src/vs/workbench/api/common/extHostTreeViews.js +53 -55
- package/vscode/src/vs/workbench/api/common/extHostTunnelService.js +28 -28
- package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +265 -277
- package/vscode/src/vs/workbench/api/common/extensionHostMain.js +17 -19
- package/vscode/src/vs/workbench/api/worker/extHostExtensionService.js +5 -5
- package/vscode/src/vs/workbench/browser/parts/editor/sideBySideEditor.js +26 -32
- package/vscode/src/vs/workbench/browser/parts/editor/textDiffEditor.js +20 -26
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkFileEdits.js +58 -74
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +19 -19
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +32 -36
- package/vscode/src/vs/workbench/contrib/debug/browser/debugColors.js +19 -19
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +73 -126
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetsService.js +66 -74
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +82 -92
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +27 -29
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +122 -124
- package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +35 -39
- package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +25 -25
- package/vscode/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.js +30 -32
- package/vscode/src/vs/workbench/services/remote/common/tunnelModel.js +82 -92
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModel.js +31 -31
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorService.js +16 -16
- package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyBackupService.js +32 -42
|
@@ -21,7 +21,7 @@ class ErrorHandler {
|
|
|
21
21
|
Error.stackTraceLimit = 100;
|
|
22
22
|
const logService = accessor.get(ILogService);
|
|
23
23
|
const rpcService = accessor.get(IExtHostRpcService);
|
|
24
|
-
const mainThreadErrors = (
|
|
24
|
+
const mainThreadErrors = ( rpcService.getProxy(MainContext.MainThreadErrors));
|
|
25
25
|
errors.setUnexpectedErrorHandler(err => {
|
|
26
26
|
logService.error(err);
|
|
27
27
|
const data = errors.transformErrorForSerialization(err);
|
|
@@ -33,19 +33,19 @@ class ErrorHandler {
|
|
|
33
33
|
const rpcService = accessor.get(IExtHostRpcService);
|
|
34
34
|
const extensionService = accessor.get(IExtHostExtensionService);
|
|
35
35
|
const extensionTelemetry = accessor.get(IExtHostTelemetry);
|
|
36
|
-
const mainThreadExtensions = (
|
|
37
|
-
const mainThreadErrors = (
|
|
36
|
+
const mainThreadExtensions = ( rpcService.getProxy(MainContext.MainThreadExtensionService));
|
|
37
|
+
const mainThreadErrors = ( rpcService.getProxy(MainContext.MainThreadErrors));
|
|
38
38
|
const map = await extensionService.getExtensionPathIndex();
|
|
39
|
-
const extensionErrors = (
|
|
39
|
+
const extensionErrors = ( new WeakMap());
|
|
40
40
|
function prepareStackTraceAndFindExtension(error, stackTrace) {
|
|
41
|
-
if ((
|
|
41
|
+
if (( extensionErrors.has(error))) {
|
|
42
42
|
return extensionErrors.get(error).stack;
|
|
43
43
|
}
|
|
44
44
|
let stackTraceMessage = '';
|
|
45
45
|
let extension;
|
|
46
46
|
let fileName;
|
|
47
47
|
for (const call of stackTrace) {
|
|
48
|
-
stackTraceMessage += `\n\tat ${(
|
|
48
|
+
stackTraceMessage += `\n\tat ${( call.toString())}`;
|
|
49
49
|
fileName = call.getFileName();
|
|
50
50
|
if (!extension && fileName) {
|
|
51
51
|
extension = map.findSubstr(URI.file(fileName));
|
|
@@ -91,16 +91,16 @@ class ErrorHandler {
|
|
|
91
91
|
class ExtensionHostMain {
|
|
92
92
|
constructor(protocol, initData, hostUtils, uriTransformer, messagePorts) {
|
|
93
93
|
this._hostUtils = hostUtils;
|
|
94
|
-
this._rpcProtocol = (
|
|
94
|
+
this._rpcProtocol = ( new RPCProtocol(protocol, null, uriTransformer));
|
|
95
95
|
initData = ExtensionHostMain._transform(initData, this._rpcProtocol);
|
|
96
|
-
const services = (
|
|
96
|
+
const services = ( new ServiceCollection(...getSingletonServiceDescriptors()));
|
|
97
97
|
services.set(IExtHostInitDataService, { _serviceBrand: undefined, ...initData, messagePorts });
|
|
98
|
-
services.set(IExtHostRpcService, (
|
|
99
|
-
services.set(IURITransformerService, (
|
|
98
|
+
services.set(IExtHostRpcService, ( new ExtHostRpcService(this._rpcProtocol)));
|
|
99
|
+
services.set(IURITransformerService, ( new URITransformerService(uriTransformer)));
|
|
100
100
|
services.set(IHostUtils, hostUtils);
|
|
101
|
-
services.set(ILogService, (
|
|
102
|
-
services.set(ILoggerService, (
|
|
103
|
-
const instaService = (
|
|
101
|
+
services.set(ILogService, ( new SyncDescriptor(ExtHostLogService, [true], true)));
|
|
102
|
+
services.set(ILoggerService, ( new SyncDescriptor(ExtHostLoggerService, [], true)));
|
|
103
|
+
const instaService = ( new InstantiationService(services, true));
|
|
104
104
|
if (isWebWorker) {
|
|
105
105
|
instaService.invokeFunction(ErrorHandler.installEarlyHandler);
|
|
106
106
|
}
|
|
@@ -120,14 +120,12 @@ class ExtensionHostMain {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
async asBrowserUri(uri) {
|
|
123
|
-
const mainThreadExtensionsProxy = (
|
|
123
|
+
const mainThreadExtensionsProxy = ( this._rpcProtocol.getProxy(MainContext.MainThreadExtensionService));
|
|
124
124
|
return URI.revive(await mainThreadExtensionsProxy.$asBrowserUri(uri));
|
|
125
125
|
}
|
|
126
126
|
async getAllStaticBrowserUris() {
|
|
127
|
-
const mainThreadExtensionsProxy = (
|
|
128
|
-
return (
|
|
129
|
-
((await mainThreadExtensionsProxy.$getAllStaticBrowserUris()).map(([from, to]) => [URI.revive(from), URI.revive(to)]))
|
|
130
|
-
);
|
|
127
|
+
const mainThreadExtensionsProxy = ( this._rpcProtocol.getProxy(MainContext.MainThreadExtensionService));
|
|
128
|
+
return ( (await mainThreadExtensionsProxy.$getAllStaticBrowserUris()).map(([from, to]) => [URI.revive(from), URI.revive(to)]));
|
|
131
129
|
}
|
|
132
130
|
terminate(reason) {
|
|
133
131
|
this._extensionService.terminate(reason);
|
|
@@ -142,7 +140,7 @@ class ExtensionHostMain {
|
|
|
142
140
|
initData.environment.appRoot = URI.revive(rpcProtocol.transformIncomingURIs(initData.environment.appRoot));
|
|
143
141
|
const extDevLocs = initData.environment.extensionDevelopmentLocationURI;
|
|
144
142
|
if (extDevLocs) {
|
|
145
|
-
initData.environment.extensionDevelopmentLocationURI = (
|
|
143
|
+
initData.environment.extensionDevelopmentLocationURI = ( extDevLocs.map(url => URI.revive(rpcProtocol.transformIncomingURIs(url))));
|
|
146
144
|
}
|
|
147
145
|
initData.environment.extensionTestsLocationURI = URI.revive(rpcProtocol.transformIncomingURIs(initData.environment.extensionTestsLocationURI));
|
|
148
146
|
initData.environment.globalStorageHome = URI.revive(rpcProtocol.transformIncomingURIs(initData.environment.globalStorageHome));
|
|
@@ -16,7 +16,7 @@ class WorkerRequireInterceptor extends RequireInterceptor {
|
|
|
16
16
|
break;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
if ((
|
|
19
|
+
if (( this._factories.has(request))) {
|
|
20
20
|
return this._factories.get(request).load(request, parent, () => { throw new Error('CANNOT LOAD MODULE from here.'); });
|
|
21
21
|
}
|
|
22
22
|
return undefined;
|
|
@@ -47,7 +47,7 @@ class ExtHostExtensionService extends AbstractExtHostExtensionService {
|
|
|
47
47
|
performance.mark(`code/extHost/willFetchExtensionCode/${extensionId}`);
|
|
48
48
|
}
|
|
49
49
|
const browserUri = URI.revive(await this._mainThreadExtensionsProxy.$asBrowserUri(module));
|
|
50
|
-
const response = await fetch((
|
|
50
|
+
const response = await fetch(( browserUri.toString(true)));
|
|
51
51
|
if (extensionId) {
|
|
52
52
|
performance.mark(`code/extHost/didFetchExtensionCode/${extensionId}`);
|
|
53
53
|
}
|
|
@@ -55,11 +55,11 @@ class ExtHostExtensionService extends AbstractExtHostExtensionService {
|
|
|
55
55
|
throw new Error(response.statusText);
|
|
56
56
|
}
|
|
57
57
|
const source = await response.text();
|
|
58
|
-
const sourceURL = `${(
|
|
58
|
+
const sourceURL = `${( module.toString(true))}#vscode-extension`;
|
|
59
59
|
const fullSource = `${source}\n//# sourceURL=${sourceURL}`;
|
|
60
60
|
let initFn;
|
|
61
61
|
try {
|
|
62
|
-
initFn = (
|
|
62
|
+
initFn = ( new Function('module', 'exports', 'require', fullSource));
|
|
63
63
|
}
|
|
64
64
|
catch (err) {
|
|
65
65
|
if (extensionId) {
|
|
@@ -68,7 +68,7 @@ class ExtHostExtensionService extends AbstractExtHostExtensionService {
|
|
|
68
68
|
else {
|
|
69
69
|
console.error(`Loading code failed: ${err.message}`);
|
|
70
70
|
}
|
|
71
|
-
console.error(`${(
|
|
71
|
+
console.error(`${( module.toString(true))}${typeof err.line === 'number' ? ` line ${err.line}` : ''}${typeof err.column === 'number' ? ` column ${err.column}` : ''}`);
|
|
72
72
|
console.error(err);
|
|
73
73
|
throw err;
|
|
74
74
|
}
|
|
@@ -51,17 +51,17 @@ let SideBySideEditor = class SideBySideEditor extends AbstractEditorWithViewStat
|
|
|
51
51
|
constructor(telemetryService, instantiationService, themeService, storageService, configurationService, textResourceConfigurationService, editorService, editorGroupService) {
|
|
52
52
|
super(SideBySideEditor_1.ID, SideBySideEditor_1.VIEW_STATE_PREFERENCE_KEY, telemetryService, instantiationService, storageService, textResourceConfigurationService, themeService, editorService, editorGroupService);
|
|
53
53
|
this.configurationService = configurationService;
|
|
54
|
-
this.onDidCreateEditors = this._register((
|
|
55
|
-
this._onDidChangeSizeConstraints = this._register((
|
|
54
|
+
this.onDidCreateEditors = this._register(( new Emitter()));
|
|
55
|
+
this._onDidChangeSizeConstraints = this._register(( new Relay()));
|
|
56
56
|
this.onDidChangeSizeConstraints = Event.any(this.onDidCreateEditors.event, this._onDidChangeSizeConstraints.event);
|
|
57
|
-
this._onDidChangeSelection = this._register((
|
|
57
|
+
this._onDidChangeSelection = this._register(( new Emitter()));
|
|
58
58
|
this.onDidChangeSelection = this._onDidChangeSelection.event;
|
|
59
59
|
this.primaryEditorPane = undefined;
|
|
60
60
|
this.secondaryEditorPane = undefined;
|
|
61
|
-
this.splitviewDisposables = this._register((
|
|
62
|
-
this.editorDisposables = this._register((
|
|
61
|
+
this.splitviewDisposables = this._register(( new DisposableStore()));
|
|
62
|
+
this.editorDisposables = this._register(( new DisposableStore()));
|
|
63
63
|
this.orientation = this.configurationService.getValue(SideBySideEditor_1.SIDE_BY_SIDE_LAYOUT_SETTING) === 'vertical' ? 0 : 1 ;
|
|
64
|
-
this.dimension = (
|
|
64
|
+
this.dimension = ( new Dimension(0, 0));
|
|
65
65
|
this.lastFocusedSide = undefined;
|
|
66
66
|
this.registerListeners();
|
|
67
67
|
}
|
|
@@ -105,7 +105,7 @@ let SideBySideEditor = class SideBySideEditor extends AbstractEditorWithViewStat
|
|
|
105
105
|
this.createSplitView(parent);
|
|
106
106
|
}
|
|
107
107
|
createSplitView(parent, ratio) {
|
|
108
|
-
this.splitview = this.splitviewDisposables.add((
|
|
108
|
+
this.splitview = this.splitviewDisposables.add(( new SplitView(parent, { orientation: this.orientation })));
|
|
109
109
|
this.splitviewDisposables.add(this.splitview.onDidSashReset(() => this.splitview?.distributeViewSizes()));
|
|
110
110
|
if (this.orientation === 1 ) {
|
|
111
111
|
this.splitview.orthogonalEndSash = this._boundarySashes?.bottom;
|
|
@@ -144,9 +144,7 @@ let SideBySideEditor = class SideBySideEditor extends AbstractEditorWithViewStat
|
|
|
144
144
|
if (this.input) {
|
|
145
145
|
return this.input.getName();
|
|
146
146
|
}
|
|
147
|
-
return (
|
|
148
|
-
(localize('sideBySideEditor', "Side by Side Editor"))
|
|
149
|
-
);
|
|
147
|
+
return ( localize('sideBySideEditor', "Side by Side Editor"));
|
|
150
148
|
}
|
|
151
149
|
async setInput(input, options, context, token) {
|
|
152
150
|
const oldInput = this.input;
|
|
@@ -199,13 +197,13 @@ let SideBySideEditor = class SideBySideEditor extends AbstractEditorWithViewStat
|
|
|
199
197
|
this.secondaryEditorPane = this.doCreateEditor(newInput.secondary, assertIsDefined(this.secondaryEditorContainer));
|
|
200
198
|
this.primaryEditorPane = this.doCreateEditor(newInput.primary, assertIsDefined(this.primaryEditorContainer));
|
|
201
199
|
this.layout(this.dimension);
|
|
202
|
-
this._onDidChangeSizeConstraints.input = Event.any((
|
|
200
|
+
this._onDidChangeSizeConstraints.input = Event.any(( Event.map(this.secondaryEditorPane.onDidChangeSizeConstraints, () => undefined)), ( Event.map(this.primaryEditorPane.onDidChangeSizeConstraints, () => undefined)));
|
|
203
201
|
this.onDidCreateEditors.fire(undefined);
|
|
204
202
|
this.editorDisposables.add(this.primaryEditorPane.onDidFocus(() => this.onDidFocusChange(SideBySideEditor$1.PRIMARY)));
|
|
205
203
|
this.editorDisposables.add(this.secondaryEditorPane.onDidFocus(() => this.onDidFocusChange(SideBySideEditor$1.SECONDARY)));
|
|
206
204
|
}
|
|
207
205
|
doCreateEditor(editorInput, container) {
|
|
208
|
-
const editorPaneDescriptor = (
|
|
206
|
+
const editorPaneDescriptor = ( Registry.as(EditorExtensions.EditorPane)).getEditorPane(editorInput);
|
|
209
207
|
if (!editorPaneDescriptor) {
|
|
210
208
|
throw new Error('No editor pane descriptor for editor found');
|
|
211
209
|
}
|
|
@@ -227,12 +225,10 @@ let SideBySideEditor = class SideBySideEditor extends AbstractEditorWithViewStat
|
|
|
227
225
|
if (isEditorPaneWithSelection(lastFocusedEditorPane)) {
|
|
228
226
|
const selection = lastFocusedEditorPane.getSelection();
|
|
229
227
|
if (selection) {
|
|
230
|
-
return (
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
))
|
|
235
|
-
);
|
|
228
|
+
return ( new SideBySideAwareEditorPaneSelection(
|
|
229
|
+
selection,
|
|
230
|
+
lastFocusedEditorPane === this.primaryEditorPane ? SideBySideEditor$1.PRIMARY : SideBySideEditor$1.SECONDARY
|
|
231
|
+
));
|
|
236
232
|
}
|
|
237
233
|
}
|
|
238
234
|
return undefined;
|
|
@@ -276,7 +272,7 @@ let SideBySideEditor = class SideBySideEditor extends AbstractEditorWithViewStat
|
|
|
276
272
|
}
|
|
277
273
|
}
|
|
278
274
|
layoutPane(pane, size) {
|
|
279
|
-
pane?.layout(this.orientation === 1 ? (
|
|
275
|
+
pane?.layout(this.orientation === 1 ? ( new Dimension(size, this.dimension.height)) : ( new Dimension(this.dimension.width, size)));
|
|
280
276
|
}
|
|
281
277
|
getControl() {
|
|
282
278
|
return this.getLastFocusedEditorPane()?.getControl();
|
|
@@ -316,9 +312,7 @@ let SideBySideEditor = class SideBySideEditor extends AbstractEditorWithViewStat
|
|
|
316
312
|
if (!secondary || !primary) {
|
|
317
313
|
return undefined;
|
|
318
314
|
}
|
|
319
|
-
return (
|
|
320
|
-
(URI.from({ scheme: 'sideBySide', path: `${multibyteAwareBtoa(( ( secondary.toString())))}${multibyteAwareBtoa(( ( primary.toString())))}` }))
|
|
321
|
-
);
|
|
315
|
+
return ( URI.from({ scheme: 'sideBySide', path: `${multibyteAwareBtoa(( secondary.toString()))}${multibyteAwareBtoa(( primary.toString()))}` }));
|
|
322
316
|
}
|
|
323
317
|
updateStyles() {
|
|
324
318
|
super.updateStyles();
|
|
@@ -354,16 +348,16 @@ let SideBySideEditor = class SideBySideEditor extends AbstractEditorWithViewStat
|
|
|
354
348
|
}
|
|
355
349
|
}
|
|
356
350
|
};
|
|
357
|
-
SideBySideEditor = SideBySideEditor_1 = (
|
|
358
|
-
(
|
|
359
|
-
(
|
|
360
|
-
(
|
|
361
|
-
(
|
|
362
|
-
(
|
|
363
|
-
(
|
|
364
|
-
(
|
|
365
|
-
(
|
|
366
|
-
], SideBySideEditor))
|
|
351
|
+
SideBySideEditor = SideBySideEditor_1 = ( __decorate([
|
|
352
|
+
( __param(0, ITelemetryService)),
|
|
353
|
+
( __param(1, IInstantiationService)),
|
|
354
|
+
( __param(2, IThemeService)),
|
|
355
|
+
( __param(3, IStorageService)),
|
|
356
|
+
( __param(4, IConfigurationService)),
|
|
357
|
+
( __param(5, ITextResourceConfigurationService)),
|
|
358
|
+
( __param(6, IEditorService)),
|
|
359
|
+
( __param(7, IEditorGroupsService))
|
|
360
|
+
], SideBySideEditor));
|
|
367
361
|
class SideBySideAwareEditorPaneSelection {
|
|
368
362
|
constructor(selection, side) {
|
|
369
363
|
this.selection = selection;
|
|
@@ -47,9 +47,7 @@ let TextDiffEditor = class TextDiffEditor extends AbstractTextEditor {
|
|
|
47
47
|
if (this.input) {
|
|
48
48
|
return this.input.getName();
|
|
49
49
|
}
|
|
50
|
-
return (
|
|
51
|
-
(localize('textDiffEditor', "Text Diff Editor"))
|
|
52
|
-
);
|
|
50
|
+
return ( localize('textDiffEditor', "Text Diff Editor"));
|
|
53
51
|
}
|
|
54
52
|
createEditorControl(parent, configuration) {
|
|
55
53
|
this.diffEditorControl = this._register(this.instantiationService.createInstance(DiffEditorWidget, parent, configuration, {}));
|
|
@@ -92,7 +90,7 @@ let TextDiffEditor = class TextDiffEditor extends AbstractTextEditor {
|
|
|
92
90
|
...this.getReadonlyConfiguration(resolvedDiffEditorModel.modifiedModel?.isReadonly()),
|
|
93
91
|
originalEditable: !resolvedDiffEditorModel.originalModel?.isReadonly()
|
|
94
92
|
});
|
|
95
|
-
this.inputLifecycleStopWatch = (
|
|
93
|
+
this.inputLifecycleStopWatch = ( new StopWatch(false));
|
|
96
94
|
}
|
|
97
95
|
catch (error) {
|
|
98
96
|
await this.handleSetInputError(error, input, options);
|
|
@@ -105,17 +103,17 @@ let TextDiffEditor = class TextDiffEditor extends AbstractTextEditor {
|
|
|
105
103
|
if (error.fileOperationResult === 7 && this.group) {
|
|
106
104
|
let message;
|
|
107
105
|
if (error instanceof TooLargeFileOperationError) {
|
|
108
|
-
message = (
|
|
106
|
+
message = ( localize(
|
|
109
107
|
'fileTooLargeForHeapErrorWithSize',
|
|
110
108
|
"At least one file is not displayed in the text compare editor because it is very large ({0}).",
|
|
111
109
|
ByteSize.formatSize(error.size)
|
|
112
|
-
))
|
|
110
|
+
));
|
|
113
111
|
}
|
|
114
112
|
else {
|
|
115
|
-
message = (
|
|
113
|
+
message = ( localize(
|
|
116
114
|
'fileTooLargeForHeapErrorWithoutSize',
|
|
117
115
|
"At least one file is not displayed in the text compare editor because it is very large."
|
|
118
|
-
))
|
|
116
|
+
));
|
|
119
117
|
}
|
|
120
118
|
throw createTooLargeFileError(this.group, input, options, message, this.preferencesService);
|
|
121
119
|
}
|
|
@@ -136,7 +134,7 @@ let TextDiffEditor = class TextDiffEditor extends AbstractTextEditor {
|
|
|
136
134
|
const original = input.original;
|
|
137
135
|
const modified = input.modified;
|
|
138
136
|
const binaryDiffInput = this.instantiationService.createInstance(DiffEditorInput, input.getName(), input.getDescription(), original, modified, true);
|
|
139
|
-
const fileEditorFactory = (
|
|
137
|
+
const fileEditorFactory = ( Registry.as(EditorExtensions.EditorFactory)).getFileEditorFactory();
|
|
140
138
|
if (fileEditorFactory.isFileEditor(original)) {
|
|
141
139
|
original.setForceOpenAsBinary();
|
|
142
140
|
}
|
|
@@ -202,9 +200,7 @@ let TextDiffEditor = class TextDiffEditor extends AbstractTextEditor {
|
|
|
202
200
|
isFileBinaryError(error) {
|
|
203
201
|
if (Array.isArray(error)) {
|
|
204
202
|
const errors = error;
|
|
205
|
-
return (
|
|
206
|
-
(errors.some(error => this.isFileBinaryError(error)))
|
|
207
|
-
);
|
|
203
|
+
return ( errors.some(error => this.isFileBinaryError(error)));
|
|
208
204
|
}
|
|
209
205
|
return error.textFileOperationResult === 0 ;
|
|
210
206
|
}
|
|
@@ -286,20 +282,18 @@ let TextDiffEditor = class TextDiffEditor extends AbstractTextEditor {
|
|
|
286
282
|
if (!original || !modified) {
|
|
287
283
|
return undefined;
|
|
288
284
|
}
|
|
289
|
-
return (
|
|
290
|
-
(URI.from({ scheme: 'diff', path: `${multibyteAwareBtoa(( ( original.toString())))}${multibyteAwareBtoa(( ( modified.toString())))}` }))
|
|
291
|
-
);
|
|
285
|
+
return ( URI.from({ scheme: 'diff', path: `${multibyteAwareBtoa(( original.toString()))}${multibyteAwareBtoa(( modified.toString()))}` }));
|
|
292
286
|
}
|
|
293
287
|
};
|
|
294
|
-
TextDiffEditor = TextDiffEditor_1 = (
|
|
295
|
-
(
|
|
296
|
-
(
|
|
297
|
-
(
|
|
298
|
-
(
|
|
299
|
-
(
|
|
300
|
-
(
|
|
301
|
-
(
|
|
302
|
-
(
|
|
303
|
-
(
|
|
304
|
-
], TextDiffEditor))
|
|
288
|
+
TextDiffEditor = TextDiffEditor_1 = ( __decorate([
|
|
289
|
+
( __param(0, ITelemetryService)),
|
|
290
|
+
( __param(1, IInstantiationService)),
|
|
291
|
+
( __param(2, IStorageService)),
|
|
292
|
+
( __param(3, ITextResourceConfigurationService)),
|
|
293
|
+
( __param(4, IEditorService)),
|
|
294
|
+
( __param(5, IThemeService)),
|
|
295
|
+
( __param(6, IEditorGroupsService)),
|
|
296
|
+
( __param(7, IFileService)),
|
|
297
|
+
( __param(8, IPreferencesService))
|
|
298
|
+
], TextDiffEditor));
|
|
305
299
|
export { TextDiffEditor };
|
|
@@ -35,7 +35,7 @@ let RenameOperation = RenameOperation_1 = class RenameOperation {
|
|
|
35
35
|
this._fileService = _fileService;
|
|
36
36
|
}
|
|
37
37
|
get uris() {
|
|
38
|
-
return (
|
|
38
|
+
return ( this._edits.map(edit => [edit.newUri, edit.oldUri])).flat();
|
|
39
39
|
}
|
|
40
40
|
async perform(token) {
|
|
41
41
|
const moves = [];
|
|
@@ -47,32 +47,28 @@ let RenameOperation = RenameOperation_1 = class RenameOperation {
|
|
|
47
47
|
file: { source: edit.oldUri, target: edit.newUri },
|
|
48
48
|
overwrite: edit.options.overwrite
|
|
49
49
|
});
|
|
50
|
-
undoes.push((
|
|
50
|
+
undoes.push(( new RenameEdit(edit.oldUri, edit.newUri, edit.options)));
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
if (moves.length === 0) {
|
|
54
|
-
return (
|
|
55
|
-
(new Noop())
|
|
56
|
-
);
|
|
54
|
+
return ( new Noop());
|
|
57
55
|
}
|
|
58
56
|
await this._workingCopyFileService.move(moves, token, this._undoRedoInfo);
|
|
59
|
-
return (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
))
|
|
66
|
-
);
|
|
57
|
+
return ( new RenameOperation_1(
|
|
58
|
+
undoes,
|
|
59
|
+
{ isUndoing: true },
|
|
60
|
+
this._workingCopyFileService,
|
|
61
|
+
this._fileService
|
|
62
|
+
));
|
|
67
63
|
}
|
|
68
64
|
toString() {
|
|
69
|
-
return `(rename ${(
|
|
65
|
+
return `(rename ${( this._edits.map(edit => `${edit.oldUri} to ${edit.newUri}`)).join(', ')})`;
|
|
70
66
|
}
|
|
71
67
|
};
|
|
72
|
-
RenameOperation = RenameOperation_1 = (
|
|
73
|
-
(
|
|
74
|
-
(
|
|
75
|
-
], RenameOperation))
|
|
68
|
+
RenameOperation = RenameOperation_1 = ( __decorate([
|
|
69
|
+
( __param(2, IWorkingCopyFileService)),
|
|
70
|
+
( __param(3, IFileService))
|
|
71
|
+
], RenameOperation));
|
|
76
72
|
class CopyEdit {
|
|
77
73
|
constructor(newUri, oldUri, options) {
|
|
78
74
|
this.newUri = newUri;
|
|
@@ -90,7 +86,7 @@ let CopyOperation = class CopyOperation {
|
|
|
90
86
|
this._instaService = _instaService;
|
|
91
87
|
}
|
|
92
88
|
get uris() {
|
|
93
|
-
return (
|
|
89
|
+
return ( this._edits.map(edit => [edit.newUri, edit.oldUri])).flat();
|
|
94
90
|
}
|
|
95
91
|
async perform(token) {
|
|
96
92
|
const copies = [];
|
|
@@ -101,32 +97,30 @@ let CopyOperation = class CopyOperation {
|
|
|
101
97
|
}
|
|
102
98
|
}
|
|
103
99
|
if (copies.length === 0) {
|
|
104
|
-
return (
|
|
105
|
-
(new Noop())
|
|
106
|
-
);
|
|
100
|
+
return ( new Noop());
|
|
107
101
|
}
|
|
108
102
|
const stats = await this._workingCopyFileService.copy(copies, token, this._undoRedoInfo);
|
|
109
103
|
const undoes = [];
|
|
110
104
|
for (let i = 0; i < stats.length; i++) {
|
|
111
105
|
const stat = stats[i];
|
|
112
106
|
const edit = this._edits[i];
|
|
113
|
-
undoes.push((
|
|
107
|
+
undoes.push(( new DeleteEdit(
|
|
114
108
|
stat.resource,
|
|
115
109
|
{ recursive: true, folder: this._edits[i].options.folder || stat.isDirectory, ...edit.options },
|
|
116
110
|
false
|
|
117
|
-
)))
|
|
111
|
+
)));
|
|
118
112
|
}
|
|
119
113
|
return this._instaService.createInstance(DeleteOperation, undoes, { isUndoing: true });
|
|
120
114
|
}
|
|
121
115
|
toString() {
|
|
122
|
-
return `(copy ${(
|
|
116
|
+
return `(copy ${( this._edits.map(edit => `${edit.oldUri} to ${edit.newUri}`)).join(', ')})`;
|
|
123
117
|
}
|
|
124
118
|
};
|
|
125
|
-
CopyOperation = (
|
|
126
|
-
(
|
|
127
|
-
(
|
|
128
|
-
(
|
|
129
|
-
], CopyOperation))
|
|
119
|
+
CopyOperation = ( __decorate([
|
|
120
|
+
( __param(2, IWorkingCopyFileService)),
|
|
121
|
+
( __param(3, IFileService)),
|
|
122
|
+
( __param(4, IInstantiationService))
|
|
123
|
+
], CopyOperation));
|
|
130
124
|
class CreateEdit {
|
|
131
125
|
constructor(newUri, options, contents) {
|
|
132
126
|
this.newUri = newUri;
|
|
@@ -145,9 +139,7 @@ let CreateOperation = class CreateOperation {
|
|
|
145
139
|
this._textFileService = _textFileService;
|
|
146
140
|
}
|
|
147
141
|
get uris() {
|
|
148
|
-
return (
|
|
149
|
-
(this._edits.map(edit => edit.newUri))
|
|
150
|
-
);
|
|
142
|
+
return ( this._edits.map(edit => edit.newUri));
|
|
151
143
|
}
|
|
152
144
|
async perform(token) {
|
|
153
145
|
const folderCreates = [];
|
|
@@ -167,29 +159,27 @@ let CreateOperation = class CreateOperation {
|
|
|
167
159
|
const encodedReadable = typeof edit.contents !== 'undefined' ? edit.contents : await this._textFileService.getEncodedReadable(edit.newUri);
|
|
168
160
|
fileCreates.push({ resource: edit.newUri, contents: encodedReadable, overwrite: edit.options.overwrite });
|
|
169
161
|
}
|
|
170
|
-
undoes.push((
|
|
162
|
+
undoes.push(( new DeleteEdit(edit.newUri, edit.options, !edit.options.folder && !edit.contents)));
|
|
171
163
|
}
|
|
172
164
|
if (folderCreates.length === 0 && fileCreates.length === 0) {
|
|
173
|
-
return (
|
|
174
|
-
(new Noop())
|
|
175
|
-
);
|
|
165
|
+
return ( new Noop());
|
|
176
166
|
}
|
|
177
167
|
await this._workingCopyFileService.createFolder(folderCreates, token, this._undoRedoInfo);
|
|
178
168
|
await this._workingCopyFileService.create(fileCreates, token, this._undoRedoInfo);
|
|
179
169
|
return this._instaService.createInstance(DeleteOperation, undoes, { isUndoing: true });
|
|
180
170
|
}
|
|
181
171
|
toString() {
|
|
182
|
-
return `(create ${(
|
|
172
|
+
return `(create ${( this._edits.map(
|
|
183
173
|
edit => edit.options.folder ? `folder ${edit.newUri}` : `file ${edit.newUri} with ${edit.contents?.byteLength || 0} bytes`
|
|
184
|
-
))
|
|
174
|
+
)).join(', ')})`;
|
|
185
175
|
}
|
|
186
176
|
};
|
|
187
|
-
CreateOperation = (
|
|
188
|
-
(
|
|
189
|
-
(
|
|
190
|
-
(
|
|
191
|
-
(
|
|
192
|
-
], CreateOperation))
|
|
177
|
+
CreateOperation = ( __decorate([
|
|
178
|
+
( __param(2, IFileService)),
|
|
179
|
+
( __param(3, IWorkingCopyFileService)),
|
|
180
|
+
( __param(4, IInstantiationService)),
|
|
181
|
+
( __param(5, ITextFileService))
|
|
182
|
+
], CreateOperation));
|
|
193
183
|
class DeleteEdit {
|
|
194
184
|
constructor(oldUri, options, undoesCreate) {
|
|
195
185
|
this.oldUri = oldUri;
|
|
@@ -209,9 +199,7 @@ let DeleteOperation = class DeleteOperation {
|
|
|
209
199
|
this._logService = _logService;
|
|
210
200
|
}
|
|
211
201
|
get uris() {
|
|
212
|
-
return (
|
|
213
|
-
(this._edits.map(edit => edit.oldUri))
|
|
214
|
-
);
|
|
202
|
+
return ( this._edits.map(edit => edit.oldUri));
|
|
215
203
|
}
|
|
216
204
|
async perform(token) {
|
|
217
205
|
const deletes = [];
|
|
@@ -242,33 +230,29 @@ let DeleteOperation = class DeleteOperation {
|
|
|
242
230
|
}
|
|
243
231
|
}
|
|
244
232
|
if (fileContent !== undefined) {
|
|
245
|
-
undoes.push((
|
|
233
|
+
undoes.push(( new CreateEdit(edit.oldUri, edit.options, fileContent.value)));
|
|
246
234
|
}
|
|
247
235
|
}
|
|
248
236
|
if (deletes.length === 0) {
|
|
249
|
-
return (
|
|
250
|
-
(new Noop())
|
|
251
|
-
);
|
|
237
|
+
return ( new Noop());
|
|
252
238
|
}
|
|
253
239
|
await this._workingCopyFileService.delete(deletes, token, this._undoRedoInfo);
|
|
254
240
|
if (undoes.length === 0) {
|
|
255
|
-
return (
|
|
256
|
-
(new Noop())
|
|
257
|
-
);
|
|
241
|
+
return ( new Noop());
|
|
258
242
|
}
|
|
259
243
|
return this._instaService.createInstance(CreateOperation, undoes, { isUndoing: true });
|
|
260
244
|
}
|
|
261
245
|
toString() {
|
|
262
|
-
return `(delete ${(
|
|
246
|
+
return `(delete ${( this._edits.map(edit => edit.oldUri)).join(', ')})`;
|
|
263
247
|
}
|
|
264
248
|
};
|
|
265
|
-
DeleteOperation = (
|
|
266
|
-
(
|
|
267
|
-
(
|
|
268
|
-
(
|
|
269
|
-
(
|
|
270
|
-
(
|
|
271
|
-
], DeleteOperation))
|
|
249
|
+
DeleteOperation = ( __decorate([
|
|
250
|
+
( __param(2, IWorkingCopyFileService)),
|
|
251
|
+
( __param(3, IFileService)),
|
|
252
|
+
( __param(4, IConfigurationService)),
|
|
253
|
+
( __param(5, IInstantiationService)),
|
|
254
|
+
( __param(6, ILogService))
|
|
255
|
+
], DeleteOperation));
|
|
272
256
|
class FileUndoRedoElement {
|
|
273
257
|
constructor(label, code, operations, confirmBeforeUndo) {
|
|
274
258
|
this.label = label;
|
|
@@ -276,7 +260,7 @@ class FileUndoRedoElement {
|
|
|
276
260
|
this.operations = operations;
|
|
277
261
|
this.confirmBeforeUndo = confirmBeforeUndo;
|
|
278
262
|
this.type = 1 ;
|
|
279
|
-
this.resources = (
|
|
263
|
+
this.resources = ( operations.map(op => op.uris)).flat();
|
|
280
264
|
}
|
|
281
265
|
async undo() {
|
|
282
266
|
await this._reverse();
|
|
@@ -292,7 +276,7 @@ class FileUndoRedoElement {
|
|
|
292
276
|
}
|
|
293
277
|
}
|
|
294
278
|
toString() {
|
|
295
|
-
return (
|
|
279
|
+
return ( this.operations.map(op => String(op))).join(', ');
|
|
296
280
|
}
|
|
297
281
|
}
|
|
298
282
|
let BulkFileEdits = class BulkFileEdits {
|
|
@@ -314,16 +298,16 @@ let BulkFileEdits = class BulkFileEdits {
|
|
|
314
298
|
const edits = [];
|
|
315
299
|
for (const edit of this._edits) {
|
|
316
300
|
if (edit.newResource && edit.oldResource && !edit.options?.copy) {
|
|
317
|
-
edits.push((
|
|
301
|
+
edits.push(( new RenameEdit(edit.newResource, edit.oldResource, edit.options ?? {})));
|
|
318
302
|
}
|
|
319
303
|
else if (edit.newResource && edit.oldResource && edit.options?.copy) {
|
|
320
|
-
edits.push((
|
|
304
|
+
edits.push(( new CopyEdit(edit.newResource, edit.oldResource, edit.options ?? {})));
|
|
321
305
|
}
|
|
322
306
|
else if (!edit.newResource && edit.oldResource) {
|
|
323
|
-
edits.push((
|
|
307
|
+
edits.push(( new DeleteEdit(edit.oldResource, edit.options ?? {}, false)));
|
|
324
308
|
}
|
|
325
309
|
else if (edit.newResource && !edit.oldResource) {
|
|
326
|
-
edits.push((
|
|
310
|
+
edits.push(( new CreateEdit(edit.newResource, edit.options ?? {}, await edit.options.contents)));
|
|
327
311
|
}
|
|
328
312
|
}
|
|
329
313
|
if (edits.length === 0) {
|
|
@@ -366,13 +350,13 @@ let BulkFileEdits = class BulkFileEdits {
|
|
|
366
350
|
}
|
|
367
351
|
this._progress.report(undefined);
|
|
368
352
|
}
|
|
369
|
-
const undoRedoElement = (
|
|
353
|
+
const undoRedoElement = ( new FileUndoRedoElement(this._label, this._code, undoOperations, this._confirmBeforeUndo));
|
|
370
354
|
this._undoRedoService.pushElement(undoRedoElement, this._undoRedoGroup, this._undoRedoSource);
|
|
371
355
|
return undoRedoElement.resources;
|
|
372
356
|
}
|
|
373
357
|
};
|
|
374
|
-
BulkFileEdits = (
|
|
375
|
-
(
|
|
376
|
-
(
|
|
377
|
-
], BulkFileEdits))
|
|
358
|
+
BulkFileEdits = ( __decorate([
|
|
359
|
+
( __param(8, IInstantiationService)),
|
|
360
|
+
( __param(9, IUndoRedoService))
|
|
361
|
+
], BulkFileEdits));
|
|
378
362
|
export { BulkFileEdits };
|