@codingame/monaco-vscode-extensions-service-override 25.1.1 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +7 -0
- package/package.json +3 -3
- package/vscode/src/vs/base/common/console.js +24 -15
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.d.ts +4 -1
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +149 -84
- package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +20 -12
- package/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.js +38 -21
- package/vscode/src/vs/platform/remote/common/managedSocket.js +7 -10
- package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +5 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +5 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadAiSettingsSearch.js +4 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +200 -143
- package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +10 -14
- package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +41 -31
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.d.ts +9 -12
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +168 -115
- package/vscode/src/vs/workbench/api/browser/mainThreadChatCodeMapper.js +11 -13
- package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.d.ts +5 -5
- package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.js +42 -15
- package/vscode/src/vs/workbench/api/browser/mainThreadChatOutputRenderer.js +8 -7
- package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.d.ts +4 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.js +170 -99
- package/vscode/src/vs/workbench/api/browser/mainThreadChatStatus.js +2 -5
- package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +4 -9
- package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +13 -12
- package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +16 -19
- package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +127 -70
- package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +80 -26
- package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +5 -11
- package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +199 -97
- package/vscode/src/vs/workbench/api/browser/mainThreadDataChannels.js +1 -4
- package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +88 -73
- package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +5 -5
- package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +16 -12
- package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +10 -8
- package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +14 -6
- package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +52 -37
- package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +78 -58
- package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +5 -7
- package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +75 -63
- package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +99 -91
- package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +93 -55
- package/vscode/src/vs/workbench/api/browser/mainThreadEmbeddings.js +3 -7
- package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +85 -60
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +49 -45
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +114 -72
- package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +4 -7
- package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +1 -4
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.d.ts +2 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +381 -238
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.d.ts +7 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.js +90 -13
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +81 -58
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +9 -10
- package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +2 -7
- package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +6 -10
- package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +12 -10
- package/vscode/src/vs/workbench/api/browser/mainThreadMcp.d.ts +3 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadMcp.js +162 -97
- package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +32 -26
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +38 -32
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +48 -46
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +22 -18
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +5 -8
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +35 -21
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +31 -28
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +5 -7
- package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +47 -23
- package/vscode/src/vs/workbench/api/browser/mainThreadProfileContentHandlers.js +15 -12
- package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +17 -18
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +6 -7
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +83 -66
- package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +1 -5
- package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +250 -92
- package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +6 -8
- package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +37 -26
- package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +34 -21
- package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +3 -6
- package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +19 -14
- package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +41 -16
- package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +18 -17
- package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +145 -145
- package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +19 -11
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +176 -80
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalShellIntegration.js +52 -21
- package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +26 -24
- package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +1 -4
- package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +5 -8
- package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.d.ts +4 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +106 -46
- package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +83 -65
- package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +20 -20
- package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +14 -9
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +17 -9
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +49 -38
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +10 -13
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +38 -27
- package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +5 -11
- package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.d.ts +4 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +73 -43
- package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +2 -2
- package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +17 -10
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +17 -11
- package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionBisect.js +107 -80
- package/vscode/src/vs/workbench/services/extensionManagement/browser/webExtensionsScannerService.js +336 -175
- package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +126 -71
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +76 -54
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +1 -2
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.d.ts +2 -0
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +343 -192
- package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +5 -3
- package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.d.ts +0 -1
- package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +75 -68
- package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +135 -36
- package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +22 -18
- package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +14 -12
- package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +21 -9
- package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +48 -25
- package/vscode/src/vs/workbench/services/themes/browser/cssExtensionPoint.d.ts +24 -0
- package/vscode/src/vs/workbench/services/themes/browser/cssExtensionPoint.js +300 -0
|
@@ -15,22 +15,16 @@ let MainThreadConsole = class MainThreadConsole {
|
|
|
15
15
|
const devOpts = parseExtensionDevOptions(this._environmentService);
|
|
16
16
|
this._isExtensionDevTestFromCli = devOpts.isExtensionDevTestFromCli;
|
|
17
17
|
}
|
|
18
|
-
dispose() {
|
|
19
|
-
}
|
|
18
|
+
dispose() {}
|
|
20
19
|
$logExtensionHostMessage(entry) {
|
|
21
20
|
if (this._isExtensionDevTestFromCli) {
|
|
22
21
|
logRemoteEntry(this._logService, entry);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
log(entry, 'Extension Host');
|
|
22
|
+
} else {
|
|
23
|
+
logRemoteEntryIfError(this._logService, entry, "Extension Host");
|
|
24
|
+
log(entry, "Extension Host");
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
27
|
};
|
|
30
|
-
MainThreadConsole = __decorate([
|
|
31
|
-
extHostNamedCustomer(MainContext.MainThreadConsole),
|
|
32
|
-
( __param(1, IEnvironmentService)),
|
|
33
|
-
( __param(2, ILogService))
|
|
34
|
-
], MainThreadConsole);
|
|
28
|
+
MainThreadConsole = __decorate([extHostNamedCustomer(MainContext.MainThreadConsole), ( __param(1, IEnvironmentService)), ( __param(2, ILogService))], MainThreadConsole);
|
|
35
29
|
|
|
36
30
|
export { MainThreadConsole };
|
|
@@ -41,12 +41,26 @@ import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/plat
|
|
|
41
41
|
|
|
42
42
|
var MainThreadCustomEditorModel_1;
|
|
43
43
|
var CustomEditorModelType;
|
|
44
|
-
(function
|
|
44
|
+
(function(CustomEditorModelType) {
|
|
45
45
|
CustomEditorModelType[CustomEditorModelType["Custom"] = 0] = "Custom";
|
|
46
46
|
CustomEditorModelType[CustomEditorModelType["Text"] = 1] = "Text";
|
|
47
47
|
})(CustomEditorModelType || (CustomEditorModelType = {}));
|
|
48
48
|
let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
49
|
-
constructor(
|
|
49
|
+
constructor(
|
|
50
|
+
context,
|
|
51
|
+
mainThreadWebview,
|
|
52
|
+
mainThreadWebviewPanels,
|
|
53
|
+
extensionService,
|
|
54
|
+
storageService,
|
|
55
|
+
workingCopyService,
|
|
56
|
+
workingCopyFileService,
|
|
57
|
+
_customEditorService,
|
|
58
|
+
_editorGroupService,
|
|
59
|
+
_editorService,
|
|
60
|
+
_instantiationService,
|
|
61
|
+
_webviewWorkbenchService,
|
|
62
|
+
_uriIdentityService
|
|
63
|
+
) {
|
|
50
64
|
super();
|
|
51
65
|
this.mainThreadWebview = mainThreadWebview;
|
|
52
66
|
this.mainThreadWebviewPanels = mainThreadWebviewPanels;
|
|
@@ -58,9 +72,9 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
58
72
|
this._uriIdentityService = _uriIdentityService;
|
|
59
73
|
this._editorProviders = this._register(( new DisposableMap()));
|
|
60
74
|
this._editorRenameBackups = ( new Map());
|
|
61
|
-
this._webviewOriginStore = ( new ExtensionKeyedWebviewOriginStore(
|
|
75
|
+
this._webviewOriginStore = ( new ExtensionKeyedWebviewOriginStore("mainThreadCustomEditors.origins", storageService));
|
|
62
76
|
this._proxyCustomEditors = ( context.getProxy(ExtHostContext.ExtHostCustomEditors));
|
|
63
|
-
this._register(workingCopyFileService.registerWorkingCopyProvider(
|
|
77
|
+
this._register(workingCopyFileService.registerWorkingCopyProvider(editorResource => {
|
|
64
78
|
const matchedWorkingCopies = [];
|
|
65
79
|
for (const workingCopy of workingCopyService.workingCopies) {
|
|
66
80
|
if (workingCopy instanceof MainThreadCustomEditorModel) {
|
|
@@ -72,23 +86,63 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
72
86
|
return matchedWorkingCopies;
|
|
73
87
|
}));
|
|
74
88
|
this._register(_webviewWorkbenchService.registerResolver({
|
|
75
|
-
canResolve:
|
|
89
|
+
canResolve: webview => {
|
|
76
90
|
if (webview instanceof CustomEditorInput) {
|
|
77
91
|
extensionService.activateByEvent(`onCustomEditor:${webview.viewType}`);
|
|
78
92
|
}
|
|
79
93
|
return false;
|
|
80
94
|
},
|
|
81
|
-
resolveWebview: () => {
|
|
95
|
+
resolveWebview: () => {
|
|
96
|
+
throw ( new Error("not implemented"));
|
|
97
|
+
}
|
|
82
98
|
}));
|
|
83
|
-
this._register(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
99
|
+
this._register(
|
|
100
|
+
workingCopyFileService.onWillRunWorkingCopyFileOperation(async e => this.onWillRunWorkingCopyFileOperation(e))
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
$registerTextEditorProvider(
|
|
104
|
+
extensionData,
|
|
105
|
+
viewType,
|
|
106
|
+
options,
|
|
107
|
+
capabilities,
|
|
108
|
+
serializeBuffersForPostMessage
|
|
109
|
+
) {
|
|
110
|
+
this.registerEditorProvider(
|
|
111
|
+
CustomEditorModelType.Text,
|
|
112
|
+
reviveWebviewExtension(extensionData),
|
|
113
|
+
viewType,
|
|
114
|
+
options,
|
|
115
|
+
capabilities,
|
|
116
|
+
true,
|
|
117
|
+
serializeBuffersForPostMessage
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
$registerCustomEditorProvider(
|
|
121
|
+
extensionData,
|
|
122
|
+
viewType,
|
|
123
|
+
options,
|
|
124
|
+
supportsMultipleEditorsPerDocument,
|
|
125
|
+
serializeBuffersForPostMessage
|
|
126
|
+
) {
|
|
127
|
+
this.registerEditorProvider(
|
|
128
|
+
CustomEditorModelType.Custom,
|
|
129
|
+
reviveWebviewExtension(extensionData),
|
|
130
|
+
viewType,
|
|
131
|
+
options,
|
|
132
|
+
{},
|
|
133
|
+
supportsMultipleEditorsPerDocument,
|
|
134
|
+
serializeBuffersForPostMessage
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
registerEditorProvider(
|
|
138
|
+
modelType,
|
|
139
|
+
extension,
|
|
140
|
+
viewType,
|
|
141
|
+
options,
|
|
142
|
+
capabilities,
|
|
143
|
+
supportsMultipleEditorsPerDocument,
|
|
144
|
+
serializeBuffersForPostMessage
|
|
145
|
+
) {
|
|
92
146
|
if (( this._editorProviders.has(viewType))) {
|
|
93
147
|
throw ( new Error(`Provider for ${viewType} already registered`));
|
|
94
148
|
}
|
|
@@ -97,14 +151,16 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
97
151
|
supportsMultipleEditorsPerDocument
|
|
98
152
|
}));
|
|
99
153
|
disposables.add(this._webviewWorkbenchService.registerResolver({
|
|
100
|
-
canResolve:
|
|
154
|
+
canResolve: webviewInput => {
|
|
101
155
|
return webviewInput instanceof CustomEditorInput && webviewInput.viewType === viewType;
|
|
102
156
|
},
|
|
103
157
|
resolveWebview: async (webviewInput, cancellation) => {
|
|
104
158
|
const handle = generateUuid();
|
|
105
159
|
const resource = webviewInput.resource;
|
|
106
160
|
webviewInput.webview.origin = this._webviewOriginStore.getOrigin(viewType, extension.id);
|
|
107
|
-
this.mainThreadWebviewPanels.addWebviewInput(handle, webviewInput, {
|
|
161
|
+
this.mainThreadWebviewPanels.addWebviewInput(handle, webviewInput, {
|
|
162
|
+
serializeBuffersForPostMessage
|
|
163
|
+
});
|
|
108
164
|
webviewInput.webview.options = options;
|
|
109
165
|
webviewInput.webview.extension = extension;
|
|
110
166
|
let backupId = webviewInput.backupId;
|
|
@@ -115,9 +171,10 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
115
171
|
}
|
|
116
172
|
let modelRef;
|
|
117
173
|
try {
|
|
118
|
-
modelRef = await this.getOrCreateCustomEditorModel(modelType, resource, viewType, {
|
|
119
|
-
|
|
120
|
-
|
|
174
|
+
modelRef = await this.getOrCreateCustomEditorModel(modelType, resource, viewType, {
|
|
175
|
+
backupId
|
|
176
|
+
}, cancellation);
|
|
177
|
+
} catch (error) {
|
|
121
178
|
onUnexpectedError(error);
|
|
122
179
|
webviewInput.webview.setHtml(this.mainThreadWebview.getWebviewResolvedFailedContent(viewType));
|
|
123
180
|
return;
|
|
@@ -128,6 +185,7 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
128
185
|
}
|
|
129
186
|
const disposeSub = webviewInput.webview.onDidDispose(() => {
|
|
130
187
|
disposeSub.dispose();
|
|
188
|
+
inputDisposeSub.dispose();
|
|
131
189
|
if (modelRef.object.isDirty()) {
|
|
132
190
|
const sub = modelRef.object.onDidChangeDirty(() => {
|
|
133
191
|
if (!modelRef.object.isDirty()) {
|
|
@@ -139,8 +197,13 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
139
197
|
}
|
|
140
198
|
modelRef.dispose();
|
|
141
199
|
});
|
|
200
|
+
const inputDisposeSub = webviewInput.onWillDispose(() => {
|
|
201
|
+
inputDisposeSub.dispose();
|
|
202
|
+
disposeSub.dispose();
|
|
203
|
+
modelRef.dispose();
|
|
204
|
+
});
|
|
142
205
|
if (capabilities.supportsMove) {
|
|
143
|
-
webviewInput.onMove(async
|
|
206
|
+
webviewInput.onMove(async newResource => {
|
|
144
207
|
const oldModel = modelRef;
|
|
145
208
|
modelRef = await this.getOrCreateCustomEditorModel(modelType, newResource, viewType, {}, CancellationToken.None);
|
|
146
209
|
this._proxyCustomEditors.$onMoveCustomEditor(handle, newResource, viewType);
|
|
@@ -153,10 +216,9 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
153
216
|
title: webviewInput.getTitle(),
|
|
154
217
|
contentOptions: webviewInput.webview.contentOptions,
|
|
155
218
|
options: webviewInput.webview.options,
|
|
156
|
-
active: webviewInput === this._editorService.activeEditor
|
|
219
|
+
active: webviewInput === this._editorService.activeEditor
|
|
157
220
|
}, editorGroupToColumn(this._editorGroupService, webviewInput.group || 0), cancellation);
|
|
158
|
-
}
|
|
159
|
-
catch (error) {
|
|
221
|
+
} catch (error) {
|
|
160
222
|
onUnexpectedError(error);
|
|
161
223
|
webviewInput.webview.setHtml(this.mainThreadWebview.getWebviewResolvedFailedContent(viewType));
|
|
162
224
|
modelRef.dispose();
|
|
@@ -179,19 +241,28 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
179
241
|
return existingModel;
|
|
180
242
|
}
|
|
181
243
|
switch (modelType) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
244
|
+
case CustomEditorModelType.Text:
|
|
245
|
+
{
|
|
246
|
+
const model = CustomTextEditorModel.create(this._instantiationService, viewType, resource);
|
|
247
|
+
return this._customEditorService.models.add(resource, viewType, model);
|
|
248
|
+
}
|
|
249
|
+
case CustomEditorModelType.Custom:
|
|
250
|
+
{
|
|
251
|
+
const model = MainThreadCustomEditorModel.create(
|
|
252
|
+
this._instantiationService,
|
|
253
|
+
this._proxyCustomEditors,
|
|
254
|
+
viewType,
|
|
255
|
+
resource,
|
|
256
|
+
options,
|
|
257
|
+
() => {
|
|
258
|
+
return Array.from(this.mainThreadWebviewPanels.webviewInputs).filter(
|
|
259
|
+
editor => editor instanceof CustomEditorInput && isEqual(editor.resource, resource)
|
|
260
|
+
);
|
|
261
|
+
},
|
|
262
|
+
cancellation
|
|
263
|
+
);
|
|
264
|
+
return this._customEditorService.models.add(resource, viewType, model);
|
|
265
|
+
}
|
|
195
266
|
}
|
|
196
267
|
}
|
|
197
268
|
async $onDidEdit(resourceComponents, viewType, editId, label) {
|
|
@@ -206,7 +277,7 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
206
277
|
const resource = URI.revive(resourceComponents);
|
|
207
278
|
const model = await this._customEditorService.models.get(resource, viewType);
|
|
208
279
|
if (!model || !(model instanceof MainThreadCustomEditorModel)) {
|
|
209
|
-
throw ( new Error(
|
|
280
|
+
throw ( new Error("Could not find model for webview editor"));
|
|
210
281
|
}
|
|
211
282
|
return model;
|
|
212
283
|
}
|
|
@@ -232,28 +303,21 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
232
303
|
})());
|
|
233
304
|
}
|
|
234
305
|
};
|
|
235
|
-
MainThreadCustomEditors = ( __decorate([
|
|
236
|
-
( __param(3, IExtensionService)),
|
|
237
|
-
( __param(4, IStorageService)),
|
|
238
|
-
( __param(5, IWorkingCopyService)),
|
|
239
|
-
( __param(6, IWorkingCopyFileService)),
|
|
240
|
-
( __param(7, ICustomEditorService)),
|
|
241
|
-
( __param(8, IEditorGroupsService)),
|
|
242
|
-
( __param(9, IEditorService)),
|
|
243
|
-
( __param(10, IInstantiationService)),
|
|
244
|
-
( __param(11, IWebviewWorkbenchService)),
|
|
245
|
-
( __param(12, IUriIdentityService))
|
|
246
|
-
], MainThreadCustomEditors));
|
|
306
|
+
MainThreadCustomEditors = ( __decorate([( __param(3, IExtensionService)), ( __param(4, IStorageService)), ( __param(5, IWorkingCopyService)), ( __param(6, IWorkingCopyFileService)), ( __param(7, ICustomEditorService)), ( __param(8, IEditorGroupsService)), ( __param(9, IEditorService)), ( __param(10, IInstantiationService)), ( __param(11, IWebviewWorkbenchService)), ( __param(12, IUriIdentityService))], MainThreadCustomEditors));
|
|
247
307
|
var HotExitState;
|
|
248
|
-
(function
|
|
308
|
+
(function(HotExitState) {
|
|
249
309
|
let Type;
|
|
250
|
-
(function
|
|
310
|
+
(function(Type) {
|
|
251
311
|
Type[Type["Allowed"] = 0] = "Allowed";
|
|
252
312
|
Type[Type["NotAllowed"] = 1] = "NotAllowed";
|
|
253
313
|
Type[Type["Pending"] = 2] = "Pending";
|
|
254
314
|
})(Type = HotExitState.Type || (HotExitState.Type = {}));
|
|
255
|
-
HotExitState.Allowed = ( Object.freeze({
|
|
256
|
-
|
|
315
|
+
HotExitState.Allowed = ( Object.freeze({
|
|
316
|
+
type: Type.Allowed
|
|
317
|
+
}));
|
|
318
|
+
HotExitState.NotAllowed = ( Object.freeze({
|
|
319
|
+
type: Type.NotAllowed
|
|
320
|
+
}));
|
|
257
321
|
class Pending {
|
|
258
322
|
constructor(operation) {
|
|
259
323
|
this.operation = operation;
|
|
@@ -263,17 +327,55 @@ var HotExitState;
|
|
|
263
327
|
HotExitState.Pending = Pending;
|
|
264
328
|
})(HotExitState || (HotExitState = {}));
|
|
265
329
|
let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThreadCustomEditorModel extends ResourceWorkingCopy {
|
|
266
|
-
static async create(
|
|
330
|
+
static async create(
|
|
331
|
+
instantiationService,
|
|
332
|
+
proxy,
|
|
333
|
+
viewType,
|
|
334
|
+
resource,
|
|
335
|
+
options,
|
|
336
|
+
getEditors,
|
|
337
|
+
cancellation
|
|
338
|
+
) {
|
|
267
339
|
const editors = getEditors();
|
|
268
340
|
let untitledDocumentData;
|
|
269
341
|
if (editors.length !== 0) {
|
|
270
342
|
untitledDocumentData = editors[0].untitledDocumentData;
|
|
271
343
|
}
|
|
272
|
-
const {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
344
|
+
const {
|
|
345
|
+
editable
|
|
346
|
+
} = await proxy.$createCustomDocument(resource, viewType, options.backupId, untitledDocumentData, cancellation);
|
|
347
|
+
return instantiationService.createInstance(
|
|
348
|
+
MainThreadCustomEditorModel_1,
|
|
349
|
+
proxy,
|
|
350
|
+
viewType,
|
|
351
|
+
resource,
|
|
352
|
+
!!options.backupId,
|
|
353
|
+
editable,
|
|
354
|
+
!!untitledDocumentData,
|
|
355
|
+
getEditors
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
constructor(
|
|
359
|
+
_proxy,
|
|
360
|
+
_viewType,
|
|
361
|
+
_editorResource,
|
|
362
|
+
fromBackup,
|
|
363
|
+
_editable,
|
|
364
|
+
startDirty,
|
|
365
|
+
_getEditors,
|
|
366
|
+
_fileDialogService,
|
|
367
|
+
fileService,
|
|
368
|
+
_labelService,
|
|
369
|
+
_undoService,
|
|
370
|
+
_environmentService,
|
|
371
|
+
workingCopyService,
|
|
372
|
+
_pathService,
|
|
373
|
+
extensionService
|
|
374
|
+
) {
|
|
375
|
+
super(
|
|
376
|
+
MainThreadCustomEditorModel_1.toWorkingCopyResource(_viewType, _editorResource),
|
|
377
|
+
fileService
|
|
378
|
+
);
|
|
277
379
|
this._proxy = _proxy;
|
|
278
380
|
this._viewType = _viewType;
|
|
279
381
|
this._editorResource = _editorResource;
|
|
@@ -303,7 +405,7 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
303
405
|
this._register(workingCopyService.registerWorkingCopy(this));
|
|
304
406
|
this._register(extensionService.onWillStop(e => {
|
|
305
407
|
e.veto(true, ( localize(
|
|
306
|
-
|
|
408
|
+
2504,
|
|
307
409
|
"An extension provided editor for '{0}' is still open that would close otherwise.",
|
|
308
410
|
this.name
|
|
309
411
|
)));
|
|
@@ -321,13 +423,16 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
321
423
|
super.dispose();
|
|
322
424
|
}
|
|
323
425
|
static toWorkingCopyResource(viewType, resource) {
|
|
324
|
-
const authority = viewType.replace(/[^a-z0-9\-_]/gi,
|
|
325
|
-
const path = `/${multibyteAwareBtoa(( resource.with({
|
|
426
|
+
const authority = viewType.replace(/[^a-z0-9\-_]/gi, "-");
|
|
427
|
+
const path = `/${multibyteAwareBtoa(( resource.with({
|
|
428
|
+
query: null,
|
|
429
|
+
fragment: null
|
|
430
|
+
}).toString(true)))}`;
|
|
326
431
|
return ( URI.from({
|
|
327
432
|
scheme: Schemas.vscodeCustomEditor,
|
|
328
433
|
authority: authority,
|
|
329
434
|
path: path,
|
|
330
|
-
query: JSON.stringify(resource.toJSON())
|
|
435
|
+
query: JSON.stringify(resource.toJSON())
|
|
331
436
|
}));
|
|
332
437
|
}
|
|
333
438
|
get name() {
|
|
@@ -359,7 +464,7 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
359
464
|
}
|
|
360
465
|
pushEdit(editId, label) {
|
|
361
466
|
if (!this._editable) {
|
|
362
|
-
throw ( new Error(
|
|
467
|
+
throw ( new Error("Document is not editable"));
|
|
363
468
|
}
|
|
364
469
|
this.change(() => {
|
|
365
470
|
this.spliceEdits(editId);
|
|
@@ -368,10 +473,10 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
368
473
|
this._undoService.pushElement({
|
|
369
474
|
type: UndoRedoElementType.Resource,
|
|
370
475
|
resource: this._editorResource,
|
|
371
|
-
label: label ?? ( localize(
|
|
372
|
-
code:
|
|
476
|
+
label: label ?? ( localize(2505, "Edit")),
|
|
477
|
+
code: "undoredo.customEditorEdit",
|
|
373
478
|
undo: () => this.undo(),
|
|
374
|
-
redo: () => this.redo()
|
|
479
|
+
redo: () => this.redo()
|
|
375
480
|
});
|
|
376
481
|
}
|
|
377
482
|
changeContent() {
|
|
@@ -408,9 +513,7 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
408
513
|
spliceEdits(editToInsert) {
|
|
409
514
|
const start = this._currentEditIndex + 1;
|
|
410
515
|
const toRemove = this._edits.length - this._currentEditIndex;
|
|
411
|
-
const removedEdits = typeof editToInsert ===
|
|
412
|
-
? this._edits.splice(start, toRemove, editToInsert)
|
|
413
|
-
: this._edits.splice(start, toRemove);
|
|
516
|
+
const removedEdits = typeof editToInsert === "number" ? this._edits.splice(start, toRemove, editToInsert) : this._edits.splice(start, toRemove);
|
|
414
517
|
if (removedEdits.length) {
|
|
415
518
|
this._proxy.$disposeEdits(this._editorResource, this._viewType, removedEdits);
|
|
416
519
|
}
|
|
@@ -443,7 +546,10 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
443
546
|
async save(options) {
|
|
444
547
|
const result = !!(await this.saveCustomEditor(options));
|
|
445
548
|
if (result) {
|
|
446
|
-
this._onDidSave.fire({
|
|
549
|
+
this._onDidSave.fire({
|
|
550
|
+
reason: options?.reason,
|
|
551
|
+
source: options?.source
|
|
552
|
+
});
|
|
447
553
|
}
|
|
448
554
|
return result;
|
|
449
555
|
}
|
|
@@ -471,8 +577,7 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
471
577
|
this._fromBackup = false;
|
|
472
578
|
});
|
|
473
579
|
}
|
|
474
|
-
}
|
|
475
|
-
finally {
|
|
580
|
+
} finally {
|
|
476
581
|
if (this._ongoingSave === savePromise) {
|
|
477
582
|
this._ongoingSave = undefined;
|
|
478
583
|
}
|
|
@@ -481,7 +586,7 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
481
586
|
}
|
|
482
587
|
suggestUntitledSavePath(options) {
|
|
483
588
|
if (!this.isUntitled()) {
|
|
484
|
-
throw ( new Error(
|
|
589
|
+
throw ( new Error("Resource is not untitled"));
|
|
485
590
|
}
|
|
486
591
|
const remoteAuthority = this._environmentService.remoteAuthority;
|
|
487
592
|
const localResource = toLocalResource(this._editorResource, remoteAuthority, this._pathService.defaultUriScheme);
|
|
@@ -489,22 +594,27 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
489
594
|
}
|
|
490
595
|
async saveCustomEditorAs(resource, targetResource, _options) {
|
|
491
596
|
if (this._editable) {
|
|
492
|
-
await createCancelablePromise(
|
|
597
|
+
await createCancelablePromise(
|
|
598
|
+
token => this._proxy.$onSaveAs(this._editorResource, this.viewType, targetResource, token)
|
|
599
|
+
);
|
|
493
600
|
this.change(() => {
|
|
601
|
+
this._isDirtyFromContentChange = false;
|
|
494
602
|
this._savePoint = this._currentEditIndex;
|
|
603
|
+
this._fromBackup = false;
|
|
495
604
|
});
|
|
496
605
|
return true;
|
|
497
|
-
}
|
|
498
|
-
else {
|
|
606
|
+
} else {
|
|
499
607
|
await this.fileService.copy(resource, targetResource, false );
|
|
500
608
|
return true;
|
|
501
609
|
}
|
|
502
610
|
}
|
|
503
|
-
get canHotExit() {
|
|
611
|
+
get canHotExit() {
|
|
612
|
+
return typeof this._backupId === "string" && this._hotExitState.type === HotExitState.Type.Allowed;
|
|
613
|
+
}
|
|
504
614
|
async backup(token) {
|
|
505
615
|
const editors = this._getEditors();
|
|
506
616
|
if (!editors.length) {
|
|
507
|
-
throw ( new Error(
|
|
617
|
+
throw ( new Error("No editors found for resource, cannot back up"));
|
|
508
618
|
}
|
|
509
619
|
const primaryEditor = editors[0];
|
|
510
620
|
const backupMeta = {
|
|
@@ -512,15 +622,15 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
512
622
|
editorResource: this._editorResource,
|
|
513
623
|
customTitle: primaryEditor.getWebviewTitle(),
|
|
514
624
|
iconPath: primaryEditor.iconPath,
|
|
515
|
-
backupId:
|
|
625
|
+
backupId: "",
|
|
516
626
|
extension: primaryEditor.extension ? {
|
|
517
627
|
id: primaryEditor.extension.id.value,
|
|
518
|
-
location: primaryEditor.extension.location
|
|
628
|
+
location: primaryEditor.extension.location
|
|
519
629
|
} : undefined,
|
|
520
630
|
webview: {
|
|
521
631
|
origin: primaryEditor.webview.origin,
|
|
522
632
|
options: primaryEditor.webview.options,
|
|
523
|
-
state: primaryEditor.webview.state
|
|
633
|
+
state: primaryEditor.webview.state
|
|
524
634
|
}
|
|
525
635
|
};
|
|
526
636
|
const backupData = {
|
|
@@ -532,12 +642,14 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
532
642
|
if (this._hotExitState.type === HotExitState.Type.Pending) {
|
|
533
643
|
this._hotExitState.operation.cancel();
|
|
534
644
|
}
|
|
535
|
-
const pendingState = new HotExitState.Pending(createCancelablePromise(
|
|
645
|
+
const pendingState = new HotExitState.Pending(createCancelablePromise(
|
|
646
|
+
token => this._proxy.$backup(this._editorResource.toJSON(), this.viewType, token)
|
|
647
|
+
));
|
|
536
648
|
this._hotExitState = pendingState;
|
|
537
649
|
token.onCancellationRequested(() => {
|
|
538
650
|
pendingState.operation.cancel();
|
|
539
651
|
});
|
|
540
|
-
let errorMessage =
|
|
652
|
+
let errorMessage = "";
|
|
541
653
|
try {
|
|
542
654
|
const backupId = await pendingState.operation;
|
|
543
655
|
if (this._hotExitState === pendingState) {
|
|
@@ -545,8 +657,7 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
545
657
|
backupData.meta.backupId = backupId;
|
|
546
658
|
this._backupId = backupId;
|
|
547
659
|
}
|
|
548
|
-
}
|
|
549
|
-
catch (e) {
|
|
660
|
+
} catch (e) {
|
|
550
661
|
if (isCancellationError(e)) {
|
|
551
662
|
throw e;
|
|
552
663
|
}
|
|
@@ -563,15 +674,6 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
563
674
|
throw ( new Error(`Cannot backup in this state: ${errorMessage}`));
|
|
564
675
|
}
|
|
565
676
|
};
|
|
566
|
-
MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = ( __decorate([
|
|
567
|
-
( __param(7, IFileDialogService)),
|
|
568
|
-
( __param(8, IFileService)),
|
|
569
|
-
( __param(9, ILabelService)),
|
|
570
|
-
( __param(10, IUndoRedoService)),
|
|
571
|
-
( __param(11, IWorkbenchEnvironmentService)),
|
|
572
|
-
( __param(12, IWorkingCopyService)),
|
|
573
|
-
( __param(13, IPathService)),
|
|
574
|
-
( __param(14, IExtensionService))
|
|
575
|
-
], MainThreadCustomEditorModel));
|
|
677
|
+
MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = ( __decorate([( __param(7, IFileDialogService)), ( __param(8, IFileService)), ( __param(9, ILabelService)), ( __param(10, IUndoRedoService)), ( __param(11, IWorkbenchEnvironmentService)), ( __param(12, IWorkingCopyService)), ( __param(13, IPathService)), ( __param(14, IExtensionService))], MainThreadCustomEditorModel));
|
|
576
678
|
|
|
577
679
|
export { MainThreadCustomEditors };
|
|
@@ -15,9 +15,6 @@ let MainThreadDataChannels = class MainThreadDataChannels extends Disposable {
|
|
|
15
15
|
}));
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
MainThreadDataChannels = __decorate([
|
|
19
|
-
extHostNamedCustomer(MainContext.MainThreadDataChannels),
|
|
20
|
-
( __param(1, IDataChannelService))
|
|
21
|
-
], MainThreadDataChannels);
|
|
18
|
+
MainThreadDataChannels = __decorate([extHostNamedCustomer(MainContext.MainThreadDataChannels), ( __param(1, IDataChannelService))], MainThreadDataChannels);
|
|
22
19
|
|
|
23
20
|
export { MainThreadDataChannels };
|