@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
package/package.json
CHANGED
|
@@ -26,7 +26,7 @@ function replaceNLStrings(logger, extensionManifest, messages, originalMessages)
|
|
|
26
26
|
const originalMessage = typeof original === 'string' ? original : original?.message;
|
|
27
27
|
if (!message) {
|
|
28
28
|
if (!originalMessage) {
|
|
29
|
-
logger.warn(`[${extensionManifest.name}]: ${(
|
|
29
|
+
logger.warn(`[${extensionManifest.name}]: ${( localize('missingNLSKey', "Couldn't find message for key {0}.", messageKey))}`);
|
|
30
30
|
}
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
@@ -10,7 +10,7 @@ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
|
10
10
|
import { createDecorator } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
11
11
|
import { getRemoteAuthority } from 'monaco-editor/esm/vs/platform/remote/common/remoteHosts.js';
|
|
12
12
|
import { WorkspaceFolder } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
13
|
-
const IWorkspacesService = (
|
|
13
|
+
const IWorkspacesService = ( createDecorator('workspacesService'));
|
|
14
14
|
function isRecentWorkspace(curr) {
|
|
15
15
|
return curr.hasOwnProperty('workspace');
|
|
16
16
|
}
|
|
@@ -33,7 +33,7 @@ function isRawUriWorkspaceFolder(obj) {
|
|
|
33
33
|
}
|
|
34
34
|
function getStoredWorkspaceFolder(folderURI, forceAbsolute, folderName, targetConfigFolderURI, extUri) {
|
|
35
35
|
if (folderURI.scheme !== targetConfigFolderURI.scheme) {
|
|
36
|
-
return { name: folderName, uri: (
|
|
36
|
+
return { name: folderName, uri: ( folderURI.toString(true)) };
|
|
37
37
|
}
|
|
38
38
|
let folderPath = !forceAbsolute ? extUri.relativePath(targetConfigFolderURI, folderURI) : undefined;
|
|
39
39
|
if (folderPath !== undefined) {
|
|
@@ -54,7 +54,7 @@ function getStoredWorkspaceFolder(folderURI, forceAbsolute, folderName, targetCo
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
else if (!extUri.isEqualAuthority(folderURI.authority, targetConfigFolderURI.authority)) {
|
|
57
|
-
return { name: folderName, uri: (
|
|
57
|
+
return { name: folderName, uri: ( folderURI.toString(true)) };
|
|
58
58
|
}
|
|
59
59
|
else {
|
|
60
60
|
folderPath = folderURI.path;
|
|
@@ -71,7 +71,7 @@ function massagePathForWindows(folderPath) {
|
|
|
71
71
|
}
|
|
72
72
|
function toWorkspaceFolders(configuredFolders, workspaceConfigFile, extUri) {
|
|
73
73
|
const result = [];
|
|
74
|
-
const seen = (
|
|
74
|
+
const seen = ( new Set());
|
|
75
75
|
const relativeTo = extUri.dirname(workspaceConfigFile);
|
|
76
76
|
for (const configuredFolder of configuredFolders) {
|
|
77
77
|
let uri = undefined;
|
|
@@ -82,7 +82,7 @@ function toWorkspaceFolders(configuredFolders, workspaceConfigFile, extUri) {
|
|
|
82
82
|
}
|
|
83
83
|
else if (isRawUriWorkspaceFolder(configuredFolder)) {
|
|
84
84
|
try {
|
|
85
|
-
uri = (
|
|
85
|
+
uri = ( URI.parse(configuredFolder.uri));
|
|
86
86
|
if (uri.path[0] !== posix.sep) {
|
|
87
87
|
uri = uri.with({ path: posix.sep + uri.path });
|
|
88
88
|
}
|
|
@@ -93,10 +93,10 @@ function toWorkspaceFolders(configuredFolders, workspaceConfigFile, extUri) {
|
|
|
93
93
|
}
|
|
94
94
|
if (uri) {
|
|
95
95
|
const comparisonKey = extUri.getComparisonKey(uri);
|
|
96
|
-
if (!(
|
|
96
|
+
if (!( seen.has(comparisonKey))) {
|
|
97
97
|
seen.add(comparisonKey);
|
|
98
98
|
const name = configuredFolder.name || extUri.basenameOrAuthority(uri);
|
|
99
|
-
result.push((
|
|
99
|
+
result.push(( new WorkspaceFolder({ uri, name, index: result.length }, configuredFolder)));
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -108,7 +108,7 @@ function rewriteWorkspaceFileForNewLocation(rawWorkspaceContents, configPathURI,
|
|
|
108
108
|
const targetConfigFolder = extUri.dirname(targetConfigPathURI);
|
|
109
109
|
const rewrittenFolders = [];
|
|
110
110
|
for (const folder of storedWorkspace.folders) {
|
|
111
|
-
const folderURI = isRawFileWorkspaceFolder(folder) ? extUri.resolvePath(sourceConfigFolder, folder.path) : (
|
|
111
|
+
const folderURI = isRawFileWorkspaceFolder(folder) ? extUri.resolvePath(sourceConfigFolder, folder.path) : ( URI.parse(folder.uri));
|
|
112
112
|
let absolute;
|
|
113
113
|
if (isFromUntitledWorkspace) {
|
|
114
114
|
absolute = false;
|
|
@@ -154,7 +154,7 @@ function restoreRecentlyOpened(data, logService) {
|
|
|
154
154
|
onEntry(entries[i], i);
|
|
155
155
|
}
|
|
156
156
|
catch (e) {
|
|
157
|
-
logService.warn(`Error restoring recent entry ${JSON.stringify(entries[i])}: ${(
|
|
157
|
+
logService.warn(`Error restoring recent entry ${JSON.stringify(entries[i])}: ${( e.toString())}. Skip entry.`);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
};
|
|
@@ -164,13 +164,13 @@ function restoreRecentlyOpened(data, logService) {
|
|
|
164
164
|
const label = entry.label;
|
|
165
165
|
const remoteAuthority = entry.remoteAuthority;
|
|
166
166
|
if (isSerializedRecentWorkspace(entry)) {
|
|
167
|
-
result.workspaces.push({ label, remoteAuthority, workspace: { id: entry.workspace.id, configPath: (
|
|
167
|
+
result.workspaces.push({ label, remoteAuthority, workspace: { id: entry.workspace.id, configPath: ( URI.parse(entry.workspace.configPath)) } });
|
|
168
168
|
}
|
|
169
169
|
else if (isSerializedRecentFolder(entry)) {
|
|
170
|
-
result.workspaces.push({ label, remoteAuthority, folderUri: (
|
|
170
|
+
result.workspaces.push({ label, remoteAuthority, folderUri: ( URI.parse(entry.folderUri)) });
|
|
171
171
|
}
|
|
172
172
|
else if (isSerializedRecentFile(entry)) {
|
|
173
|
-
result.files.push({ label, remoteAuthority, fileUri: (
|
|
173
|
+
result.files.push({ label, remoteAuthority, fileUri: ( URI.parse(entry.fileUri)) });
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
176
|
}
|
|
@@ -181,14 +181,14 @@ function toStoreData(recents) {
|
|
|
181
181
|
const serialized = { entries: [] };
|
|
182
182
|
for (const recent of recents.workspaces) {
|
|
183
183
|
if (isRecentFolder(recent)) {
|
|
184
|
-
serialized.entries.push({ folderUri: (
|
|
184
|
+
serialized.entries.push({ folderUri: ( recent.folderUri.toString()), label: recent.label, remoteAuthority: recent.remoteAuthority });
|
|
185
185
|
}
|
|
186
186
|
else {
|
|
187
|
-
serialized.entries.push({ workspace: { id: recent.workspace.id, configPath: (
|
|
187
|
+
serialized.entries.push({ workspace: { id: recent.workspace.id, configPath: ( recent.workspace.configPath.toString()) }, label: recent.label, remoteAuthority: recent.remoteAuthority });
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
for (const recent of recents.files) {
|
|
191
|
-
serialized.entries.push({ fileUri: (
|
|
191
|
+
serialized.entries.push({ fileUri: ( recent.fileUri.toString()), label: recent.label, remoteAuthority: recent.remoteAuthority });
|
|
192
192
|
}
|
|
193
193
|
return serialized;
|
|
194
194
|
}
|
|
@@ -46,10 +46,10 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
46
46
|
this._editorService = _editorService;
|
|
47
47
|
this._instantiationService = _instantiationService;
|
|
48
48
|
this._webviewWorkbenchService = _webviewWorkbenchService;
|
|
49
|
-
this._editorProviders = this._register((
|
|
50
|
-
this._editorRenameBackups = (
|
|
51
|
-
this._webviewOriginStore = (
|
|
52
|
-
this._proxyCustomEditors = (
|
|
49
|
+
this._editorProviders = this._register(( new DisposableMap()));
|
|
50
|
+
this._editorRenameBackups = ( new Map());
|
|
51
|
+
this._webviewOriginStore = ( new ExtensionKeyedWebviewOriginStore('mainThreadCustomEditors.origins', storageService));
|
|
52
|
+
this._proxyCustomEditors = ( context.getProxy(ExtHostContext.ExtHostCustomEditors));
|
|
53
53
|
this._register(workingCopyFileService.registerWorkingCopyProvider((editorResource) => {
|
|
54
54
|
const matchedWorkingCopies = [];
|
|
55
55
|
for (const workingCopy of workingCopyService.workingCopies) {
|
|
@@ -79,10 +79,10 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
79
79
|
this.registerEditorProvider(0 , reviveWebviewExtension(extensionData), viewType, options, {}, supportsMultipleEditorsPerDocument, serializeBuffersForPostMessage);
|
|
80
80
|
}
|
|
81
81
|
registerEditorProvider(modelType, extension, viewType, options, capabilities, supportsMultipleEditorsPerDocument, serializeBuffersForPostMessage) {
|
|
82
|
-
if ((
|
|
82
|
+
if (( this._editorProviders.has(viewType))) {
|
|
83
83
|
throw new Error(`Provider for ${viewType} already registered`);
|
|
84
84
|
}
|
|
85
|
-
const disposables = (
|
|
85
|
+
const disposables = ( new DisposableStore());
|
|
86
86
|
disposables.add(this._customEditorService.registerCustomEditorCapabilities(viewType, {
|
|
87
87
|
supportsMultipleEditorsPerDocument
|
|
88
88
|
}));
|
|
@@ -99,9 +99,9 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
99
99
|
webviewInput.webview.extension = extension;
|
|
100
100
|
let backupId = webviewInput.backupId;
|
|
101
101
|
if (webviewInput.oldResource && !webviewInput.backupId) {
|
|
102
|
-
const backup = this._editorRenameBackups.get((
|
|
102
|
+
const backup = this._editorRenameBackups.get(( webviewInput.oldResource.toString()));
|
|
103
103
|
backupId = backup?.backupId;
|
|
104
|
-
this._editorRenameBackups.delete((
|
|
104
|
+
this._editorRenameBackups.delete(( webviewInput.oldResource.toString()));
|
|
105
105
|
}
|
|
106
106
|
let modelRef;
|
|
107
107
|
try {
|
|
@@ -155,7 +155,7 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
155
155
|
this._editorProviders.set(viewType, disposables);
|
|
156
156
|
}
|
|
157
157
|
$unregisterEditorProvider(viewType) {
|
|
158
|
-
if (!(
|
|
158
|
+
if (!( this._editorProviders.has(viewType))) {
|
|
159
159
|
throw new Error(`No provider for ${viewType} registered`);
|
|
160
160
|
}
|
|
161
161
|
this._editorProviders.deleteAndDispose(viewType);
|
|
@@ -213,33 +213,33 @@ let MainThreadCustomEditors = class MainThreadCustomEditors extends Disposable {
|
|
|
213
213
|
if (model instanceof MainThreadCustomEditorModel && model.isDirty()) {
|
|
214
214
|
const workingCopy = await model.backup(CancellationToken.None);
|
|
215
215
|
if (workingCopy.meta) {
|
|
216
|
-
this._editorRenameBackups.set((
|
|
216
|
+
this._editorRenameBackups.set(( model.editorResource.toString()), workingCopy.meta);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
})());
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
|
-
MainThreadCustomEditors = (
|
|
224
|
-
(
|
|
225
|
-
(
|
|
226
|
-
(
|
|
227
|
-
(
|
|
228
|
-
(
|
|
229
|
-
(
|
|
230
|
-
(
|
|
231
|
-
(
|
|
232
|
-
(
|
|
233
|
-
], MainThreadCustomEditors))
|
|
223
|
+
MainThreadCustomEditors = ( __decorate([
|
|
224
|
+
( __param(3, IExtensionService)),
|
|
225
|
+
( __param(4, IStorageService)),
|
|
226
|
+
( __param(5, IWorkingCopyService)),
|
|
227
|
+
( __param(6, IWorkingCopyFileService)),
|
|
228
|
+
( __param(7, ICustomEditorService)),
|
|
229
|
+
( __param(8, IEditorGroupsService)),
|
|
230
|
+
( __param(9, IEditorService)),
|
|
231
|
+
( __param(10, IInstantiationService)),
|
|
232
|
+
( __param(11, IWebviewWorkbenchService))
|
|
233
|
+
], MainThreadCustomEditors));
|
|
234
234
|
var HotExitState;
|
|
235
|
-
( (
|
|
236
|
-
( (
|
|
235
|
+
( (function(HotExitState) {
|
|
236
|
+
( (function(Type) {
|
|
237
237
|
Type[Type["Allowed"] = 0] = "Allowed";
|
|
238
238
|
Type[Type["NotAllowed"] = 1] = "NotAllowed";
|
|
239
239
|
Type[Type["Pending"] = 2] = "Pending";
|
|
240
|
-
})(HotExitState.Type || (HotExitState.Type = {})))
|
|
241
|
-
HotExitState.Allowed = (
|
|
242
|
-
HotExitState.NotAllowed = (
|
|
240
|
+
})(HotExitState.Type || (HotExitState.Type = {})));
|
|
241
|
+
HotExitState.Allowed = ( Object.freeze({ type: 0 }));
|
|
242
|
+
HotExitState.NotAllowed = ( Object.freeze({ type: 1 }));
|
|
243
243
|
class Pending {
|
|
244
244
|
constructor(operation) {
|
|
245
245
|
this.operation = operation;
|
|
@@ -247,7 +247,7 @@ var HotExitState;
|
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
HotExitState.Pending = Pending;
|
|
250
|
-
})(HotExitState || (HotExitState = {})))
|
|
250
|
+
})(HotExitState || (HotExitState = {})));
|
|
251
251
|
let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThreadCustomEditorModel extends ResourceWorkingCopy {
|
|
252
252
|
static async create(instantiationService, proxy, viewType, resource, options, getEditors, cancellation) {
|
|
253
253
|
const editors = getEditors();
|
|
@@ -277,11 +277,11 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
277
277
|
this._edits = [];
|
|
278
278
|
this._isDirtyFromContentChange = false;
|
|
279
279
|
this.typeId = NO_TYPE_ID;
|
|
280
|
-
this._onDidChangeDirty = this._register((
|
|
280
|
+
this._onDidChangeDirty = this._register(( new Emitter()));
|
|
281
281
|
this.onDidChangeDirty = this._onDidChangeDirty.event;
|
|
282
|
-
this._onDidChangeContent = this._register((
|
|
282
|
+
this._onDidChangeContent = this._register(( new Emitter()));
|
|
283
283
|
this.onDidChangeContent = this._onDidChangeContent.event;
|
|
284
|
-
this._onDidSave = this._register((
|
|
284
|
+
this._onDidSave = this._register(( new Emitter()));
|
|
285
285
|
this.onDidSave = this._onDidSave.event;
|
|
286
286
|
this.onDidChangeReadonly = Event.None;
|
|
287
287
|
this._fromBackup = fromBackup;
|
|
@@ -297,7 +297,7 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
297
297
|
return true;
|
|
298
298
|
}
|
|
299
299
|
return false;
|
|
300
|
-
})(), (
|
|
300
|
+
})(), ( localize('vetoExtHostRestart', "Custom editor '{0}' could not be saved.", this.name)));
|
|
301
301
|
}));
|
|
302
302
|
}
|
|
303
303
|
if (startDirty) {
|
|
@@ -316,15 +316,13 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
316
316
|
}
|
|
317
317
|
static toWorkingCopyResource(viewType, resource) {
|
|
318
318
|
const authority = viewType.replace(/[^a-z0-9\-_]/gi, '-');
|
|
319
|
-
const path = `/${multibyteAwareBtoa((
|
|
320
|
-
return (
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}))
|
|
327
|
-
);
|
|
319
|
+
const path = `/${multibyteAwareBtoa(( resource.with({ query: null, fragment: null }).toString(true)))}`;
|
|
320
|
+
return ( URI.from({
|
|
321
|
+
scheme: Schemas.vscodeCustomEditor,
|
|
322
|
+
authority: authority,
|
|
323
|
+
path: path,
|
|
324
|
+
query: JSON.stringify(resource.toJSON()),
|
|
325
|
+
}));
|
|
328
326
|
}
|
|
329
327
|
get name() {
|
|
330
328
|
return basename(this._labelService.getUriLabel(this._editorResource));
|
|
@@ -364,7 +362,7 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
364
362
|
this._undoService.pushElement({
|
|
365
363
|
type: 0 ,
|
|
366
364
|
resource: this._editorResource,
|
|
367
|
-
label: label ?? (
|
|
365
|
+
label: label ?? ( localize('defaultEditLabel', "Edit")),
|
|
368
366
|
code: 'undoredo.customEditorEdit',
|
|
369
367
|
undo: () => this.undo(),
|
|
370
368
|
redo: () => this.redo(),
|
|
@@ -556,14 +554,14 @@ let MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = class MainThre
|
|
|
556
554
|
throw new Error(`Cannot back up in this state: ${errorMessage}`);
|
|
557
555
|
}
|
|
558
556
|
};
|
|
559
|
-
MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = (
|
|
560
|
-
(
|
|
561
|
-
(
|
|
562
|
-
(
|
|
563
|
-
(
|
|
564
|
-
(
|
|
565
|
-
(
|
|
566
|
-
(
|
|
567
|
-
(
|
|
568
|
-
], MainThreadCustomEditorModel))
|
|
557
|
+
MainThreadCustomEditorModel = MainThreadCustomEditorModel_1 = ( __decorate([
|
|
558
|
+
( __param(7, IFileDialogService)),
|
|
559
|
+
( __param(8, IFileService)),
|
|
560
|
+
( __param(9, ILabelService)),
|
|
561
|
+
( __param(10, IUndoRedoService)),
|
|
562
|
+
( __param(11, IWorkbenchEnvironmentService)),
|
|
563
|
+
( __param(12, IWorkingCopyService)),
|
|
564
|
+
( __param(13, IPathService)),
|
|
565
|
+
( __param(14, IExtensionService))
|
|
566
|
+
], MainThreadCustomEditorModel));
|
|
569
567
|
export { MainThreadCustomEditors };
|
|
@@ -47,10 +47,10 @@ class DocumentAndEditorStateDelta {
|
|
|
47
47
|
}
|
|
48
48
|
toString() {
|
|
49
49
|
let ret = 'DocumentAndEditorStateDelta\n';
|
|
50
|
-
ret += `\tRemoved Documents: [${(
|
|
51
|
-
ret += `\tAdded Documents: [${(
|
|
52
|
-
ret += `\tRemoved Editors: [${(
|
|
53
|
-
ret += `\tAdded Editors: [${(
|
|
50
|
+
ret += `\tRemoved Documents: [${( this.removedDocuments.map(d => ( d.uri.toString(true)))).join(', ')}]\n`;
|
|
51
|
+
ret += `\tAdded Documents: [${( this.addedDocuments.map(d => ( d.uri.toString(true)))).join(', ')}]\n`;
|
|
52
|
+
ret += `\tRemoved Editors: [${( this.removedEditors.map(e => e.id)).join(', ')}]\n`;
|
|
53
|
+
ret += `\tAdded Editors: [${( this.addedEditors.map(e => e.id)).join(', ')}]\n`;
|
|
54
54
|
ret += `\tNew Active Editor: ${this.newActiveEditor}\n`;
|
|
55
55
|
return ret;
|
|
56
56
|
}
|
|
@@ -58,31 +58,20 @@ class DocumentAndEditorStateDelta {
|
|
|
58
58
|
class DocumentAndEditorState {
|
|
59
59
|
static compute(before, after) {
|
|
60
60
|
if (!before) {
|
|
61
|
-
return (
|
|
62
|
-
(new DocumentAndEditorStateDelta(
|
|
63
|
-
[],
|
|
64
|
-
[...( (after.documents.values()))],
|
|
65
|
-
[],
|
|
66
|
-
[...( (after.textEditors.values()))],
|
|
67
|
-
undefined,
|
|
68
|
-
after.activeEditor
|
|
69
|
-
))
|
|
70
|
-
);
|
|
61
|
+
return ( new DocumentAndEditorStateDelta([], [...( after.documents.values())], [], [...( after.textEditors.values())], undefined, after.activeEditor));
|
|
71
62
|
}
|
|
72
63
|
const documentDelta = diffSets(before.documents, after.documents);
|
|
73
64
|
const editorDelta = diffMaps(before.textEditors, after.textEditors);
|
|
74
65
|
const oldActiveEditor = before.activeEditor !== after.activeEditor ? before.activeEditor : undefined;
|
|
75
66
|
const newActiveEditor = before.activeEditor !== after.activeEditor ? after.activeEditor : undefined;
|
|
76
|
-
return (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
))
|
|
85
|
-
);
|
|
67
|
+
return ( new DocumentAndEditorStateDelta(
|
|
68
|
+
documentDelta.removed,
|
|
69
|
+
documentDelta.added,
|
|
70
|
+
editorDelta.removed,
|
|
71
|
+
editorDelta.added,
|
|
72
|
+
oldActiveEditor,
|
|
73
|
+
newActiveEditor
|
|
74
|
+
));
|
|
86
75
|
}
|
|
87
76
|
constructor(documents, textEditors, activeEditor) {
|
|
88
77
|
this.documents = documents;
|
|
@@ -97,8 +86,8 @@ let MainThreadDocumentAndEditorStateComputer = class MainThreadDocumentAndEditor
|
|
|
97
86
|
this._codeEditorService = _codeEditorService;
|
|
98
87
|
this._editorService = _editorService;
|
|
99
88
|
this._paneCompositeService = _paneCompositeService;
|
|
100
|
-
this._toDispose = (
|
|
101
|
-
this._toDisposeOnEditorRemove = (
|
|
89
|
+
this._toDispose = ( new DisposableStore());
|
|
90
|
+
this._toDisposeOnEditorRemove = ( new DisposableMap());
|
|
102
91
|
this._activeEditorOrder = 0 ;
|
|
103
92
|
this._modelService.onModelAdded(this._updateStateOnModelAdd, this, this._toDispose);
|
|
104
93
|
this._modelService.onModelRemoved(_ => this._updateState(), this, this._toDispose);
|
|
@@ -121,7 +110,7 @@ let MainThreadDocumentAndEditorStateComputer = class MainThreadDocumentAndEditor
|
|
|
121
110
|
}
|
|
122
111
|
_onDidRemoveEditor(e) {
|
|
123
112
|
const id = e.getId();
|
|
124
|
-
if ((
|
|
113
|
+
if (( this._toDisposeOnEditorRemove.has(id))) {
|
|
125
114
|
this._toDisposeOnEditorRemove.deleteAndDispose(id);
|
|
126
115
|
this._updateState();
|
|
127
116
|
}
|
|
@@ -134,21 +123,21 @@ let MainThreadDocumentAndEditorStateComputer = class MainThreadDocumentAndEditor
|
|
|
134
123
|
this._updateState();
|
|
135
124
|
return;
|
|
136
125
|
}
|
|
137
|
-
this._currentState = (
|
|
126
|
+
this._currentState = ( new DocumentAndEditorState(
|
|
138
127
|
this._currentState.documents.add(model),
|
|
139
128
|
this._currentState.textEditors,
|
|
140
129
|
this._currentState.activeEditor
|
|
141
|
-
))
|
|
142
|
-
this._onDidChangeState((
|
|
130
|
+
));
|
|
131
|
+
this._onDidChangeState(( new DocumentAndEditorStateDelta([], [model], [], [], undefined, undefined)));
|
|
143
132
|
}
|
|
144
133
|
_updateState(widgetFocusCandidate) {
|
|
145
|
-
const models = (
|
|
134
|
+
const models = ( new Set());
|
|
146
135
|
for (const model of this._modelService.getModels()) {
|
|
147
136
|
if (shouldSynchronizeModel(model)) {
|
|
148
137
|
models.add(model);
|
|
149
138
|
}
|
|
150
139
|
}
|
|
151
|
-
const editors = (
|
|
140
|
+
const editors = ( new Map());
|
|
152
141
|
let activeEditor = null;
|
|
153
142
|
for (const editor of this._codeEditorService.listCodeEditors()) {
|
|
154
143
|
if (editor.isSimpleWidget) {
|
|
@@ -159,7 +148,7 @@ let MainThreadDocumentAndEditorStateComputer = class MainThreadDocumentAndEditor
|
|
|
159
148
|
&& !model.isDisposed()
|
|
160
149
|
&& Boolean(this._modelService.getModel(model.uri))
|
|
161
150
|
) {
|
|
162
|
-
const apiEditor = (
|
|
151
|
+
const apiEditor = ( new TextEditorSnapshot(editor));
|
|
163
152
|
editors.set(apiEditor.id, apiEditor);
|
|
164
153
|
if (editor.hasTextFocus() || (widgetFocusCandidate === editor && editor.hasWidgetFocus())) {
|
|
165
154
|
activeEditor = apiEditor.id;
|
|
@@ -175,14 +164,14 @@ let MainThreadDocumentAndEditorStateComputer = class MainThreadDocumentAndEditor
|
|
|
175
164
|
candidate = this._getActiveEditorFromPanel() || this._getActiveEditorFromEditorPart();
|
|
176
165
|
}
|
|
177
166
|
if (candidate) {
|
|
178
|
-
for (const snapshot of (
|
|
167
|
+
for (const snapshot of ( editors.values())) {
|
|
179
168
|
if (candidate === snapshot.editor) {
|
|
180
169
|
activeEditor = snapshot.id;
|
|
181
170
|
}
|
|
182
171
|
}
|
|
183
172
|
}
|
|
184
173
|
}
|
|
185
|
-
const newState = (
|
|
174
|
+
const newState = ( new DocumentAndEditorState(models, editors, activeEditor));
|
|
186
175
|
const delta = DocumentAndEditorState.compute(this._currentState, newState);
|
|
187
176
|
if (!delta.isEmpty) {
|
|
188
177
|
this._currentState = newState;
|
|
@@ -207,12 +196,12 @@ let MainThreadDocumentAndEditorStateComputer = class MainThreadDocumentAndEditor
|
|
|
207
196
|
return activeTextEditorControl;
|
|
208
197
|
}
|
|
209
198
|
};
|
|
210
|
-
MainThreadDocumentAndEditorStateComputer = (
|
|
211
|
-
(
|
|
212
|
-
(
|
|
213
|
-
(
|
|
214
|
-
(
|
|
215
|
-
], MainThreadDocumentAndEditorStateComputer))
|
|
199
|
+
MainThreadDocumentAndEditorStateComputer = ( __decorate([
|
|
200
|
+
( __param(1, IModelService)),
|
|
201
|
+
( __param(2, ICodeEditorService)),
|
|
202
|
+
( __param(3, IEditorService)),
|
|
203
|
+
( __param(4, IPaneCompositePartService))
|
|
204
|
+
], MainThreadDocumentAndEditorStateComputer));
|
|
216
205
|
let MainThreadDocumentsAndEditors = class MainThreadDocumentsAndEditors {
|
|
217
206
|
constructor(extHostContext, _modelService, _textFileService, _editorService, codeEditorService, fileService, textModelResolverService, _editorGroupService, paneCompositeService, environmentService, workingCopyFileService, uriIdentityService, _clipboardService, pathService, configurationService) {
|
|
218
207
|
this._modelService = _modelService;
|
|
@@ -220,10 +209,10 @@ let MainThreadDocumentsAndEditors = class MainThreadDocumentsAndEditors {
|
|
|
220
209
|
this._editorService = _editorService;
|
|
221
210
|
this._editorGroupService = _editorGroupService;
|
|
222
211
|
this._clipboardService = _clipboardService;
|
|
223
|
-
this._toDispose = (
|
|
224
|
-
this._textEditors = (
|
|
225
|
-
this._proxy = (
|
|
226
|
-
this._mainThreadDocuments = this._toDispose.add((
|
|
212
|
+
this._toDispose = ( new DisposableStore());
|
|
213
|
+
this._textEditors = ( new Map());
|
|
214
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostDocumentsAndEditors));
|
|
215
|
+
this._mainThreadDocuments = this._toDispose.add(( new MainThreadDocuments(
|
|
227
216
|
extHostContext,
|
|
228
217
|
this._modelService,
|
|
229
218
|
this._textFileService,
|
|
@@ -233,24 +222,24 @@ let MainThreadDocumentsAndEditors = class MainThreadDocumentsAndEditors {
|
|
|
233
222
|
uriIdentityService,
|
|
234
223
|
workingCopyFileService,
|
|
235
224
|
pathService
|
|
236
|
-
)))
|
|
225
|
+
)));
|
|
237
226
|
extHostContext.set(MainContext.MainThreadDocuments, this._mainThreadDocuments);
|
|
238
|
-
this._mainThreadEditors = this._toDispose.add((
|
|
227
|
+
this._mainThreadEditors = this._toDispose.add(( new MainThreadTextEditors(
|
|
239
228
|
this,
|
|
240
229
|
extHostContext,
|
|
241
230
|
codeEditorService,
|
|
242
231
|
this._editorService,
|
|
243
232
|
this._editorGroupService,
|
|
244
233
|
configurationService
|
|
245
|
-
)))
|
|
234
|
+
)));
|
|
246
235
|
extHostContext.set(MainContext.MainThreadTextEditors, this._mainThreadEditors);
|
|
247
|
-
this._toDispose.add((
|
|
236
|
+
this._toDispose.add(( new MainThreadDocumentAndEditorStateComputer(
|
|
248
237
|
delta => this._onDelta(delta),
|
|
249
238
|
_modelService,
|
|
250
239
|
codeEditorService,
|
|
251
240
|
this._editorService,
|
|
252
241
|
paneCompositeService
|
|
253
|
-
)))
|
|
242
|
+
)));
|
|
254
243
|
}
|
|
255
244
|
dispose() {
|
|
256
245
|
this._toDispose.dispose();
|
|
@@ -258,9 +247,9 @@ let MainThreadDocumentsAndEditors = class MainThreadDocumentsAndEditors {
|
|
|
258
247
|
_onDelta(delta) {
|
|
259
248
|
const removedEditors = [];
|
|
260
249
|
const addedEditors = [];
|
|
261
|
-
const removedDocuments = (
|
|
250
|
+
const removedDocuments = ( delta.removedDocuments.map(m => m.uri));
|
|
262
251
|
for (const apiEditor of delta.addedEditors) {
|
|
263
|
-
const mainThreadEditor = (
|
|
252
|
+
const mainThreadEditor = ( new MainThreadTextEditor(
|
|
264
253
|
apiEditor.id,
|
|
265
254
|
apiEditor.editor.getModel(),
|
|
266
255
|
apiEditor.editor,
|
|
@@ -268,7 +257,7 @@ let MainThreadDocumentsAndEditors = class MainThreadDocumentsAndEditors {
|
|
|
268
257
|
this._mainThreadDocuments,
|
|
269
258
|
this._modelService,
|
|
270
259
|
this._clipboardService
|
|
271
|
-
))
|
|
260
|
+
));
|
|
272
261
|
this._textEditors.set(apiEditor.id, mainThreadEditor);
|
|
273
262
|
addedEditors.push(mainThreadEditor);
|
|
274
263
|
}
|
|
@@ -296,11 +285,11 @@ let MainThreadDocumentsAndEditors = class MainThreadDocumentsAndEditors {
|
|
|
296
285
|
}
|
|
297
286
|
if (delta.addedDocuments.length > 0) {
|
|
298
287
|
empty = false;
|
|
299
|
-
extHostDelta.addedDocuments = (
|
|
288
|
+
extHostDelta.addedDocuments = ( delta.addedDocuments.map(m => this._toModelAddData(m)));
|
|
300
289
|
}
|
|
301
290
|
if (delta.addedEditors.length > 0) {
|
|
302
291
|
empty = false;
|
|
303
|
-
extHostDelta.addedEditors = (
|
|
292
|
+
extHostDelta.addedEditors = ( addedEditors.map(e => this._toTextEditorAddData(e)));
|
|
304
293
|
}
|
|
305
294
|
if (!empty) {
|
|
306
295
|
this._proxy.$acceptDocumentsAndEditorsDelta(extHostDelta);
|
|
@@ -361,19 +350,19 @@ let MainThreadDocumentsAndEditors = class MainThreadDocumentsAndEditors {
|
|
|
361
350
|
};
|
|
362
351
|
MainThreadDocumentsAndEditors = __decorate([
|
|
363
352
|
extHostCustomer,
|
|
364
|
-
(
|
|
365
|
-
(
|
|
366
|
-
(
|
|
367
|
-
(
|
|
368
|
-
(
|
|
369
|
-
(
|
|
370
|
-
(
|
|
371
|
-
(
|
|
372
|
-
(
|
|
373
|
-
(
|
|
374
|
-
(
|
|
375
|
-
(
|
|
376
|
-
(
|
|
377
|
-
(
|
|
353
|
+
( __param(1, IModelService)),
|
|
354
|
+
( __param(2, ITextFileService)),
|
|
355
|
+
( __param(3, IEditorService)),
|
|
356
|
+
( __param(4, ICodeEditorService)),
|
|
357
|
+
( __param(5, IFileService)),
|
|
358
|
+
( __param(6, ITextModelService)),
|
|
359
|
+
( __param(7, IEditorGroupsService)),
|
|
360
|
+
( __param(8, IPaneCompositePartService)),
|
|
361
|
+
( __param(9, IWorkbenchEnvironmentService)),
|
|
362
|
+
( __param(10, IWorkingCopyFileService)),
|
|
363
|
+
( __param(11, IUriIdentityService)),
|
|
364
|
+
( __param(12, IClipboardService)),
|
|
365
|
+
( __param(13, IPathService)),
|
|
366
|
+
( __param(14, IConfigurationService))
|
|
378
367
|
], MainThreadDocumentsAndEditors);
|
|
379
368
|
export { MainThreadDocumentsAndEditors };
|