@lvce-editor/editor-worker 12.2.0 → 13.1.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/README.md +0 -4
- package/dist/editorWorkerMain.js +367 -620
- package/package.json +6 -5
package/dist/editorWorkerMain.js
CHANGED
|
@@ -539,26 +539,26 @@ const create$4$2 = (method, params) => {
|
|
|
539
539
|
};
|
|
540
540
|
};
|
|
541
541
|
const callbacks = Object.create(null);
|
|
542
|
-
const set$
|
|
542
|
+
const set$c = (id, fn) => {
|
|
543
543
|
callbacks[id] = fn;
|
|
544
544
|
};
|
|
545
|
-
const get$
|
|
545
|
+
const get$8 = id => {
|
|
546
546
|
return callbacks[id];
|
|
547
547
|
};
|
|
548
548
|
const remove$9 = id => {
|
|
549
549
|
delete callbacks[id];
|
|
550
550
|
};
|
|
551
551
|
let id = 0;
|
|
552
|
-
const create$3$
|
|
552
|
+
const create$3$2 = () => {
|
|
553
553
|
return ++id;
|
|
554
554
|
};
|
|
555
555
|
const registerPromise = () => {
|
|
556
|
-
const id = create$3$
|
|
556
|
+
const id = create$3$2();
|
|
557
557
|
const {
|
|
558
558
|
resolve,
|
|
559
559
|
promise
|
|
560
560
|
} = Promise.withResolvers();
|
|
561
|
-
set$
|
|
561
|
+
set$c(id, resolve);
|
|
562
562
|
return {
|
|
563
563
|
id,
|
|
564
564
|
promise
|
|
@@ -723,7 +723,7 @@ const warn$1 = (...args) => {
|
|
|
723
723
|
console.warn(...args);
|
|
724
724
|
};
|
|
725
725
|
const resolve = (id, response) => {
|
|
726
|
-
const fn = get$
|
|
726
|
+
const fn = get$8(id);
|
|
727
727
|
if (!fn) {
|
|
728
728
|
console.log(response);
|
|
729
729
|
warn$1(`callback ${id} may already be disposed`);
|
|
@@ -903,10 +903,10 @@ const send = (transport, method, ...params) => {
|
|
|
903
903
|
const message = create$4$2(method, params);
|
|
904
904
|
transport.send(message);
|
|
905
905
|
};
|
|
906
|
-
const invoke$
|
|
906
|
+
const invoke$c = (ipc, method, ...params) => {
|
|
907
907
|
return invokeHelper(ipc, method, params, false);
|
|
908
908
|
};
|
|
909
|
-
const invokeAndTransfer$
|
|
909
|
+
const invokeAndTransfer$3 = (ipc, method, ...params) => {
|
|
910
910
|
return invokeHelper(ipc, method, params, true);
|
|
911
911
|
};
|
|
912
912
|
|
|
@@ -942,10 +942,10 @@ const createRpc = ipc => {
|
|
|
942
942
|
send(ipc, method, ...params);
|
|
943
943
|
},
|
|
944
944
|
invoke(method, ...params) {
|
|
945
|
-
return invoke$
|
|
945
|
+
return invoke$c(ipc, method, ...params);
|
|
946
946
|
},
|
|
947
947
|
invokeAndTransfer(method, ...params) {
|
|
948
|
-
return invokeAndTransfer$
|
|
948
|
+
return invokeAndTransfer$3(ipc, method, ...params);
|
|
949
949
|
},
|
|
950
950
|
async dispose() {
|
|
951
951
|
await ipc?.dispose();
|
|
@@ -1032,6 +1032,24 @@ const PlainMessagePortRpcParent = {
|
|
|
1032
1032
|
__proto__: null,
|
|
1033
1033
|
create: create$4$1
|
|
1034
1034
|
};
|
|
1035
|
+
const create$3$1 = async ({
|
|
1036
|
+
commandMap,
|
|
1037
|
+
send
|
|
1038
|
+
}) => {
|
|
1039
|
+
const {
|
|
1040
|
+
port1,
|
|
1041
|
+
port2
|
|
1042
|
+
} = new MessageChannel();
|
|
1043
|
+
await send(port1);
|
|
1044
|
+
return create$5$1({
|
|
1045
|
+
commandMap,
|
|
1046
|
+
messagePort: port2
|
|
1047
|
+
});
|
|
1048
|
+
};
|
|
1049
|
+
const TransferMessagePortRpcParent = {
|
|
1050
|
+
__proto__: null,
|
|
1051
|
+
create: create$3$1
|
|
1052
|
+
};
|
|
1035
1053
|
const create$a = async ({
|
|
1036
1054
|
commandMap
|
|
1037
1055
|
}) => {
|
|
@@ -1112,19 +1130,20 @@ const CtrlCmd = 1 << 11 >>> 0;
|
|
|
1112
1130
|
const Shift = 1 << 10 >>> 0;
|
|
1113
1131
|
const Alt$1 = 1 << 9 >>> 0;
|
|
1114
1132
|
|
|
1133
|
+
const CompletionWorker = 301;
|
|
1115
1134
|
const DebugWorker = 55;
|
|
1116
1135
|
const EditorWorker = 99;
|
|
1117
1136
|
const ExtensionHostWorker = 44;
|
|
1118
1137
|
const MarkdownWorker = 300;
|
|
1119
|
-
const RendererWorker
|
|
1138
|
+
const RendererWorker = 1;
|
|
1120
1139
|
|
|
1121
1140
|
const FocusEditorText$1 = 12;
|
|
1122
1141
|
|
|
1123
1142
|
const rpcs = Object.create(null);
|
|
1124
|
-
const set$
|
|
1143
|
+
const set$b = (id, rpc) => {
|
|
1125
1144
|
rpcs[id] = rpc;
|
|
1126
1145
|
};
|
|
1127
|
-
const get$
|
|
1146
|
+
const get$7 = id => {
|
|
1128
1147
|
return rpcs[id];
|
|
1129
1148
|
};
|
|
1130
1149
|
const remove$8 = id => {
|
|
@@ -1135,443 +1154,112 @@ const create$9 = rpcId => {
|
|
|
1135
1154
|
return {
|
|
1136
1155
|
// @ts-ignore
|
|
1137
1156
|
invoke(method, ...params) {
|
|
1138
|
-
const rpc = get$
|
|
1157
|
+
const rpc = get$7(rpcId);
|
|
1139
1158
|
// @ts-ignore
|
|
1140
1159
|
return rpc.invoke(method, ...params);
|
|
1141
1160
|
},
|
|
1142
1161
|
// @ts-ignore
|
|
1143
1162
|
invokeAndTransfer(method, ...params) {
|
|
1144
|
-
const rpc = get$
|
|
1163
|
+
const rpc = get$7(rpcId);
|
|
1145
1164
|
// @ts-ignore
|
|
1146
1165
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1147
1166
|
},
|
|
1148
1167
|
set(rpc) {
|
|
1149
|
-
set$
|
|
1168
|
+
set$b(rpcId, rpc);
|
|
1150
1169
|
},
|
|
1151
1170
|
async dispose() {
|
|
1152
|
-
const rpc = get$
|
|
1171
|
+
const rpc = get$7(rpcId);
|
|
1153
1172
|
await rpc.dispose();
|
|
1154
1173
|
}
|
|
1155
1174
|
};
|
|
1156
1175
|
};
|
|
1157
1176
|
|
|
1158
1177
|
const {
|
|
1159
|
-
invoke: invoke$
|
|
1160
|
-
invokeAndTransfer: invokeAndTransfer$
|
|
1161
|
-
set: set$
|
|
1162
|
-
dispose: dispose$
|
|
1178
|
+
invoke: invoke$b,
|
|
1179
|
+
invokeAndTransfer: invokeAndTransfer$2,
|
|
1180
|
+
set: set$a,
|
|
1181
|
+
dispose: dispose$2
|
|
1163
1182
|
} = create$9(ExtensionHostWorker);
|
|
1164
1183
|
const executeReferenceProvider = async (id, offset) => {
|
|
1165
1184
|
// @ts-ignore
|
|
1166
|
-
return invoke$
|
|
1185
|
+
return invoke$b('ExtensionHostReference.executeReferenceProvider', id, offset);
|
|
1167
1186
|
};
|
|
1168
1187
|
const executeFileReferenceProvider = async id => {
|
|
1169
1188
|
// @ts-ignore
|
|
1170
|
-
return invoke$
|
|
1189
|
+
return invoke$b('ExtensionHostReference.executeFileReferenceProvider', id);
|
|
1171
1190
|
};
|
|
1172
1191
|
const getRuntimeStatus = async extensionId => {
|
|
1173
1192
|
// @ts-ignore
|
|
1174
|
-
return invoke$
|
|
1193
|
+
return invoke$b('ExtensionHost.getRuntimeStatus', extensionId);
|
|
1175
1194
|
};
|
|
1176
|
-
const registerMockRpc
|
|
1195
|
+
const registerMockRpc = commandMap => {
|
|
1177
1196
|
const mockRpc = createMockRpc({
|
|
1178
1197
|
commandMap
|
|
1179
1198
|
});
|
|
1180
|
-
set$
|
|
1199
|
+
set$a(mockRpc);
|
|
1181
1200
|
return mockRpc;
|
|
1182
1201
|
};
|
|
1183
1202
|
|
|
1184
1203
|
const ExtensionHost = {
|
|
1185
1204
|
__proto__: null,
|
|
1186
|
-
dispose: dispose$
|
|
1205
|
+
dispose: dispose$2,
|
|
1187
1206
|
executeFileReferenceProvider,
|
|
1188
1207
|
executeReferenceProvider,
|
|
1189
1208
|
getRuntimeStatus,
|
|
1190
|
-
invoke: invoke$c,
|
|
1191
|
-
invokeAndTransfer: invokeAndTransfer$3,
|
|
1192
|
-
registerMockRpc: registerMockRpc$1,
|
|
1193
|
-
set: set$b
|
|
1194
|
-
};
|
|
1195
|
-
|
|
1196
|
-
const {
|
|
1197
1209
|
invoke: invoke$b,
|
|
1198
1210
|
invokeAndTransfer: invokeAndTransfer$2,
|
|
1199
|
-
set: set$a,
|
|
1200
|
-
dispose: dispose$2
|
|
1201
|
-
} = create$9(RendererWorker$1);
|
|
1202
|
-
const searchFileHtml = async uri => {
|
|
1203
|
-
return invoke$b('ExtensionHost.searchFileWithHtml', uri);
|
|
1204
|
-
};
|
|
1205
|
-
const getFilePathElectron = async file => {
|
|
1206
|
-
return invoke$b('FileSystemHandle.getFilePathElectron', file);
|
|
1207
|
-
};
|
|
1208
|
-
const showContextMenu = async (x, y, id, ...args) => {
|
|
1209
|
-
return invoke$b('ContextMenu.show', x, y, id, ...args);
|
|
1210
|
-
};
|
|
1211
|
-
const getElectronVersion = async () => {
|
|
1212
|
-
return invoke$b('Process.getElectronVersion');
|
|
1213
|
-
};
|
|
1214
|
-
const applyBulkReplacement = async bulkEdits => {
|
|
1215
|
-
await invoke$b('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
1216
|
-
};
|
|
1217
|
-
const setColorTheme = async id => {
|
|
1218
|
-
// @ts-ignore
|
|
1219
|
-
return invoke$b(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1220
|
-
};
|
|
1221
|
-
const getNodeVersion = async () => {
|
|
1222
|
-
return invoke$b('Process.getNodeVersion');
|
|
1223
|
-
};
|
|
1224
|
-
const getChromeVersion = async () => {
|
|
1225
|
-
return invoke$b('Process.getChromeVersion');
|
|
1226
|
-
};
|
|
1227
|
-
const getV8Version = async () => {
|
|
1228
|
-
return invoke$b('Process.getV8Version');
|
|
1229
|
-
};
|
|
1230
|
-
const getFileHandles = async fileIds => {
|
|
1231
|
-
const files = await invoke$b('FileSystemHandle.getFileHandles', fileIds);
|
|
1232
|
-
return files;
|
|
1233
|
-
};
|
|
1234
|
-
const setWorkspacePath = async path => {
|
|
1235
|
-
await invoke$b('Workspace.setPath', path);
|
|
1236
|
-
};
|
|
1237
|
-
const registerWebViewInterceptor = async (id, port) => {
|
|
1238
|
-
await invokeAndTransfer$2('WebView.registerInterceptor', id, port);
|
|
1239
|
-
};
|
|
1240
|
-
const unregisterWebViewInterceptor = async id => {
|
|
1241
|
-
await invoke$b('WebView.unregisterInterceptor', id);
|
|
1242
|
-
};
|
|
1243
|
-
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
1244
|
-
const command = 'HandleMessagePort.handleMessagePort';
|
|
1245
|
-
// @ts-ignore
|
|
1246
|
-
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1247
|
-
};
|
|
1248
|
-
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1249
|
-
const command = 'Errors.handleMessagePort';
|
|
1250
|
-
// @ts-ignore
|
|
1251
|
-
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1252
|
-
};
|
|
1253
|
-
const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
|
|
1254
|
-
const command = 'Markdown.handleMessagePort';
|
|
1255
|
-
// @ts-ignore
|
|
1256
|
-
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1257
|
-
};
|
|
1258
|
-
const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
1259
|
-
const command = 'IconTheme.handleMessagePort';
|
|
1260
|
-
// @ts-ignore
|
|
1261
|
-
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1262
|
-
};
|
|
1263
|
-
const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
1264
|
-
const command = 'FileSystem.handleMessagePort';
|
|
1265
|
-
// @ts-ignore
|
|
1266
|
-
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1267
|
-
};
|
|
1268
|
-
const readFile = async uri => {
|
|
1269
|
-
return invoke$b('FileSystem.readFile', uri);
|
|
1270
|
-
};
|
|
1271
|
-
const getWebViewSecret = async key => {
|
|
1272
|
-
// @ts-ignore
|
|
1273
|
-
return invoke$b('WebView.getSecret', key);
|
|
1274
|
-
};
|
|
1275
|
-
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
1276
|
-
return invokeAndTransfer$2('WebView.setPort', uid, port, origin, portType);
|
|
1277
|
-
};
|
|
1278
|
-
const setFocus$1 = key => {
|
|
1279
|
-
return invoke$b('Focus.setFocus', key);
|
|
1280
|
-
};
|
|
1281
|
-
const getFileIcon = async options => {
|
|
1282
|
-
return invoke$b('IconTheme.getFileIcon', options);
|
|
1283
|
-
};
|
|
1284
|
-
const getColorThemeNames = async () => {
|
|
1285
|
-
return invoke$b('ColorTheme.getColorThemeNames');
|
|
1286
|
-
};
|
|
1287
|
-
const disableExtension = async id => {
|
|
1288
|
-
// @ts-ignore
|
|
1289
|
-
return invoke$b('ExtensionManagement.disable', id);
|
|
1290
|
-
};
|
|
1291
|
-
const enableExtension = async id => {
|
|
1292
|
-
// @ts-ignore
|
|
1293
|
-
return invoke$b('ExtensionManagement.enable', id);
|
|
1294
|
-
};
|
|
1295
|
-
const handleDebugChange = async params => {
|
|
1296
|
-
// @ts-ignore
|
|
1297
|
-
return invoke$b('Run And Debug.handleChange', params);
|
|
1298
|
-
};
|
|
1299
|
-
const getFolderIcon = async options => {
|
|
1300
|
-
return invoke$b('IconTheme.getFolderIcon', options);
|
|
1301
|
-
};
|
|
1302
|
-
const closeWidget = async widgetId => {
|
|
1303
|
-
return invoke$b('Viewlet.closeWidget', widgetId);
|
|
1304
|
-
};
|
|
1305
|
-
const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
|
|
1306
|
-
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1307
|
-
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1308
|
-
};
|
|
1309
|
-
const sendMessagePortToSearchProcess = async port => {
|
|
1310
|
-
await invokeAndTransfer$2('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1311
|
-
};
|
|
1312
|
-
const confirm = async (message, options) => {
|
|
1313
|
-
// @ts-ignore
|
|
1314
|
-
const result = await invoke$b('ConfirmPrompt.prompt', message, options);
|
|
1315
|
-
return result;
|
|
1316
|
-
};
|
|
1317
|
-
const getRecentlyOpened = async () => {
|
|
1318
|
-
return invoke$b(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
1319
|
-
};
|
|
1320
|
-
const getKeyBindings$1 = async () => {
|
|
1321
|
-
return invoke$b('KeyBindingsInitial.getKeyBindings');
|
|
1322
|
-
};
|
|
1323
|
-
const writeClipBoardText = async text => {
|
|
1324
|
-
await invoke$b('ClipBoard.writeText', /* text */text);
|
|
1325
|
-
};
|
|
1326
|
-
const writeClipBoardImage = async blob => {
|
|
1327
|
-
// @ts-ignore
|
|
1328
|
-
await invoke$b('ClipBoard.writeImage', /* text */blob);
|
|
1329
|
-
};
|
|
1330
|
-
const searchFileMemory = async uri => {
|
|
1331
|
-
// @ts-ignore
|
|
1332
|
-
return invoke$b('ExtensionHost.searchFileWithMemory', uri);
|
|
1333
|
-
};
|
|
1334
|
-
const searchFileFetch = async uri => {
|
|
1335
|
-
return invoke$b('ExtensionHost.searchFileWithFetch', uri);
|
|
1336
|
-
};
|
|
1337
|
-
const showMessageBox = async options => {
|
|
1338
|
-
return invoke$b('ElectronDialog.showMessageBox', options);
|
|
1339
|
-
};
|
|
1340
|
-
const handleDebugResumed = async params => {
|
|
1341
|
-
await invoke$b('Run And Debug.handleResumed', params);
|
|
1342
|
-
};
|
|
1343
|
-
const openWidget = async name => {
|
|
1344
|
-
await invoke$b('Viewlet.openWidget', name);
|
|
1345
|
-
};
|
|
1346
|
-
const getIcons = async requests => {
|
|
1347
|
-
const icons = await invoke$b('IconTheme.getIcons', requests);
|
|
1348
|
-
return icons;
|
|
1349
|
-
};
|
|
1350
|
-
const activateByEvent$1 = event => {
|
|
1351
|
-
return invoke$b('ExtensionHostManagement.activateByEvent', event);
|
|
1352
|
-
};
|
|
1353
|
-
const setAdditionalFocus = focusKey => {
|
|
1354
|
-
// @ts-ignore
|
|
1355
|
-
return invoke$b('Focus.setAdditionalFocus', focusKey);
|
|
1356
|
-
};
|
|
1357
|
-
const getActiveEditorId = () => {
|
|
1358
|
-
// @ts-ignore
|
|
1359
|
-
return invoke$b('GetActiveEditor.getActiveEditorId');
|
|
1360
|
-
};
|
|
1361
|
-
const getWorkspacePath = () => {
|
|
1362
|
-
return invoke$b('Workspace.getPath');
|
|
1363
|
-
};
|
|
1364
|
-
const sendMessagePortToRendererProcess = async port => {
|
|
1365
|
-
const command = 'HandleMessagePort.handleMessagePort';
|
|
1366
|
-
// @ts-ignore
|
|
1367
|
-
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
|
|
1368
|
-
};
|
|
1369
|
-
const getPreference = async key => {
|
|
1370
|
-
return await invoke$b('Preferences.get', key);
|
|
1371
|
-
};
|
|
1372
|
-
const getAllExtensions = async () => {
|
|
1373
|
-
return invoke$b('ExtensionManagement.getAllExtensions');
|
|
1374
|
-
};
|
|
1375
|
-
const rerenderEditor = async key => {
|
|
1376
|
-
// @ts-ignore
|
|
1377
|
-
return invoke$b('Editor.rerender', key);
|
|
1378
|
-
};
|
|
1379
|
-
const handleDebugPaused = async params => {
|
|
1380
|
-
await invoke$b('Run And Debug.handlePaused', params);
|
|
1381
|
-
};
|
|
1382
|
-
const openUri = async (uri, focus, options) => {
|
|
1383
|
-
await invoke$b('Main.openUri', uri, focus, options);
|
|
1384
|
-
};
|
|
1385
|
-
const sendMessagePortToSyntaxHighlightingWorker$1 = async port => {
|
|
1386
|
-
await invokeAndTransfer$2(
|
|
1387
|
-
// @ts-ignore
|
|
1388
|
-
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1389
|
-
};
|
|
1390
|
-
const handleDebugScriptParsed = async script => {
|
|
1391
|
-
await invoke$b('Run And Debug.handleScriptParsed', script);
|
|
1392
|
-
};
|
|
1393
|
-
const getWindowId = async () => {
|
|
1394
|
-
return invoke$b('GetWindowId.getWindowId');
|
|
1395
|
-
};
|
|
1396
|
-
const getBlob = async uri => {
|
|
1397
|
-
// @ts-ignore
|
|
1398
|
-
return invoke$b('FileSystem.getBlob', uri);
|
|
1399
|
-
};
|
|
1400
|
-
const getExtensionCommands = async () => {
|
|
1401
|
-
return invoke$b('ExtensionHost.getCommands');
|
|
1402
|
-
};
|
|
1403
|
-
const showErrorDialog = async errorInfo => {
|
|
1404
|
-
// @ts-ignore
|
|
1405
|
-
await invoke$b('ErrorHandling.showErrorDialog', errorInfo);
|
|
1406
|
-
};
|
|
1407
|
-
const getFolderSize = async uri => {
|
|
1408
|
-
// @ts-ignore
|
|
1409
|
-
return await invoke$b('FileSystem.getFolderSize', uri);
|
|
1410
|
-
};
|
|
1411
|
-
const getExtension = async id => {
|
|
1412
|
-
// @ts-ignore
|
|
1413
|
-
return invoke$b('ExtensionManagement.getExtension', id);
|
|
1414
|
-
};
|
|
1415
|
-
const getMarkdownDom = async html => {
|
|
1416
|
-
// @ts-ignore
|
|
1417
|
-
return invoke$b('Markdown.getVirtualDom', html);
|
|
1418
|
-
};
|
|
1419
|
-
const renderMarkdown = async (markdown, options) => {
|
|
1420
|
-
// @ts-ignore
|
|
1421
|
-
return invoke$b('Markdown.renderMarkdown', markdown, options);
|
|
1422
|
-
};
|
|
1423
|
-
const openNativeFolder = async uri => {
|
|
1424
|
-
// @ts-ignore
|
|
1425
|
-
await invoke$b('OpenNativeFolder.openNativeFolder', uri);
|
|
1426
|
-
};
|
|
1427
|
-
const uninstallExtension = async id => {
|
|
1428
|
-
return invoke$b('ExtensionManagement.uninstall', id);
|
|
1429
|
-
};
|
|
1430
|
-
const installExtension = async id => {
|
|
1431
|
-
// @ts-ignore
|
|
1432
|
-
return invoke$b('ExtensionManagement.install', id);
|
|
1433
|
-
};
|
|
1434
|
-
const openExtensionSearch = async () => {
|
|
1435
|
-
// @ts-ignore
|
|
1436
|
-
return invoke$b('SideBar.openViewlet', 'Extensions');
|
|
1437
|
-
};
|
|
1438
|
-
const setExtensionsSearchValue = async searchValue => {
|
|
1439
|
-
// @ts-ignore
|
|
1440
|
-
return invoke$b('Extensions.handleInput', searchValue);
|
|
1441
|
-
};
|
|
1442
|
-
const openExternal = async uri => {
|
|
1443
|
-
// @ts-ignore
|
|
1444
|
-
await invoke$b('Open.openExternal', uri);
|
|
1445
|
-
};
|
|
1446
|
-
const openUrl = async uri => {
|
|
1447
|
-
// @ts-ignore
|
|
1448
|
-
await invoke$b('Open.openUrl', uri);
|
|
1449
|
-
};
|
|
1450
|
-
const getAllPreferences = async () => {
|
|
1451
|
-
// @ts-ignore
|
|
1452
|
-
return invoke$b('Preferences.getAll');
|
|
1453
|
-
};
|
|
1454
|
-
const showSaveFilePicker = async () => {
|
|
1455
|
-
// @ts-ignore
|
|
1456
|
-
return invoke$b('FilePicker.showSaveFilePicker');
|
|
1457
|
-
};
|
|
1458
|
-
const getLogsDir = async () => {
|
|
1459
|
-
// @ts-ignore
|
|
1460
|
-
return invoke$b('PlatformPaths.getLogsDir');
|
|
1461
|
-
};
|
|
1462
|
-
const registerMockRpc = commandMap => {
|
|
1463
|
-
const mockRpc = createMockRpc({
|
|
1464
|
-
commandMap
|
|
1465
|
-
});
|
|
1466
|
-
set$a(mockRpc);
|
|
1467
|
-
return mockRpc;
|
|
1468
|
-
};
|
|
1469
|
-
|
|
1470
|
-
const RendererWorker = {
|
|
1471
|
-
__proto__: null,
|
|
1472
|
-
activateByEvent: activateByEvent$1,
|
|
1473
|
-
applyBulkReplacement,
|
|
1474
|
-
closeWidget,
|
|
1475
|
-
confirm,
|
|
1476
|
-
disableExtension,
|
|
1477
|
-
dispose: dispose$2,
|
|
1478
|
-
enableExtension,
|
|
1479
|
-
getActiveEditorId,
|
|
1480
|
-
getAllExtensions,
|
|
1481
|
-
getAllPreferences,
|
|
1482
|
-
getBlob,
|
|
1483
|
-
getChromeVersion,
|
|
1484
|
-
getColorThemeNames,
|
|
1485
|
-
getElectronVersion,
|
|
1486
|
-
getExtension,
|
|
1487
|
-
getExtensionCommands,
|
|
1488
|
-
getFileHandles,
|
|
1489
|
-
getFileIcon,
|
|
1490
|
-
getFilePathElectron,
|
|
1491
|
-
getFolderIcon,
|
|
1492
|
-
getFolderSize,
|
|
1493
|
-
getIcons,
|
|
1494
|
-
getKeyBindings: getKeyBindings$1,
|
|
1495
|
-
getLogsDir,
|
|
1496
|
-
getMarkdownDom,
|
|
1497
|
-
getNodeVersion,
|
|
1498
|
-
getPreference,
|
|
1499
|
-
getRecentlyOpened,
|
|
1500
|
-
getV8Version,
|
|
1501
|
-
getWebViewSecret,
|
|
1502
|
-
getWindowId,
|
|
1503
|
-
getWorkspacePath,
|
|
1504
|
-
handleDebugChange,
|
|
1505
|
-
handleDebugPaused,
|
|
1506
|
-
handleDebugResumed,
|
|
1507
|
-
handleDebugScriptParsed,
|
|
1508
|
-
installExtension,
|
|
1509
|
-
invoke: invoke$b,
|
|
1510
|
-
invokeAndTransfer: invokeAndTransfer$2,
|
|
1511
|
-
openExtensionSearch,
|
|
1512
|
-
openExternal,
|
|
1513
|
-
openNativeFolder,
|
|
1514
|
-
openUri,
|
|
1515
|
-
openUrl,
|
|
1516
|
-
openWidget,
|
|
1517
|
-
readFile,
|
|
1518
1211
|
registerMockRpc,
|
|
1519
|
-
|
|
1520
|
-
renderMarkdown,
|
|
1521
|
-
rerenderEditor,
|
|
1522
|
-
searchFileFetch,
|
|
1523
|
-
searchFileHtml,
|
|
1524
|
-
searchFileMemory,
|
|
1525
|
-
sendMessagePortToEditorWorker,
|
|
1526
|
-
sendMessagePortToErrorWorker,
|
|
1527
|
-
sendMessagePortToExtensionHostWorker,
|
|
1528
|
-
sendMessagePortToFileSystemWorker,
|
|
1529
|
-
sendMessagePortToIconThemeWorker,
|
|
1530
|
-
sendMessagePortToMarkdownWorker,
|
|
1531
|
-
sendMessagePortToRendererProcess,
|
|
1532
|
-
sendMessagePortToSearchProcess,
|
|
1533
|
-
sendMessagePortToSyntaxHighlightingWorker: sendMessagePortToSyntaxHighlightingWorker$1,
|
|
1534
|
-
set: set$a,
|
|
1535
|
-
setAdditionalFocus,
|
|
1536
|
-
setColorTheme,
|
|
1537
|
-
setExtensionsSearchValue,
|
|
1538
|
-
setFocus: setFocus$1,
|
|
1539
|
-
setWebViewPort,
|
|
1540
|
-
setWorkspacePath,
|
|
1541
|
-
showContextMenu,
|
|
1542
|
-
showErrorDialog,
|
|
1543
|
-
showMessageBox,
|
|
1544
|
-
showSaveFilePicker,
|
|
1545
|
-
uninstallExtension,
|
|
1546
|
-
unregisterWebViewInterceptor,
|
|
1547
|
-
writeClipBoardImage,
|
|
1548
|
-
writeClipBoardText
|
|
1212
|
+
set: set$a
|
|
1549
1213
|
};
|
|
1550
1214
|
|
|
1551
1215
|
const {
|
|
1552
1216
|
invoke: invoke$a,
|
|
1553
1217
|
invokeAndTransfer: invokeAndTransfer$1,
|
|
1554
|
-
set: set$9
|
|
1218
|
+
set: set$9} = create$9(RendererWorker);
|
|
1219
|
+
|
|
1220
|
+
const {
|
|
1221
|
+
invoke: invoke$9,
|
|
1222
|
+
invokeAndTransfer,
|
|
1223
|
+
set: set$8,
|
|
1555
1224
|
dispose: dispose$1
|
|
1556
1225
|
} = create$9(MarkdownWorker);
|
|
1557
1226
|
|
|
1558
1227
|
const SyntaxHighlightingWorker = {
|
|
1559
1228
|
__proto__: null,
|
|
1560
1229
|
dispose: dispose$1,
|
|
1561
|
-
invoke: invoke$
|
|
1562
|
-
invokeAndTransfer
|
|
1563
|
-
set: set$
|
|
1230
|
+
invoke: invoke$9,
|
|
1231
|
+
invokeAndTransfer,
|
|
1232
|
+
set: set$8
|
|
1564
1233
|
};
|
|
1565
1234
|
|
|
1566
|
-
const {
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1235
|
+
const createLazyRpc = rpcId => {
|
|
1236
|
+
let rpcPromise;
|
|
1237
|
+
let factory;
|
|
1238
|
+
const createRpc = async () => {
|
|
1239
|
+
const rpc = await factory();
|
|
1240
|
+
set$b(rpcId, rpc);
|
|
1241
|
+
};
|
|
1242
|
+
const ensureRpc = async () => {
|
|
1243
|
+
if (!rpcPromise) {
|
|
1244
|
+
rpcPromise = createRpc();
|
|
1245
|
+
}
|
|
1246
|
+
await rpcPromise;
|
|
1247
|
+
};
|
|
1248
|
+
return {
|
|
1249
|
+
setFactory(value) {
|
|
1250
|
+
factory = value;
|
|
1251
|
+
},
|
|
1252
|
+
async invoke(method, ...params) {
|
|
1253
|
+
await ensureRpc();
|
|
1254
|
+
const rpc = get$7(rpcId);
|
|
1255
|
+
return rpc.invoke(method, ...params);
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
};
|
|
1571
1259
|
|
|
1572
1260
|
// TODO add tests for this
|
|
1573
1261
|
const activateByEvent = async event => {
|
|
1574
|
-
await invoke$
|
|
1262
|
+
await invoke$a('ExtensionHostManagement.activateByEvent', event);
|
|
1575
1263
|
};
|
|
1576
1264
|
|
|
1577
1265
|
const codeGeneratorAccept = state => {
|
|
@@ -1599,7 +1287,7 @@ const launchWorker = async (name, url, intializeCommand) => {
|
|
|
1599
1287
|
port2
|
|
1600
1288
|
} = getPortTuple();
|
|
1601
1289
|
// @ts-ignore
|
|
1602
|
-
await invokeAndTransfer('IpcParent.create', {
|
|
1290
|
+
await invokeAndTransfer$1('IpcParent.create', {
|
|
1603
1291
|
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
1604
1292
|
url,
|
|
1605
1293
|
name: name,
|
|
@@ -1624,15 +1312,15 @@ const launchColorPickerWorker = async () => {
|
|
|
1624
1312
|
return launchWorker(name, url);
|
|
1625
1313
|
};
|
|
1626
1314
|
|
|
1627
|
-
let workerPromise$
|
|
1628
|
-
const getOrCreate$
|
|
1629
|
-
if (!workerPromise$
|
|
1630
|
-
workerPromise$
|
|
1315
|
+
let workerPromise$3;
|
|
1316
|
+
const getOrCreate$4 = () => {
|
|
1317
|
+
if (!workerPromise$3) {
|
|
1318
|
+
workerPromise$3 = launchColorPickerWorker();
|
|
1631
1319
|
}
|
|
1632
|
-
return workerPromise$
|
|
1320
|
+
return workerPromise$3;
|
|
1633
1321
|
};
|
|
1634
1322
|
const invoke$8 = async (method, ...params) => {
|
|
1635
|
-
const worker = await getOrCreate$
|
|
1323
|
+
const worker = await getOrCreate$4();
|
|
1636
1324
|
return await worker.invoke(method, ...params);
|
|
1637
1325
|
};
|
|
1638
1326
|
|
|
@@ -1676,28 +1364,26 @@ const map$1 = Object.create(null);
|
|
|
1676
1364
|
const set$7 = (id, widget) => {
|
|
1677
1365
|
map$1[id] = widget;
|
|
1678
1366
|
};
|
|
1679
|
-
const get$
|
|
1367
|
+
const get$6 = id => {
|
|
1680
1368
|
return map$1[id];
|
|
1681
1369
|
};
|
|
1682
1370
|
|
|
1683
1371
|
const getModule = id => {
|
|
1684
|
-
return get$
|
|
1372
|
+
return get$6(id);
|
|
1685
1373
|
};
|
|
1686
1374
|
|
|
1687
1375
|
const applyWidgetChange = async (editor, widget, changes) => {
|
|
1688
1376
|
const module = getModule(widget.id);
|
|
1689
1377
|
if (changes.length === 1 && changes[0].origin === EditorType && module.handleEditorType) {
|
|
1690
|
-
const newState = await module.handleEditorType(
|
|
1378
|
+
const newState = await module.handleEditorType(editor);
|
|
1691
1379
|
return {
|
|
1692
|
-
...
|
|
1693
|
-
newState
|
|
1380
|
+
...newState
|
|
1694
1381
|
};
|
|
1695
1382
|
}
|
|
1696
1383
|
if (changes.length === 1 && changes[0].origin === DeleteLeft && module.handleEditorDeleteLeft) {
|
|
1697
|
-
const newState = await module.handleEditorDeleteLeft(
|
|
1384
|
+
const newState = await module.handleEditorDeleteLeft(editor);
|
|
1698
1385
|
return {
|
|
1699
|
-
...
|
|
1700
|
-
newState
|
|
1386
|
+
...newState
|
|
1701
1387
|
};
|
|
1702
1388
|
}
|
|
1703
1389
|
return widget;
|
|
@@ -1708,18 +1394,15 @@ const applyWidgetChanges = async (editor, changes) => {
|
|
|
1708
1394
|
if (widgets.length === 0) {
|
|
1709
1395
|
return widgets;
|
|
1710
1396
|
}
|
|
1711
|
-
|
|
1397
|
+
let latestEditor = editor;
|
|
1712
1398
|
for (const widget of widgets) {
|
|
1713
|
-
|
|
1714
|
-
if (newWidget.newState) {
|
|
1715
|
-
newWidgets.push(newWidget);
|
|
1716
|
-
}
|
|
1399
|
+
latestEditor = await applyWidgetChange(editor, widget, changes);
|
|
1717
1400
|
}
|
|
1718
|
-
return
|
|
1401
|
+
return latestEditor;
|
|
1719
1402
|
};
|
|
1720
1403
|
|
|
1721
1404
|
const editors = Object.create(null);
|
|
1722
|
-
const get$
|
|
1405
|
+
const get$5 = id => {
|
|
1723
1406
|
number(id);
|
|
1724
1407
|
return editors[id];
|
|
1725
1408
|
};
|
|
@@ -1944,7 +1627,7 @@ const has = languageId => {
|
|
|
1944
1627
|
const set$4 = (languageId, tokenizer) => {
|
|
1945
1628
|
state$7.tokenizers[languageId] = tokenizer;
|
|
1946
1629
|
};
|
|
1947
|
-
const get$
|
|
1630
|
+
const get$4 = languageId => {
|
|
1948
1631
|
return state$7.tokenizers[languageId];
|
|
1949
1632
|
};
|
|
1950
1633
|
const isPending = languageId => {
|
|
@@ -1955,7 +1638,7 @@ const tokenMaps = Object.create(null);
|
|
|
1955
1638
|
const set$3 = (languageId, tokenMap) => {
|
|
1956
1639
|
tokenMaps[languageId] = tokenMap;
|
|
1957
1640
|
};
|
|
1958
|
-
const get$
|
|
1641
|
+
const get$3 = languageId => {
|
|
1959
1642
|
return tokenMaps[languageId] || {};
|
|
1960
1643
|
};
|
|
1961
1644
|
|
|
@@ -1992,7 +1675,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
1992
1675
|
};
|
|
1993
1676
|
const getTokenizer = languageId => {
|
|
1994
1677
|
if (has(languageId)) {
|
|
1995
|
-
return get$
|
|
1678
|
+
return get$4(languageId);
|
|
1996
1679
|
}
|
|
1997
1680
|
if (isPending(languageId)) {
|
|
1998
1681
|
return TokenizePlainText;
|
|
@@ -2004,7 +1687,7 @@ const tokenizers = Object.create(null);
|
|
|
2004
1687
|
const set$2 = (id, value) => {
|
|
2005
1688
|
tokenizers[id] = value;
|
|
2006
1689
|
};
|
|
2007
|
-
const get$
|
|
1690
|
+
const get$2 = id => {
|
|
2008
1691
|
return tokenizers[id] || TokenizePlainText;
|
|
2009
1692
|
};
|
|
2010
1693
|
|
|
@@ -2074,7 +1757,7 @@ const getTokensViewport = (editor, startLineIndex, endLineIndex) => {
|
|
|
2074
1757
|
lines,
|
|
2075
1758
|
languageId
|
|
2076
1759
|
} = editor;
|
|
2077
|
-
const tokenizer = get$
|
|
1760
|
+
const tokenizer = get$2(tokenizerId);
|
|
2078
1761
|
const {
|
|
2079
1762
|
hasArrayReturn,
|
|
2080
1763
|
tokenizeLine,
|
|
@@ -2160,11 +1843,12 @@ const loadTokenizers = async languageIds => {
|
|
|
2160
1843
|
}
|
|
2161
1844
|
};
|
|
2162
1845
|
|
|
1846
|
+
const Dot = '.';
|
|
1847
|
+
const DoubleQuote$1 = '"';
|
|
2163
1848
|
const EmptyString = '';
|
|
2164
1849
|
const NewLine = '\n';
|
|
2165
1850
|
const Space = ' ';
|
|
2166
1851
|
const Tab = '\t';
|
|
2167
|
-
const DoubleQuote$1 = '"';
|
|
2168
1852
|
|
|
2169
1853
|
const normalizeText = (text, normalize, tabSize) => {
|
|
2170
1854
|
if (normalize) {
|
|
@@ -2543,7 +2227,7 @@ const getLineInfosViewport = (editor, tokens, embeddedResults, minLineY, maxLine
|
|
|
2543
2227
|
decorations,
|
|
2544
2228
|
languageId
|
|
2545
2229
|
} = editor;
|
|
2546
|
-
const tokenMap = get$
|
|
2230
|
+
const tokenMap = get$3(languageId);
|
|
2547
2231
|
let offset = minLineOffset;
|
|
2548
2232
|
const tabSize = 2;
|
|
2549
2233
|
for (let i = minLineY; i < maxLineY; i++) {
|
|
@@ -2775,7 +2459,7 @@ const createMeasureContext = () => {
|
|
|
2775
2459
|
const state$6 = {
|
|
2776
2460
|
ctx: undefined
|
|
2777
2461
|
};
|
|
2778
|
-
const getOrCreate$
|
|
2462
|
+
const getOrCreate$3 = createCtx => {
|
|
2779
2463
|
if (state$6.ctx) {
|
|
2780
2464
|
return state$6.ctx;
|
|
2781
2465
|
}
|
|
@@ -2784,7 +2468,7 @@ const getOrCreate$4 = createCtx => {
|
|
|
2784
2468
|
};
|
|
2785
2469
|
|
|
2786
2470
|
const getContext = () => {
|
|
2787
|
-
const ctx = getOrCreate$
|
|
2471
|
+
const ctx = getOrCreate$3(createMeasureContext);
|
|
2788
2472
|
return ctx;
|
|
2789
2473
|
};
|
|
2790
2474
|
|
|
@@ -3177,10 +2861,10 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
3177
2861
|
};
|
|
3178
2862
|
set$6(editor.uid, editor, newEditor);
|
|
3179
2863
|
const incrementalEdits = await getIncrementalEdits(editor, newEditor);
|
|
3180
|
-
const
|
|
2864
|
+
const editorWithNewWidgets = await applyWidgetChanges(newEditor, changes);
|
|
3181
2865
|
const newEditor2 = {
|
|
3182
2866
|
...newEditor,
|
|
3183
|
-
|
|
2867
|
+
...editorWithNewWidgets,
|
|
3184
2868
|
incrementalEdits
|
|
3185
2869
|
};
|
|
3186
2870
|
if (incrementalEdits !== emptyIncrementalEdits) {
|
|
@@ -3342,6 +3026,36 @@ const setText = (editor, text) => {
|
|
|
3342
3026
|
};
|
|
3343
3027
|
};
|
|
3344
3028
|
|
|
3029
|
+
const emptyEditor = {
|
|
3030
|
+
textInfos: [],
|
|
3031
|
+
differences: [],
|
|
3032
|
+
uri: '',
|
|
3033
|
+
languageId: '',
|
|
3034
|
+
// TODO use numeric language id?
|
|
3035
|
+
lines: [],
|
|
3036
|
+
x: 0,
|
|
3037
|
+
y: 0,
|
|
3038
|
+
width: 0,
|
|
3039
|
+
height: 0,
|
|
3040
|
+
tokenizerId: 0,
|
|
3041
|
+
minLineY: 0,
|
|
3042
|
+
decorations: [],
|
|
3043
|
+
embeds: [],
|
|
3044
|
+
deltaX: 0,
|
|
3045
|
+
focused: false,
|
|
3046
|
+
deltaY: 0,
|
|
3047
|
+
scrollBarHeight: 0,
|
|
3048
|
+
longestLineWidth: 0,
|
|
3049
|
+
maxLineY: 0,
|
|
3050
|
+
undoStack: [],
|
|
3051
|
+
lineCache: [],
|
|
3052
|
+
selections: new Uint32Array(),
|
|
3053
|
+
diagnostics: [],
|
|
3054
|
+
highlightedLine: -1,
|
|
3055
|
+
debugEnabled: false,
|
|
3056
|
+
incrementalEdits: emptyIncrementalEdits
|
|
3057
|
+
};
|
|
3058
|
+
|
|
3345
3059
|
const HoverExecute = 'ExtensionHostHover.execute';
|
|
3346
3060
|
const TabCompletionExecuteTabCompletionProvider = 'ExtensionHost.executeTabCompletionProvider';
|
|
3347
3061
|
const TextDocumentSyncFull = 'ExtensionHostTextDocument.syncFull';
|
|
@@ -3359,10 +3073,73 @@ const FocusEditorRename$1 = 11;
|
|
|
3359
3073
|
const SourceActions = 38;
|
|
3360
3074
|
const FocusCodeGenerator = 52;
|
|
3361
3075
|
|
|
3076
|
+
const getFileExtensionIndex = file => {
|
|
3077
|
+
string(file);
|
|
3078
|
+
return file.lastIndexOf(Dot);
|
|
3079
|
+
};
|
|
3080
|
+
const getNthFileExtension = (file, startIndex) => {
|
|
3081
|
+
return file.lastIndexOf(Dot, startIndex);
|
|
3082
|
+
};
|
|
3083
|
+
|
|
3084
|
+
// TODO merge all of this with extension host languages module
|
|
3085
|
+
|
|
3086
|
+
const getLanguageByExtension = (languages, extensionLower) => {
|
|
3087
|
+
for (const language of languages) {
|
|
3088
|
+
if (language && language.extensions && Array.isArray(language.extensions) && language.extensions.includes(extensionLower)) {
|
|
3089
|
+
return language.id;
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
return '';
|
|
3093
|
+
};
|
|
3094
|
+
const getLanguageByFileName = (languages, fileNameLower) => {
|
|
3095
|
+
for (const language of languages) {
|
|
3096
|
+
if (language && language.fileNames && Array.isArray(language.fileNames) && language.fileNames.includes(fileNameLower)) {
|
|
3097
|
+
return language.id;
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
return '';
|
|
3101
|
+
};
|
|
3102
|
+
const getLanguageId$1 = (uri, languages) => {
|
|
3103
|
+
string(uri);
|
|
3104
|
+
// TODO this is inefficient for icon theme, as file extension is computed twice
|
|
3105
|
+
// maybe icon theme should get a slimmed down version of languages so that it can internally compute
|
|
3106
|
+
// the language id
|
|
3107
|
+
const extensionIndex = getFileExtensionIndex(uri);
|
|
3108
|
+
const extension = uri.slice(extensionIndex);
|
|
3109
|
+
const extensionLower = extension.toLowerCase();
|
|
3110
|
+
const candidate1 = getLanguageByExtension(languages, extensionLower);
|
|
3111
|
+
if (candidate1) {
|
|
3112
|
+
return candidate1;
|
|
3113
|
+
}
|
|
3114
|
+
const fileNameLower = uri.toLowerCase();
|
|
3115
|
+
const secondExtensionIndex = getNthFileExtension(uri, extensionIndex - 1);
|
|
3116
|
+
const secondExtension = uri.slice(secondExtensionIndex);
|
|
3117
|
+
const candidate2 = getLanguageByExtension(languages, secondExtension);
|
|
3118
|
+
if (candidate2) {
|
|
3119
|
+
return candidate2;
|
|
3120
|
+
}
|
|
3121
|
+
const candidate3 = getLanguageByFileName(languages, fileNameLower);
|
|
3122
|
+
if (candidate3) {
|
|
3123
|
+
return candidate3;
|
|
3124
|
+
}
|
|
3125
|
+
return 'unknown';
|
|
3126
|
+
};
|
|
3127
|
+
|
|
3128
|
+
const getLanguages = async () => {
|
|
3129
|
+
// @ts-ignore
|
|
3130
|
+
const languages = await invoke$6('Languages.getLanguages');
|
|
3131
|
+
return languages;
|
|
3132
|
+
};
|
|
3133
|
+
|
|
3362
3134
|
const measureCharacterWidth = (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
3363
3135
|
return measureTextWidth('a', fontWeight, fontSize, fontFamily, letterSpacing, false, 0);
|
|
3364
3136
|
};
|
|
3365
3137
|
|
|
3138
|
+
const get$1 = async key => {
|
|
3139
|
+
const value = await invoke$a('Preferences.get', key);
|
|
3140
|
+
return value;
|
|
3141
|
+
};
|
|
3142
|
+
|
|
3366
3143
|
const OnDiagnostic = 'onDiagnostic';
|
|
3367
3144
|
const OnHover = 'onHover';
|
|
3368
3145
|
const OnTabCompletion = 'onTabCompletion';
|
|
@@ -3447,7 +3224,7 @@ const updateDiagnostics = async newState => {
|
|
|
3447
3224
|
// @ts-ignore
|
|
3448
3225
|
await invoke$6(TextDocumentSyncFull, newState.uri, newState.id, newState.languageId, content);
|
|
3449
3226
|
const diagnostics = await executeDiagnosticProvider(newState);
|
|
3450
|
-
const latest = get$
|
|
3227
|
+
const latest = get$5(newState.id);
|
|
3451
3228
|
if (!latest) {
|
|
3452
3229
|
return newState;
|
|
3453
3230
|
}
|
|
@@ -3459,46 +3236,18 @@ const updateDiagnostics = async newState => {
|
|
|
3459
3236
|
};
|
|
3460
3237
|
set$6(newState.id, latest.oldState, newEditor);
|
|
3461
3238
|
// @ts-ignore
|
|
3462
|
-
await invoke$
|
|
3239
|
+
await invoke$a('Editor.rerender', newState.id);
|
|
3463
3240
|
return newEditor;
|
|
3464
3241
|
} catch (error) {
|
|
3465
3242
|
// @ts-ignore
|
|
3466
3243
|
if (error && error.message.includes('No diagnostic provider found')) {
|
|
3467
|
-
return;
|
|
3244
|
+
return newState;
|
|
3468
3245
|
}
|
|
3469
3246
|
console.error(`Failed to update diagnostics: ${error}`);
|
|
3247
|
+
return newState;
|
|
3470
3248
|
}
|
|
3471
3249
|
};
|
|
3472
3250
|
|
|
3473
|
-
const emptyEditor = {
|
|
3474
|
-
textInfos: [],
|
|
3475
|
-
differences: [],
|
|
3476
|
-
uri: '',
|
|
3477
|
-
languageId: '',
|
|
3478
|
-
// TODO use numeric language id?
|
|
3479
|
-
lines: [],
|
|
3480
|
-
x: 0,
|
|
3481
|
-
y: 0,
|
|
3482
|
-
width: 0,
|
|
3483
|
-
height: 0,
|
|
3484
|
-
tokenizerId: 0,
|
|
3485
|
-
minLineY: 0,
|
|
3486
|
-
decorations: [],
|
|
3487
|
-
embeds: [],
|
|
3488
|
-
deltaX: 0,
|
|
3489
|
-
focused: false,
|
|
3490
|
-
deltaY: 0,
|
|
3491
|
-
scrollBarHeight: 0,
|
|
3492
|
-
longestLineWidth: 0,
|
|
3493
|
-
maxLineY: 0,
|
|
3494
|
-
undoStack: [],
|
|
3495
|
-
lineCache: [],
|
|
3496
|
-
selections: new Uint32Array(),
|
|
3497
|
-
diagnostics: [],
|
|
3498
|
-
highlightedLine: -1,
|
|
3499
|
-
debugEnabled: false,
|
|
3500
|
-
incrementalEdits: emptyIncrementalEdits
|
|
3501
|
-
};
|
|
3502
3251
|
const createEditor = async ({
|
|
3503
3252
|
id,
|
|
3504
3253
|
content,
|
|
@@ -3532,67 +3281,71 @@ const createEditor = async ({
|
|
|
3532
3281
|
}) => {
|
|
3533
3282
|
number(id);
|
|
3534
3283
|
string(content);
|
|
3284
|
+
// TODO support overwriting language id by setting it explicitly or via settings
|
|
3535
3285
|
const charWidth = measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing);
|
|
3286
|
+
const languages = await getLanguages();
|
|
3287
|
+
const computedlanguageId = getLanguageId$1(uri, languages);
|
|
3536
3288
|
const editor = {
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
isAutoClosingTagsEnabled,
|
|
3541
|
-
isAutoClosingQuotesEnabled,
|
|
3542
|
-
isQuickSuggestionsEnabled,
|
|
3289
|
+
charWidth,
|
|
3290
|
+
columnWidth: 0,
|
|
3291
|
+
completionState: '',
|
|
3543
3292
|
completionTriggerCharacters,
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
x,
|
|
3547
|
-
y,
|
|
3548
|
-
width,
|
|
3549
|
-
height,
|
|
3550
|
-
tokenizerId: 0,
|
|
3551
|
-
minLineY: 0,
|
|
3552
|
-
maxLineY: 0,
|
|
3553
|
-
lines: [],
|
|
3554
|
-
undoStack: [],
|
|
3555
|
-
lineCache: [],
|
|
3556
|
-
selections: new Uint32Array(),
|
|
3557
|
-
diagnostics: [],
|
|
3293
|
+
completionUid: 0,
|
|
3294
|
+
cursorWidth: 2,
|
|
3558
3295
|
decorations: [],
|
|
3559
|
-
primarySelectionIndex: 0,
|
|
3560
3296
|
deltaX: 0,
|
|
3561
3297
|
deltaY: 0,
|
|
3562
|
-
|
|
3563
|
-
|
|
3298
|
+
diagnostics: [],
|
|
3299
|
+
diagnosticsEnabled,
|
|
3300
|
+
differences: [],
|
|
3564
3301
|
finalDeltaY: 0,
|
|
3565
|
-
|
|
3566
|
-
rowHeight,
|
|
3567
|
-
scrollBarWidth: 0,
|
|
3568
|
-
scrollBarHeight: 0,
|
|
3569
|
-
validLines: [],
|
|
3570
|
-
invalidStartIndex: 0,
|
|
3302
|
+
finalY: 0,
|
|
3571
3303
|
focused: false,
|
|
3572
|
-
|
|
3573
|
-
itemHeight: 20,
|
|
3304
|
+
focusKey: Empty,
|
|
3574
3305
|
fontFamily,
|
|
3575
|
-
fontWeight,
|
|
3576
|
-
tabSize,
|
|
3577
3306
|
fontSize,
|
|
3578
|
-
|
|
3579
|
-
|
|
3307
|
+
fontWeight,
|
|
3308
|
+
handleOffsetX: 0,
|
|
3309
|
+
height,
|
|
3310
|
+
id,
|
|
3311
|
+
incrementalEdits: emptyIncrementalEdits,
|
|
3312
|
+
invalidStartIndex: 0,
|
|
3313
|
+
isAutoClosingBracketsEnabled,
|
|
3314
|
+
isAutoClosingQuotesEnabled,
|
|
3315
|
+
isAutoClosingTagsEnabled,
|
|
3316
|
+
isMonospaceFont,
|
|
3317
|
+
isQuickSuggestionsEnabled,
|
|
3318
|
+
itemHeight: 20,
|
|
3319
|
+
languageId: computedlanguageId,
|
|
3320
|
+
letterSpacing,
|
|
3321
|
+
lineCache: [],
|
|
3322
|
+
lineNumbers,
|
|
3323
|
+
lines: [],
|
|
3580
3324
|
longestLineWidth: 0,
|
|
3325
|
+
maxLineY: 0,
|
|
3581
3326
|
minimumSliderSize: 20,
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
lineNumbers,
|
|
3327
|
+
minLineY: 0,
|
|
3328
|
+
numberOfVisiblelines: 0,
|
|
3585
3329
|
numberOfVisibleLines: 0,
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3330
|
+
primarySelectionIndex: 0,
|
|
3331
|
+
rowHeight,
|
|
3332
|
+
savedSelections,
|
|
3333
|
+
scrollBarHeight: 0,
|
|
3334
|
+
scrollBarWidth: 0,
|
|
3335
|
+
selections: new Uint32Array(),
|
|
3336
|
+
tabSize,
|
|
3337
|
+
textInfos: [],
|
|
3338
|
+
tokenizerId: 0,
|
|
3589
3339
|
uid: id,
|
|
3590
|
-
|
|
3340
|
+
undoStack: [],
|
|
3341
|
+
uri,
|
|
3342
|
+
validLines: [],
|
|
3591
3343
|
widgets: [],
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3344
|
+
width,
|
|
3345
|
+
x,
|
|
3346
|
+
y
|
|
3595
3347
|
};
|
|
3348
|
+
|
|
3596
3349
|
// TODO avoid creating intermediate editors here
|
|
3597
3350
|
const newEditor1 = setBounds(editor, x, y, width, height, 9);
|
|
3598
3351
|
const newEditor2 = setText(newEditor1, content);
|
|
@@ -3627,6 +3380,12 @@ const createEditor = async ({
|
|
|
3627
3380
|
if (diagnosticsEnabled) {
|
|
3628
3381
|
await updateDiagnostics(newEditor4);
|
|
3629
3382
|
}
|
|
3383
|
+
const completionsOnTypeRaw = await get$1('editor.completionsOnType');
|
|
3384
|
+
const completionsOnType = Boolean(completionsOnTypeRaw);
|
|
3385
|
+
set$6(id, emptyEditor, {
|
|
3386
|
+
...newEditor4,
|
|
3387
|
+
completionsOnType
|
|
3388
|
+
});
|
|
3630
3389
|
};
|
|
3631
3390
|
|
|
3632
3391
|
// @ts-ignore
|
|
@@ -4019,7 +3778,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, isError
|
|
|
4019
3778
|
const y$1 = y(editor, rowIndex);
|
|
4020
3779
|
const displayErrorMessage = message;
|
|
4021
3780
|
// @ts-ignore
|
|
4022
|
-
await invoke$
|
|
3781
|
+
await invoke$a('Editor.showOverlayMessage', editor, 'Viewlet.send', editor.uid, 'showOverlayMessage', x$1, y$1, displayErrorMessage);
|
|
4023
3782
|
if (!isError) {
|
|
4024
3783
|
const handleTimeout = () => {
|
|
4025
3784
|
editorHideMessage(editor);
|
|
@@ -4076,7 +3835,7 @@ const braceCompletion = async (editor, text) => {
|
|
|
4076
3835
|
// @ts-ignore
|
|
4077
3836
|
const offset = offsetAt(editor, editor.cursor);
|
|
4078
3837
|
// @ts-ignore
|
|
4079
|
-
const result = await invoke$
|
|
3838
|
+
const result = await invoke$a('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
|
|
4080
3839
|
if (result) {
|
|
4081
3840
|
const closingBrace = getMatchingClosingBrace$1(text);
|
|
4082
3841
|
const insertText = text + closingBrace;
|
|
@@ -4166,15 +3925,15 @@ const launchRenameWorker = async () => {
|
|
|
4166
3925
|
return rpc;
|
|
4167
3926
|
};
|
|
4168
3927
|
|
|
4169
|
-
let workerPromise$
|
|
4170
|
-
const getOrCreate$
|
|
4171
|
-
if (!workerPromise$
|
|
4172
|
-
workerPromise$
|
|
3928
|
+
let workerPromise$2;
|
|
3929
|
+
const getOrCreate$2 = () => {
|
|
3930
|
+
if (!workerPromise$2) {
|
|
3931
|
+
workerPromise$2 = launchRenameWorker();
|
|
4173
3932
|
}
|
|
4174
|
-
return workerPromise$
|
|
3933
|
+
return workerPromise$2;
|
|
4175
3934
|
};
|
|
4176
3935
|
const invoke$5 = async (method, ...params) => {
|
|
4177
|
-
const worker = await getOrCreate$
|
|
3936
|
+
const worker = await getOrCreate$2();
|
|
4178
3937
|
return await worker.invoke(method, ...params);
|
|
4179
3938
|
};
|
|
4180
3939
|
|
|
@@ -4193,7 +3952,7 @@ const closeRename = async editor => {
|
|
|
4193
3952
|
}
|
|
4194
3953
|
const renameWidget = widgets[renameWidgetIndex];
|
|
4195
3954
|
await invoke$5('Rename.close', renameWidget.newState.uid);
|
|
4196
|
-
const latest = get$
|
|
3955
|
+
const latest = get$5(uid);
|
|
4197
3956
|
const {
|
|
4198
3957
|
newState
|
|
4199
3958
|
} = latest;
|
|
@@ -4344,7 +4103,7 @@ const compositionEnd = (editor, data) => {
|
|
|
4344
4103
|
const writeText = async text => {
|
|
4345
4104
|
try {
|
|
4346
4105
|
string(text);
|
|
4347
|
-
await invoke$
|
|
4106
|
+
await invoke$a('ClipBoard.writeText', /* text */text);
|
|
4348
4107
|
} catch (error) {
|
|
4349
4108
|
throw new VError(error, 'Failed to write text to clipboard');
|
|
4350
4109
|
}
|
|
@@ -4981,7 +4740,7 @@ const deleteWordRight = editor => {
|
|
|
4981
4740
|
|
|
4982
4741
|
const findAllReferences = async editor => {
|
|
4983
4742
|
// @ts-ignore
|
|
4984
|
-
await invoke$
|
|
4743
|
+
await invoke$a('SideBar.show', 'References', /* focus */true);
|
|
4985
4744
|
return editor;
|
|
4986
4745
|
};
|
|
4987
4746
|
|
|
@@ -5069,7 +4828,7 @@ const getWordBefore = (editor, rowIndex, columnIndex) => {
|
|
|
5069
4828
|
// @ts-ignore
|
|
5070
4829
|
const getDefinition = async (editor, offset) => {
|
|
5071
4830
|
// @ts-ignore
|
|
5072
|
-
const definition = await invoke$
|
|
4831
|
+
const definition = await invoke$a('ExtensionHostDefinition.executeDefinitionProvider', editor, offset);
|
|
5073
4832
|
return definition;
|
|
5074
4833
|
};
|
|
5075
4834
|
|
|
@@ -5248,7 +5007,7 @@ const goTo = async ({
|
|
|
5248
5007
|
endRowIndex: definition.endRowIndex,
|
|
5249
5008
|
endColumnIndex: definition.endColumnIndex
|
|
5250
5009
|
};
|
|
5251
|
-
await invoke$
|
|
5010
|
+
await invoke$a(/* Main.openUri */'Main.openUri', /* uri */uri, /* focus */true, context);
|
|
5252
5011
|
return editor;
|
|
5253
5012
|
} catch (error) {
|
|
5254
5013
|
// TODO if editor is already disposed at this point, do nothing
|
|
@@ -5326,7 +5085,7 @@ const getNoLocationFoundMessage = info => {
|
|
|
5326
5085
|
|
|
5327
5086
|
const getTypeDefinition = async (editor, offset) => {
|
|
5328
5087
|
// @ts-ignore
|
|
5329
|
-
const definition = await invoke$
|
|
5088
|
+
const definition = await invoke$a('ExtensionHostTypeDefinition.executeTypeDefinitionProvider', editor, offset);
|
|
5330
5089
|
return definition;
|
|
5331
5090
|
};
|
|
5332
5091
|
|
|
@@ -5481,7 +5240,7 @@ const handleClickAtPosition = async (editor, modifier, rowIndex, columnIndex) =>
|
|
|
5481
5240
|
const Editor = 3;
|
|
5482
5241
|
|
|
5483
5242
|
const handleContextMenu = async (editor, button, x, y) => {
|
|
5484
|
-
await invoke$
|
|
5243
|
+
await invoke$a(/* ContextMenu.show */'ContextMenu.show', /* x */x, /* y */y, /* id */Editor);
|
|
5485
5244
|
return editor;
|
|
5486
5245
|
};
|
|
5487
5246
|
|
|
@@ -6089,7 +5848,7 @@ const indentMore = editor => {
|
|
|
6089
5848
|
|
|
6090
5849
|
const getLanguageConfiguration = async editor => {
|
|
6091
5850
|
// @ts-ignore
|
|
6092
|
-
return invoke$
|
|
5851
|
+
return invoke$a('Languages.getLanguageConfiguration', {
|
|
6093
5852
|
uri: editor.uri,
|
|
6094
5853
|
languageId: editor.languageId
|
|
6095
5854
|
});
|
|
@@ -6431,25 +6190,10 @@ const create$4 = () => {
|
|
|
6431
6190
|
return completionWidget;
|
|
6432
6191
|
};
|
|
6433
6192
|
|
|
6434
|
-
const
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
const rpc = await launchWorker(name, url, intializeCommand);
|
|
6439
|
-
return rpc;
|
|
6440
|
-
};
|
|
6441
|
-
|
|
6442
|
-
let workerPromise$2;
|
|
6443
|
-
const getOrCreate$2 = () => {
|
|
6444
|
-
if (!workerPromise$2) {
|
|
6445
|
-
workerPromise$2 = launchCompletionWorker();
|
|
6446
|
-
}
|
|
6447
|
-
return workerPromise$2;
|
|
6448
|
-
};
|
|
6449
|
-
const invoke$4 = async (method, ...params) => {
|
|
6450
|
-
const worker = await getOrCreate$2();
|
|
6451
|
-
return await worker.invoke(method, ...params);
|
|
6452
|
-
};
|
|
6193
|
+
const {
|
|
6194
|
+
setFactory,
|
|
6195
|
+
invoke: invoke$4
|
|
6196
|
+
} = createLazyRpc(CompletionWorker);
|
|
6453
6197
|
|
|
6454
6198
|
const newStateGenerator$4 = async (state, parentUid) => {
|
|
6455
6199
|
const {
|
|
@@ -6461,7 +6205,7 @@ const newStateGenerator$4 = async (state, parentUid) => {
|
|
|
6461
6205
|
} = state;
|
|
6462
6206
|
const {
|
|
6463
6207
|
newState
|
|
6464
|
-
} = get$
|
|
6208
|
+
} = get$5(parentUid);
|
|
6465
6209
|
const {
|
|
6466
6210
|
languageId
|
|
6467
6211
|
} = newState;
|
|
@@ -6514,18 +6258,18 @@ const launchFindWidgetWorker = async () => {
|
|
|
6514
6258
|
const rpcId = 9002;
|
|
6515
6259
|
const launch = async () => {
|
|
6516
6260
|
// TODO race condition
|
|
6517
|
-
if (get$
|
|
6261
|
+
if (get$7(rpcId)) {
|
|
6518
6262
|
return;
|
|
6519
6263
|
}
|
|
6520
6264
|
const rpc = await launchFindWidgetWorker();
|
|
6521
|
-
set$
|
|
6265
|
+
set$b(rpcId, rpc);
|
|
6522
6266
|
};
|
|
6523
6267
|
const invoke$3 = async (method, ...params) => {
|
|
6524
|
-
const rpc = get$
|
|
6268
|
+
const rpc = get$7(rpcId);
|
|
6525
6269
|
return await rpc.invoke(method, ...params);
|
|
6526
6270
|
};
|
|
6527
6271
|
const dispose = async () => {
|
|
6528
|
-
const rpc = get$
|
|
6272
|
+
const rpc = get$7(rpcId);
|
|
6529
6273
|
remove$8(rpcId);
|
|
6530
6274
|
if (rpc) {
|
|
6531
6275
|
await rpc.dispose();
|
|
@@ -6537,7 +6281,7 @@ const dispose = async () => {
|
|
|
6537
6281
|
};
|
|
6538
6282
|
|
|
6539
6283
|
const getEditor = editorUid => {
|
|
6540
|
-
const instance = get$
|
|
6284
|
+
const instance = get$5(editorUid);
|
|
6541
6285
|
if (!instance) {
|
|
6542
6286
|
throw new Error(`editor ${editorUid} not found`);
|
|
6543
6287
|
}
|
|
@@ -6631,7 +6375,7 @@ const newStateGenerator$2 = async (state, parentUid) => {
|
|
|
6631
6375
|
} = state;
|
|
6632
6376
|
const {
|
|
6633
6377
|
newState
|
|
6634
|
-
} = get$
|
|
6378
|
+
} = get$5(parentUid);
|
|
6635
6379
|
const {
|
|
6636
6380
|
languageId
|
|
6637
6381
|
} = newState;
|
|
@@ -6685,7 +6429,7 @@ const pasteText = (editor, text) => {
|
|
|
6685
6429
|
|
|
6686
6430
|
const paste = async editor => {
|
|
6687
6431
|
// @ts-ignore
|
|
6688
|
-
const text = await invoke$
|
|
6432
|
+
const text = await invoke$a('ClipBoard.readText');
|
|
6689
6433
|
string(text);
|
|
6690
6434
|
return pasteText(editor, text);
|
|
6691
6435
|
};
|
|
@@ -6814,6 +6558,10 @@ const handleError = async error => {
|
|
|
6814
6558
|
}
|
|
6815
6559
|
};
|
|
6816
6560
|
|
|
6561
|
+
// @ts-ignore
|
|
6562
|
+
// @ts-ignore
|
|
6563
|
+
// @ts-ignore
|
|
6564
|
+
|
|
6817
6565
|
// @ts-ignore
|
|
6818
6566
|
const getNewEditor = async editor => {
|
|
6819
6567
|
return editor;
|
|
@@ -6827,7 +6575,7 @@ const save = async editor => {
|
|
|
6827
6575
|
} = editor;
|
|
6828
6576
|
const newEditor = await getNewEditor(editor);
|
|
6829
6577
|
const content = getText$1(newEditor);
|
|
6830
|
-
await invoke$
|
|
6578
|
+
await invoke$a('FileSystem.writeFile', uri, content);
|
|
6831
6579
|
return newEditor;
|
|
6832
6580
|
} catch (error) {
|
|
6833
6581
|
// @ts-ignore
|
|
@@ -7134,7 +6882,7 @@ const selectInsideString = editor => {
|
|
|
7134
6882
|
|
|
7135
6883
|
const getNewSelections = async (editor, selections) => {
|
|
7136
6884
|
// @ts-ignore
|
|
7137
|
-
const newSelections = await invoke$
|
|
6885
|
+
const newSelections = await invoke$a('ExtensionHostSelection.executeGrowSelection', editor, selections);
|
|
7138
6886
|
if (newSelections.length === 0) {
|
|
7139
6887
|
return selections;
|
|
7140
6888
|
}
|
|
@@ -7521,7 +7269,7 @@ const newStateGenerator$1 = async (state, parentUid) => {
|
|
|
7521
7269
|
} = state;
|
|
7522
7270
|
const {
|
|
7523
7271
|
newState
|
|
7524
|
-
} = get$
|
|
7272
|
+
} = get$5(parentUid);
|
|
7525
7273
|
const {
|
|
7526
7274
|
languageId
|
|
7527
7275
|
} = newState;
|
|
@@ -7541,7 +7289,7 @@ const showHover3 = async editor => {
|
|
|
7541
7289
|
|
|
7542
7290
|
const EditorHover = 'EditorHover';
|
|
7543
7291
|
const showHover = async state => {
|
|
7544
|
-
await invoke$
|
|
7292
|
+
await invoke$a('Viewlet.openWidget', EditorHover);
|
|
7545
7293
|
return state;
|
|
7546
7294
|
};
|
|
7547
7295
|
|
|
@@ -7605,7 +7353,7 @@ const newStateGenerator = async (state, parentUid) => {
|
|
|
7605
7353
|
} = state;
|
|
7606
7354
|
const {
|
|
7607
7355
|
newState
|
|
7608
|
-
} = get$
|
|
7356
|
+
} = get$5(parentUid);
|
|
7609
7357
|
const {
|
|
7610
7358
|
languageId
|
|
7611
7359
|
} = newState;
|
|
@@ -7825,7 +7573,21 @@ const tabCompletion = async editor => {
|
|
|
7825
7573
|
}
|
|
7826
7574
|
};
|
|
7827
7575
|
|
|
7828
|
-
const getBlockComment = async editor => {
|
|
7576
|
+
const getBlockComment = async (editor, offset) => {
|
|
7577
|
+
// TODO ask extension host worker,
|
|
7578
|
+
// execute block comment provider with
|
|
7579
|
+
// uri, language id, offset
|
|
7580
|
+
// and the extension returns a matching block comment or undefined
|
|
7581
|
+
try {
|
|
7582
|
+
await activateByEvent(`onLanguage:${editor.languageId}`);
|
|
7583
|
+
// @ts-ignore
|
|
7584
|
+
const blockComment = await invoke$6(`ExtensionHostCommment.execute`, editor.uid, offset);
|
|
7585
|
+
if (blockComment) {
|
|
7586
|
+
return blockComment;
|
|
7587
|
+
}
|
|
7588
|
+
} catch {
|
|
7589
|
+
// ignore
|
|
7590
|
+
}
|
|
7829
7591
|
const languageConfiguration = await getLanguageConfiguration(editor);
|
|
7830
7592
|
if (!languageConfiguration?.comments?.blockComment) {
|
|
7831
7593
|
return undefined;
|
|
@@ -8020,7 +7782,8 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
8020
7782
|
};
|
|
8021
7783
|
|
|
8022
7784
|
const toggleBlockComment = async editor => {
|
|
8023
|
-
const
|
|
7785
|
+
const offset = getOffsetAtCursor$1(editor);
|
|
7786
|
+
const blockComment = await getBlockComment(editor, offset);
|
|
8024
7787
|
if (!blockComment) {
|
|
8025
7788
|
return editor;
|
|
8026
7789
|
}
|
|
@@ -8115,9 +7878,16 @@ const toggleComment = async editor => {
|
|
|
8115
7878
|
}
|
|
8116
7879
|
};
|
|
8117
7880
|
|
|
8118
|
-
const type = (editor, text) => {
|
|
7881
|
+
const type = async (editor, text) => {
|
|
8119
7882
|
const changes = editorReplaceSelections(editor, [text], EditorType);
|
|
8120
|
-
|
|
7883
|
+
const newEditor = await scheduleDocumentAndCursorsSelections(editor, changes);
|
|
7884
|
+
if (newEditor.completionsOnType) {
|
|
7885
|
+
// TODO if completion widget is already visible, advance
|
|
7886
|
+
// TODO if character typed is space or tab or separator, close completions
|
|
7887
|
+
const withCompletion = await openCompletion(newEditor);
|
|
7888
|
+
return withCompletion;
|
|
7889
|
+
}
|
|
7890
|
+
return newEditor;
|
|
8121
7891
|
};
|
|
8122
7892
|
|
|
8123
7893
|
const Slash = '/';
|
|
@@ -8196,7 +7966,7 @@ const typeWithAutoClosingQuote = (editor, text) => {
|
|
|
8196
7966
|
const typeWithAutoClosingTag = async (editor, text) => {
|
|
8197
7967
|
const offset = offsetAt(editor, editor.selections[0], editor.selections[1]);
|
|
8198
7968
|
// @ts-ignore
|
|
8199
|
-
const result = await invoke$
|
|
7969
|
+
const result = await invoke$a('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
|
|
8200
7970
|
if (!result) {
|
|
8201
7971
|
const changes = editorReplaceSelections(editor, [text], EditorType);
|
|
8202
7972
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
@@ -8522,7 +8292,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
8522
8292
|
...state,
|
|
8523
8293
|
commands
|
|
8524
8294
|
};
|
|
8525
|
-
const latest = get$
|
|
8295
|
+
const latest = get$5(editor.uid).newState;
|
|
8526
8296
|
const newEditor = updateWidget(latest, widgetId, newState);
|
|
8527
8297
|
return newEditor;
|
|
8528
8298
|
};
|
|
@@ -8816,7 +8586,7 @@ const getHoverPositionXy = (editor, rowIndex, wordStart, documentationHeight) =>
|
|
|
8816
8586
|
};
|
|
8817
8587
|
const getEditorHoverInfo = async (editorUid, position) => {
|
|
8818
8588
|
number(editorUid);
|
|
8819
|
-
const instance = get$
|
|
8589
|
+
const instance = get$5(editorUid);
|
|
8820
8590
|
const editor = instance.newState;
|
|
8821
8591
|
const {
|
|
8822
8592
|
selections
|
|
@@ -9212,12 +8982,12 @@ const getEditorSourceActions = async editorId => {
|
|
|
9212
8982
|
}
|
|
9213
8983
|
const {
|
|
9214
8984
|
newState
|
|
9215
|
-
} = get$
|
|
8985
|
+
} = get$5(editorId);
|
|
9216
8986
|
const {
|
|
9217
8987
|
languageId
|
|
9218
8988
|
} = newState;
|
|
9219
8989
|
// @ts-ignore
|
|
9220
|
-
const allActions = await invoke$
|
|
8990
|
+
const allActions = await invoke$a('GetEditorSourceActions.getEditorSourceActions');
|
|
9221
8991
|
const filtered = filterActions(allActions, languageId);
|
|
9222
8992
|
return filtered;
|
|
9223
8993
|
};
|
|
@@ -9240,14 +9010,14 @@ const getWordAtOffset = editor => {
|
|
|
9240
9010
|
};
|
|
9241
9011
|
|
|
9242
9012
|
const setFocus = async focusKey => {
|
|
9243
|
-
await invoke$
|
|
9013
|
+
await invoke$a('Focus.setFocus', focusKey);
|
|
9244
9014
|
};
|
|
9245
9015
|
const unsetAdditionalFocus = async focusKey => {
|
|
9246
9016
|
if (!focusKey) {
|
|
9247
9017
|
return;
|
|
9248
9018
|
}
|
|
9249
9019
|
// @ts-ignore
|
|
9250
|
-
await invoke$
|
|
9020
|
+
await invoke$a('Focus.removeAdditionalFocus', focusKey);
|
|
9251
9021
|
};
|
|
9252
9022
|
|
|
9253
9023
|
const FocusEditor = 12;
|
|
@@ -9788,7 +9558,7 @@ const getProblems = async () => {
|
|
|
9788
9558
|
const keys = getKeys$1();
|
|
9789
9559
|
const editors = keys.map(key => {
|
|
9790
9560
|
const numericKey = parseInt(key);
|
|
9791
|
-
const editor = get$
|
|
9561
|
+
const editor = get$5(numericKey);
|
|
9792
9562
|
return editor;
|
|
9793
9563
|
});
|
|
9794
9564
|
const newEditors = editors.map(editor => editor.newState);
|
|
@@ -9903,7 +9673,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
9903
9673
|
commandMap: {}
|
|
9904
9674
|
});
|
|
9905
9675
|
if (rpcId) {
|
|
9906
|
-
set$
|
|
9676
|
+
set$b(rpcId, rpc);
|
|
9907
9677
|
}
|
|
9908
9678
|
};
|
|
9909
9679
|
|
|
@@ -9936,7 +9706,7 @@ const getWidgetName = widgetId => {
|
|
|
9936
9706
|
const saveWidgetState = async keys => {
|
|
9937
9707
|
const savedStates = Object.create(null);
|
|
9938
9708
|
for (const key of keys) {
|
|
9939
|
-
const editor = get$
|
|
9709
|
+
const editor = get$5(parseInt(key));
|
|
9940
9710
|
const {
|
|
9941
9711
|
widgets
|
|
9942
9712
|
} = editor.newState;
|
|
@@ -9955,7 +9725,7 @@ const restoreWidgetState = async (keys, savedStates) => {
|
|
|
9955
9725
|
const newEditors = [];
|
|
9956
9726
|
for (const key of keys) {
|
|
9957
9727
|
const editorUid = parseInt(key);
|
|
9958
|
-
const editor = get$
|
|
9728
|
+
const editor = get$5(editorUid);
|
|
9959
9729
|
const {
|
|
9960
9730
|
widgets
|
|
9961
9731
|
} = editor.newState;
|
|
@@ -10007,26 +9777,22 @@ const hotReload = async () => {
|
|
|
10007
9777
|
|
|
10008
9778
|
// TODO ask renderer worker to rerender all editors
|
|
10009
9779
|
// @ts-ignore
|
|
10010
|
-
await invoke$
|
|
9780
|
+
await invoke$a(`Editor.rerender`);
|
|
10011
9781
|
isReloading = false;
|
|
10012
9782
|
};
|
|
10013
9783
|
|
|
10014
9784
|
const sendMessagePortToExtensionHostWorker2 = async (port, initialCommand, rpcId) => {
|
|
10015
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, initialCommand, rpcId);
|
|
9785
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, initialCommand, rpcId);
|
|
10016
9786
|
};
|
|
10017
9787
|
|
|
10018
9788
|
const createExtensionHostRpc = async () => {
|
|
10019
9789
|
try {
|
|
10020
|
-
const {
|
|
10021
|
-
port1,
|
|
10022
|
-
port2
|
|
10023
|
-
} = getPortTuple();
|
|
10024
9790
|
const initialCommand = 'HandleMessagePort.handleMessagePort2';
|
|
10025
|
-
|
|
10026
|
-
await sendMessagePortToExtensionHostWorker2(port2, initialCommand, EditorWorker);
|
|
10027
|
-
const rpc = await PlainMessagePortRpcParent.create({
|
|
9791
|
+
const rpc = await TransferMessagePortRpcParent.create({
|
|
10028
9792
|
commandMap: {},
|
|
10029
|
-
|
|
9793
|
+
async send(port) {
|
|
9794
|
+
await sendMessagePortToExtensionHostWorker2(port, initialCommand, EditorWorker);
|
|
9795
|
+
}
|
|
10030
9796
|
});
|
|
10031
9797
|
return rpc;
|
|
10032
9798
|
} catch (error) {
|
|
@@ -10039,34 +9805,23 @@ const initializeExtensionHost = async () => {
|
|
|
10039
9805
|
set$1(extensionHostRpc);
|
|
10040
9806
|
};
|
|
10041
9807
|
|
|
10042
|
-
const sendMessagePortToSyntaxHighlightingWorker = async
|
|
9808
|
+
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
10043
9809
|
try {
|
|
10044
|
-
|
|
10045
|
-
port1,
|
|
10046
|
-
port2
|
|
10047
|
-
} = getPortTuple();
|
|
10048
|
-
await invokeAndTransfer(
|
|
9810
|
+
await invokeAndTransfer$1(
|
|
10049
9811
|
// @ts-ignore
|
|
10050
|
-
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker',
|
|
10051
|
-
return port2;
|
|
9812
|
+
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
10052
9813
|
} catch {
|
|
10053
|
-
|
|
10054
|
-
port1,
|
|
10055
|
-
port2
|
|
10056
|
-
} = getPortTuple();
|
|
10057
|
-
await invokeAndTransfer(
|
|
9814
|
+
await invokeAndTransfer$1(
|
|
10058
9815
|
// @ts-ignore
|
|
10059
|
-
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker',
|
|
10060
|
-
return port2;
|
|
9816
|
+
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort');
|
|
10061
9817
|
}
|
|
10062
9818
|
};
|
|
10063
9819
|
|
|
10064
9820
|
const createSyntaxHighlightingWorkerRpc = async () => {
|
|
10065
9821
|
try {
|
|
10066
|
-
const
|
|
10067
|
-
const rpc = await PlainMessagePortRpcParent.create({
|
|
9822
|
+
const rpc = await TransferMessagePortRpcParent.create({
|
|
10068
9823
|
commandMap: {},
|
|
10069
|
-
|
|
9824
|
+
send: sendMessagePortToSyntaxHighlightingWorker
|
|
10070
9825
|
});
|
|
10071
9826
|
return rpc;
|
|
10072
9827
|
} catch (error) {
|
|
@@ -10085,7 +9840,16 @@ const initializeSyntaxHighlighting = async (syntaxHighlightingEnabled, syncIncre
|
|
|
10085
9840
|
}
|
|
10086
9841
|
};
|
|
10087
9842
|
|
|
9843
|
+
const launchCompletionWorker = async () => {
|
|
9844
|
+
const name = 'Completion Worker';
|
|
9845
|
+
const url = 'completionWorkerMain.js';
|
|
9846
|
+
const intializeCommand = 'Completions.initialize';
|
|
9847
|
+
const rpc = await launchWorker(name, url, intializeCommand);
|
|
9848
|
+
return rpc;
|
|
9849
|
+
};
|
|
9850
|
+
|
|
10088
9851
|
const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
|
|
9852
|
+
setFactory(launchCompletionWorker);
|
|
10089
9853
|
await Promise.all([initializeSyntaxHighlighting(syntaxHighlightingEnabled, syncIncremental), initializeExtensionHost()]);
|
|
10090
9854
|
};
|
|
10091
9855
|
|
|
@@ -10260,21 +10024,21 @@ const getSelectionsVirtualDom = selections => {
|
|
|
10260
10024
|
};
|
|
10261
10025
|
|
|
10262
10026
|
const addWidget = widget => {
|
|
10263
|
-
const module = get$
|
|
10027
|
+
const module = get$6(widget.id);
|
|
10264
10028
|
if (!module) {
|
|
10265
10029
|
throw new Error('unsupported widget');
|
|
10266
10030
|
}
|
|
10267
10031
|
return module.add(widget);
|
|
10268
10032
|
};
|
|
10269
10033
|
const renderWidget = widget => {
|
|
10270
|
-
const module = get$
|
|
10034
|
+
const module = get$6(widget.id);
|
|
10271
10035
|
if (!module) {
|
|
10272
10036
|
throw new Error('unsupported widget');
|
|
10273
10037
|
}
|
|
10274
10038
|
return module.render(widget);
|
|
10275
10039
|
};
|
|
10276
10040
|
const removeWidget = widget => {
|
|
10277
|
-
const module = get$
|
|
10041
|
+
const module = get$6(widget.id);
|
|
10278
10042
|
if (!module) {
|
|
10279
10043
|
throw new Error('unsupported widget');
|
|
10280
10044
|
}
|
|
@@ -10456,7 +10220,7 @@ const renderWidgets = {
|
|
|
10456
10220
|
};
|
|
10457
10221
|
const render$6 = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets, renderFocusContext, renderAdditionalFocusContext];
|
|
10458
10222
|
const renderEditor = id => {
|
|
10459
|
-
const instance = get$
|
|
10223
|
+
const instance = get$5(id);
|
|
10460
10224
|
if (!instance) {
|
|
10461
10225
|
return [];
|
|
10462
10226
|
}
|
|
@@ -10522,7 +10286,7 @@ const setDebugEnabled = (state, enabled) => {
|
|
|
10522
10286
|
};
|
|
10523
10287
|
|
|
10524
10288
|
const invoke = async (method, ...params) => {
|
|
10525
|
-
const worker = get$
|
|
10289
|
+
const worker = get$7(DebugWorker);
|
|
10526
10290
|
return worker.invoke(method, ...params);
|
|
10527
10291
|
};
|
|
10528
10292
|
|
|
@@ -10538,7 +10302,7 @@ const getKey = () => {
|
|
|
10538
10302
|
const updateDebugInfo = async debugId => {
|
|
10539
10303
|
const newInfo = await getDebugHighlight(debugId);
|
|
10540
10304
|
const key = getKey();
|
|
10541
|
-
const instance = get$
|
|
10305
|
+
const instance = get$5(key);
|
|
10542
10306
|
if (!instance) {
|
|
10543
10307
|
return;
|
|
10544
10308
|
}
|
|
@@ -10552,18 +10316,7 @@ const updateDebugInfo = async debugId => {
|
|
|
10552
10316
|
};
|
|
10553
10317
|
set$6(key, oldState, newEditor);
|
|
10554
10318
|
// @ts-ignore
|
|
10555
|
-
await invoke$
|
|
10556
|
-
};
|
|
10557
|
-
|
|
10558
|
-
const editorDiagnosticEffect = {
|
|
10559
|
-
isActive(oldEditor, newEditor) {
|
|
10560
|
-
// TODO avoid slow comparison
|
|
10561
|
-
return newEditor.diagnosticsEnabled && JSON.stringify(oldEditor.lines) !== JSON.stringify(newEditor.lines);
|
|
10562
|
-
},
|
|
10563
|
-
// TODO set effects delay / diagnostic delay
|
|
10564
|
-
async apply(editor) {
|
|
10565
|
-
await updateDiagnostics(editor);
|
|
10566
|
-
}
|
|
10319
|
+
await invoke$a('Editor.rerender', key);
|
|
10567
10320
|
};
|
|
10568
10321
|
|
|
10569
10322
|
const keep = ['ActivateByEvent.activateByEvent', 'ExtensionHostManagement.activateByEvent', 'Editor.applyEdit2', 'Editor.applyEdits2', 'Editor.closeFind2', 'Editor.closeWidget2', 'Editor.create', 'Editor.getKeyBindings', 'Editor.getSourceActions', 'Editor.getLines2', 'Editor.getPositionAtCursor', 'Editor.getOffsetAtCursor', 'Editor.getQuickPickMenuEntries', 'Editor.getSelections', 'Editor.hotReload', 'Editor.getSelections2', 'Editor.getDiagnostics', 'Editor.getText', 'Editor.getWordAt', 'Editor.getWordAt2', 'Editor.getWordAtOffset2', 'Editor.getUri', 'Editor.getWordBefore', 'Editor.getWordBefore2', 'Editor.offsetAt', 'Editor.render', 'Editor.setSelections2', 'Editor.updateDebugInfo', 'Editor.getLanguageId', 'Editor.getProblems', 'Editor.getKeys', 'Font.ensure', 'HandleMessagePort.handleMessagePort', 'Hover.getHoverInfo', 'Hover.handleSashPointerDown', 'Hover.handleSashPointerMove', 'Hover.handleSashPointerUp', 'Hover.loadContent', 'Hover.render', 'Initialize.initialize', 'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker'
|
|
@@ -10596,19 +10349,13 @@ const widgetCommands = {
|
|
|
10596
10349
|
// TODO wrap commands globally, not per editor
|
|
10597
10350
|
// TODO only store editor state in editor worker, not in renderer worker also
|
|
10598
10351
|
|
|
10599
|
-
const effects = [editorDiagnosticEffect];
|
|
10600
10352
|
const wrapCommand = fn => async (editorUid, ...args) => {
|
|
10601
|
-
const oldInstance = get$
|
|
10353
|
+
const oldInstance = get$5(editorUid);
|
|
10602
10354
|
const state = oldInstance.newState;
|
|
10603
10355
|
const newEditor = await fn(state, ...args);
|
|
10604
10356
|
if (state === newEditor) {
|
|
10605
10357
|
return newEditor;
|
|
10606
10358
|
}
|
|
10607
|
-
for (const effect of effects) {
|
|
10608
|
-
if (effect.isActive(oldInstance.newState, newEditor)) {
|
|
10609
|
-
effect.apply(newEditor);
|
|
10610
|
-
}
|
|
10611
|
-
}
|
|
10612
10359
|
// TODO if editor did not change, no need to update furthur
|
|
10613
10360
|
|
|
10614
10361
|
// TODO combine neweditor with latest editor?
|
|
@@ -10874,7 +10621,7 @@ const listen = async () => {
|
|
|
10874
10621
|
const rpc = await WebWorkerRpcClient.create({
|
|
10875
10622
|
commandMap: commandMap
|
|
10876
10623
|
});
|
|
10877
|
-
set$
|
|
10624
|
+
set$9(rpc);
|
|
10878
10625
|
};
|
|
10879
10626
|
|
|
10880
10627
|
const CodeGeneratorInput = 'CodeGeneratorInput';
|