@lvce-editor/editor-worker 12.3.0 → 13.2.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 +392 -649
- 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++) {
|
|
@@ -2751,7 +2435,7 @@ const getTabCount = string => {
|
|
|
2751
2435
|
return count;
|
|
2752
2436
|
};
|
|
2753
2437
|
|
|
2754
|
-
const measureTextWidthFast = (text, charWidth) => {
|
|
2438
|
+
const measureTextWidthFast = async (text, charWidth) => {
|
|
2755
2439
|
return text.length * charWidth;
|
|
2756
2440
|
};
|
|
2757
2441
|
|
|
@@ -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,13 +2468,13 @@ 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
|
|
|
2791
2475
|
// TODO for text editor, could dispose measuring canvas after editor has been initialized to free up offscreencanvas space
|
|
2792
2476
|
|
|
2793
|
-
const measureTextWidthSlow = (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
2477
|
+
const measureTextWidthSlow = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
2794
2478
|
string(text);
|
|
2795
2479
|
number(fontWeight);
|
|
2796
2480
|
number(fontSize);
|
|
@@ -2812,14 +2496,14 @@ const measureTextWidthSlow = (text, fontWeight, fontSize, fontFamily, letterSpac
|
|
|
2812
2496
|
return width;
|
|
2813
2497
|
};
|
|
2814
2498
|
|
|
2815
|
-
const measureTextWidth = (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
2499
|
+
const measureTextWidth = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
2816
2500
|
if (isMonoSpaceFont) {
|
|
2817
|
-
return measureTextWidthFast(text, charWidth);
|
|
2501
|
+
return await measureTextWidthFast(text, charWidth);
|
|
2818
2502
|
}
|
|
2819
|
-
return measureTextWidthSlow(text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
|
|
2503
|
+
return await measureTextWidthSlow(text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
|
|
2820
2504
|
};
|
|
2821
2505
|
|
|
2822
|
-
const getX = (line, column, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, difference = 0) => {
|
|
2506
|
+
const getX = async (line, column, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, difference = 0) => {
|
|
2823
2507
|
if (!line) {
|
|
2824
2508
|
return 0;
|
|
2825
2509
|
}
|
|
@@ -2841,7 +2525,8 @@ const getX = (line, column, fontWeight, fontSize, fontFamily, isMonospaceFont, l
|
|
|
2841
2525
|
const normalizedLine = normalizeText(line, normalize, tabSize);
|
|
2842
2526
|
const tabCount = getTabCount(line.slice(0, column));
|
|
2843
2527
|
const partialText = normalizedLine.slice(0, column + tabCount);
|
|
2844
|
-
|
|
2528
|
+
const textWidth = await measureTextWidth(partialText, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, averageCharWidth);
|
|
2529
|
+
return textWidth - halfCursorWidth + difference;
|
|
2845
2530
|
};
|
|
2846
2531
|
|
|
2847
2532
|
const getY = (row, minLineY, rowHeight) => {
|
|
@@ -2958,7 +2643,7 @@ const getSelectionArray = visibleSelections => {
|
|
|
2958
2643
|
}
|
|
2959
2644
|
return selectionsArray;
|
|
2960
2645
|
};
|
|
2961
|
-
const getVisible = editor => {
|
|
2646
|
+
const getVisible = async editor => {
|
|
2962
2647
|
const visibleCursors = [];
|
|
2963
2648
|
const visibleSelections = [];
|
|
2964
2649
|
// // TODO binary search
|
|
@@ -2991,7 +2676,7 @@ const getVisible = editor => {
|
|
|
2991
2676
|
const relativeEndLineRow = selectionEndRow - minLineY;
|
|
2992
2677
|
const endLineDifference = differences[relativeEndLineRow];
|
|
2993
2678
|
const endLine = lines[selectionEndRow];
|
|
2994
|
-
const endLineEndX = getX(endLine, selectionEndColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, endLineDifference);
|
|
2679
|
+
const endLineEndX = await getX(endLine, selectionEndColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, endLineDifference);
|
|
2995
2680
|
const endLineY = getY(selectionEndRow, minLineY, rowHeight);
|
|
2996
2681
|
if (isEmpty(selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn) && endLineEndX > 0) {
|
|
2997
2682
|
visibleCursors.push(endLineEndX, endLineY);
|
|
@@ -3001,7 +2686,7 @@ const getVisible = editor => {
|
|
|
3001
2686
|
const startLineYRelative = selectionStartRow - minLineY;
|
|
3002
2687
|
const startLineDifference = differences[startLineYRelative];
|
|
3003
2688
|
if (selectionStartRow === selectionEndRow) {
|
|
3004
|
-
const startX = getX(endLine, selectionStartColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, startLineDifference);
|
|
2689
|
+
const startX = await getX(endLine, selectionStartColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, startLineDifference);
|
|
3005
2690
|
if (reversed) {
|
|
3006
2691
|
visibleCursors.push(startX, endLineY);
|
|
3007
2692
|
} else if (endLineEndX >= 0) {
|
|
@@ -3012,8 +2697,8 @@ const getVisible = editor => {
|
|
|
3012
2697
|
} else {
|
|
3013
2698
|
if (selectionStartRow >= minLineY) {
|
|
3014
2699
|
const startLine = lines[selectionStartRow];
|
|
3015
|
-
const startLineStartX = getX(startLine, selectionStartColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, startLineDifference);
|
|
3016
|
-
const startLineEndX = getX(startLine, startLine.length, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, startLineDifference);
|
|
2700
|
+
const startLineStartX = await getX(startLine, selectionStartColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, startLineDifference);
|
|
2701
|
+
const startLineEndX = await getX(startLine, startLine.length, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, startLineDifference);
|
|
3017
2702
|
const startLineStartY = getY(selectionStartRow, minLineY, rowHeight);
|
|
3018
2703
|
const selectionWidth = startLineEndX - startLineStartX;
|
|
3019
2704
|
if (reversed) {
|
|
@@ -3028,7 +2713,7 @@ const getVisible = editor => {
|
|
|
3028
2713
|
const currentLineY = getY(i, minLineY, rowHeight);
|
|
3029
2714
|
const relativeLine = i - minLineY;
|
|
3030
2715
|
const difference = differences[relativeLine];
|
|
3031
|
-
const selectionWidth = getX(currentLine, currentLine.length, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, difference);
|
|
2716
|
+
const selectionWidth = await getX(currentLine, currentLine.length, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, difference);
|
|
3032
2717
|
visibleSelections.push(0, currentLineY, selectionWidth, rowHeight);
|
|
3033
2718
|
}
|
|
3034
2719
|
if (selectionEndRow <= maxLineY) {
|
|
@@ -3177,10 +2862,10 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
3177
2862
|
};
|
|
3178
2863
|
set$6(editor.uid, editor, newEditor);
|
|
3179
2864
|
const incrementalEdits = await getIncrementalEdits(editor, newEditor);
|
|
3180
|
-
const
|
|
2865
|
+
const editorWithNewWidgets = await applyWidgetChanges(newEditor, changes);
|
|
3181
2866
|
const newEditor2 = {
|
|
3182
2867
|
...newEditor,
|
|
3183
|
-
|
|
2868
|
+
...editorWithNewWidgets,
|
|
3184
2869
|
incrementalEdits
|
|
3185
2870
|
};
|
|
3186
2871
|
if (incrementalEdits !== emptyIncrementalEdits) {
|
|
@@ -3342,6 +3027,36 @@ const setText = (editor, text) => {
|
|
|
3342
3027
|
};
|
|
3343
3028
|
};
|
|
3344
3029
|
|
|
3030
|
+
const emptyEditor = {
|
|
3031
|
+
textInfos: [],
|
|
3032
|
+
differences: [],
|
|
3033
|
+
uri: '',
|
|
3034
|
+
languageId: '',
|
|
3035
|
+
// TODO use numeric language id?
|
|
3036
|
+
lines: [],
|
|
3037
|
+
x: 0,
|
|
3038
|
+
y: 0,
|
|
3039
|
+
width: 0,
|
|
3040
|
+
height: 0,
|
|
3041
|
+
tokenizerId: 0,
|
|
3042
|
+
minLineY: 0,
|
|
3043
|
+
decorations: [],
|
|
3044
|
+
embeds: [],
|
|
3045
|
+
deltaX: 0,
|
|
3046
|
+
focused: false,
|
|
3047
|
+
deltaY: 0,
|
|
3048
|
+
scrollBarHeight: 0,
|
|
3049
|
+
longestLineWidth: 0,
|
|
3050
|
+
maxLineY: 0,
|
|
3051
|
+
undoStack: [],
|
|
3052
|
+
lineCache: [],
|
|
3053
|
+
selections: new Uint32Array(),
|
|
3054
|
+
diagnostics: [],
|
|
3055
|
+
highlightedLine: -1,
|
|
3056
|
+
debugEnabled: false,
|
|
3057
|
+
incrementalEdits: emptyIncrementalEdits
|
|
3058
|
+
};
|
|
3059
|
+
|
|
3345
3060
|
const HoverExecute = 'ExtensionHostHover.execute';
|
|
3346
3061
|
const TabCompletionExecuteTabCompletionProvider = 'ExtensionHost.executeTabCompletionProvider';
|
|
3347
3062
|
const TextDocumentSyncFull = 'ExtensionHostTextDocument.syncFull';
|
|
@@ -3359,8 +3074,71 @@ const FocusEditorRename$1 = 11;
|
|
|
3359
3074
|
const SourceActions = 38;
|
|
3360
3075
|
const FocusCodeGenerator = 52;
|
|
3361
3076
|
|
|
3362
|
-
const
|
|
3363
|
-
|
|
3077
|
+
const getFileExtensionIndex = file => {
|
|
3078
|
+
string(file);
|
|
3079
|
+
return file.lastIndexOf(Dot);
|
|
3080
|
+
};
|
|
3081
|
+
const getNthFileExtension = (file, startIndex) => {
|
|
3082
|
+
return file.lastIndexOf(Dot, startIndex);
|
|
3083
|
+
};
|
|
3084
|
+
|
|
3085
|
+
// TODO merge all of this with extension host languages module
|
|
3086
|
+
|
|
3087
|
+
const getLanguageByExtension = (languages, extensionLower) => {
|
|
3088
|
+
for (const language of languages) {
|
|
3089
|
+
if (language && language.extensions && Array.isArray(language.extensions) && language.extensions.includes(extensionLower)) {
|
|
3090
|
+
return language.id;
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
return '';
|
|
3094
|
+
};
|
|
3095
|
+
const getLanguageByFileName = (languages, fileNameLower) => {
|
|
3096
|
+
for (const language of languages) {
|
|
3097
|
+
if (language && language.fileNames && Array.isArray(language.fileNames) && language.fileNames.includes(fileNameLower)) {
|
|
3098
|
+
return language.id;
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
return '';
|
|
3102
|
+
};
|
|
3103
|
+
const getLanguageId$1 = (uri, languages) => {
|
|
3104
|
+
string(uri);
|
|
3105
|
+
// TODO this is inefficient for icon theme, as file extension is computed twice
|
|
3106
|
+
// maybe icon theme should get a slimmed down version of languages so that it can internally compute
|
|
3107
|
+
// the language id
|
|
3108
|
+
const extensionIndex = getFileExtensionIndex(uri);
|
|
3109
|
+
const extension = uri.slice(extensionIndex);
|
|
3110
|
+
const extensionLower = extension.toLowerCase();
|
|
3111
|
+
const candidate1 = getLanguageByExtension(languages, extensionLower);
|
|
3112
|
+
if (candidate1) {
|
|
3113
|
+
return candidate1;
|
|
3114
|
+
}
|
|
3115
|
+
const fileNameLower = uri.toLowerCase();
|
|
3116
|
+
const secondExtensionIndex = getNthFileExtension(uri, extensionIndex - 1);
|
|
3117
|
+
const secondExtension = uri.slice(secondExtensionIndex);
|
|
3118
|
+
const candidate2 = getLanguageByExtension(languages, secondExtension);
|
|
3119
|
+
if (candidate2) {
|
|
3120
|
+
return candidate2;
|
|
3121
|
+
}
|
|
3122
|
+
const candidate3 = getLanguageByFileName(languages, fileNameLower);
|
|
3123
|
+
if (candidate3) {
|
|
3124
|
+
return candidate3;
|
|
3125
|
+
}
|
|
3126
|
+
return 'unknown';
|
|
3127
|
+
};
|
|
3128
|
+
|
|
3129
|
+
const getLanguages = async () => {
|
|
3130
|
+
// @ts-ignore
|
|
3131
|
+
const languages = await invoke$6('Languages.getLanguages');
|
|
3132
|
+
return languages;
|
|
3133
|
+
};
|
|
3134
|
+
|
|
3135
|
+
const measureCharacterWidth = async (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
3136
|
+
return await measureTextWidth('a', fontWeight, fontSize, fontFamily, letterSpacing, false, 0);
|
|
3137
|
+
};
|
|
3138
|
+
|
|
3139
|
+
const get$1 = async key => {
|
|
3140
|
+
const value = await invoke$a('Preferences.get', key);
|
|
3141
|
+
return value;
|
|
3364
3142
|
};
|
|
3365
3143
|
|
|
3366
3144
|
const OnDiagnostic = 'onDiagnostic';
|
|
@@ -3394,7 +3172,7 @@ const getDiagnosticType = diagnostic => {
|
|
|
3394
3172
|
return diagnostic.type;
|
|
3395
3173
|
};
|
|
3396
3174
|
|
|
3397
|
-
const getVisibleDiagnostics = (editor, diagnostics) => {
|
|
3175
|
+
const getVisibleDiagnostics = async (editor, diagnostics) => {
|
|
3398
3176
|
const visibleDiagnostics = [];
|
|
3399
3177
|
const {
|
|
3400
3178
|
width,
|
|
@@ -3419,7 +3197,7 @@ const getVisibleDiagnostics = (editor, diagnostics) => {
|
|
|
3419
3197
|
const diagnosticWidth = columnDelta * charWidth;
|
|
3420
3198
|
const endLineDifference = 0;
|
|
3421
3199
|
const halfCursorWidth = 0;
|
|
3422
|
-
const x = getX(lines[rowIndex], columnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, charWidth, endLineDifference);
|
|
3200
|
+
const x = await getX(lines[rowIndex], columnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, charWidth, endLineDifference);
|
|
3423
3201
|
const y = getY(rowIndex, minLineY, rowHeight) - rowHeight;
|
|
3424
3202
|
visibleDiagnostics.push({
|
|
3425
3203
|
x,
|
|
@@ -3447,11 +3225,11 @@ const updateDiagnostics = async newState => {
|
|
|
3447
3225
|
// @ts-ignore
|
|
3448
3226
|
await invoke$6(TextDocumentSyncFull, newState.uri, newState.id, newState.languageId, content);
|
|
3449
3227
|
const diagnostics = await executeDiagnosticProvider(newState);
|
|
3450
|
-
const latest = get$
|
|
3228
|
+
const latest = get$5(newState.id);
|
|
3451
3229
|
if (!latest) {
|
|
3452
3230
|
return newState;
|
|
3453
3231
|
}
|
|
3454
|
-
const decorations = getVisibleDiagnostics(latest.newState, diagnostics);
|
|
3232
|
+
const decorations = await getVisibleDiagnostics(latest.newState, diagnostics);
|
|
3455
3233
|
const newEditor = {
|
|
3456
3234
|
...latest.newState,
|
|
3457
3235
|
diagnostics,
|
|
@@ -3459,7 +3237,7 @@ const updateDiagnostics = async newState => {
|
|
|
3459
3237
|
};
|
|
3460
3238
|
set$6(newState.id, latest.oldState, newEditor);
|
|
3461
3239
|
// @ts-ignore
|
|
3462
|
-
await invoke$
|
|
3240
|
+
await invoke$a('Editor.rerender', newState.id);
|
|
3463
3241
|
return newEditor;
|
|
3464
3242
|
} catch (error) {
|
|
3465
3243
|
// @ts-ignore
|
|
@@ -3471,35 +3249,6 @@ const updateDiagnostics = async newState => {
|
|
|
3471
3249
|
}
|
|
3472
3250
|
};
|
|
3473
3251
|
|
|
3474
|
-
const emptyEditor = {
|
|
3475
|
-
textInfos: [],
|
|
3476
|
-
differences: [],
|
|
3477
|
-
uri: '',
|
|
3478
|
-
languageId: '',
|
|
3479
|
-
// TODO use numeric language id?
|
|
3480
|
-
lines: [],
|
|
3481
|
-
x: 0,
|
|
3482
|
-
y: 0,
|
|
3483
|
-
width: 0,
|
|
3484
|
-
height: 0,
|
|
3485
|
-
tokenizerId: 0,
|
|
3486
|
-
minLineY: 0,
|
|
3487
|
-
decorations: [],
|
|
3488
|
-
embeds: [],
|
|
3489
|
-
deltaX: 0,
|
|
3490
|
-
focused: false,
|
|
3491
|
-
deltaY: 0,
|
|
3492
|
-
scrollBarHeight: 0,
|
|
3493
|
-
longestLineWidth: 0,
|
|
3494
|
-
maxLineY: 0,
|
|
3495
|
-
undoStack: [],
|
|
3496
|
-
lineCache: [],
|
|
3497
|
-
selections: new Uint32Array(),
|
|
3498
|
-
diagnostics: [],
|
|
3499
|
-
highlightedLine: -1,
|
|
3500
|
-
debugEnabled: false,
|
|
3501
|
-
incrementalEdits: emptyIncrementalEdits
|
|
3502
|
-
};
|
|
3503
3252
|
const createEditor = async ({
|
|
3504
3253
|
id,
|
|
3505
3254
|
content,
|
|
@@ -3533,67 +3282,71 @@ const createEditor = async ({
|
|
|
3533
3282
|
}) => {
|
|
3534
3283
|
number(id);
|
|
3535
3284
|
string(content);
|
|
3536
|
-
|
|
3285
|
+
// TODO support overwriting language id by setting it explicitly or via settings
|
|
3286
|
+
const charWidth = await measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing);
|
|
3287
|
+
const languages = await getLanguages();
|
|
3288
|
+
const computedlanguageId = getLanguageId$1(uri, languages);
|
|
3537
3289
|
const editor = {
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
isAutoClosingTagsEnabled,
|
|
3542
|
-
isAutoClosingQuotesEnabled,
|
|
3543
|
-
isQuickSuggestionsEnabled,
|
|
3290
|
+
charWidth,
|
|
3291
|
+
columnWidth: 0,
|
|
3292
|
+
completionState: '',
|
|
3544
3293
|
completionTriggerCharacters,
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
x,
|
|
3548
|
-
y,
|
|
3549
|
-
width,
|
|
3550
|
-
height,
|
|
3551
|
-
tokenizerId: 0,
|
|
3552
|
-
minLineY: 0,
|
|
3553
|
-
maxLineY: 0,
|
|
3554
|
-
lines: [],
|
|
3555
|
-
undoStack: [],
|
|
3556
|
-
lineCache: [],
|
|
3557
|
-
selections: new Uint32Array(),
|
|
3558
|
-
diagnostics: [],
|
|
3294
|
+
completionUid: 0,
|
|
3295
|
+
cursorWidth: 2,
|
|
3559
3296
|
decorations: [],
|
|
3560
|
-
primarySelectionIndex: 0,
|
|
3561
3297
|
deltaX: 0,
|
|
3562
3298
|
deltaY: 0,
|
|
3563
|
-
|
|
3564
|
-
|
|
3299
|
+
diagnostics: [],
|
|
3300
|
+
diagnosticsEnabled,
|
|
3301
|
+
differences: [],
|
|
3565
3302
|
finalDeltaY: 0,
|
|
3566
|
-
|
|
3567
|
-
rowHeight,
|
|
3568
|
-
scrollBarWidth: 0,
|
|
3569
|
-
scrollBarHeight: 0,
|
|
3570
|
-
validLines: [],
|
|
3571
|
-
invalidStartIndex: 0,
|
|
3303
|
+
finalY: 0,
|
|
3572
3304
|
focused: false,
|
|
3573
|
-
|
|
3574
|
-
itemHeight: 20,
|
|
3305
|
+
focusKey: Empty,
|
|
3575
3306
|
fontFamily,
|
|
3576
|
-
fontWeight,
|
|
3577
|
-
tabSize,
|
|
3578
3307
|
fontSize,
|
|
3579
|
-
|
|
3580
|
-
|
|
3308
|
+
fontWeight,
|
|
3309
|
+
handleOffsetX: 0,
|
|
3310
|
+
height,
|
|
3311
|
+
id,
|
|
3312
|
+
incrementalEdits: emptyIncrementalEdits,
|
|
3313
|
+
invalidStartIndex: 0,
|
|
3314
|
+
isAutoClosingBracketsEnabled,
|
|
3315
|
+
isAutoClosingQuotesEnabled,
|
|
3316
|
+
isAutoClosingTagsEnabled,
|
|
3317
|
+
isMonospaceFont,
|
|
3318
|
+
isQuickSuggestionsEnabled,
|
|
3319
|
+
itemHeight: 20,
|
|
3320
|
+
languageId: computedlanguageId,
|
|
3321
|
+
letterSpacing,
|
|
3322
|
+
lineCache: [],
|
|
3323
|
+
lineNumbers,
|
|
3324
|
+
lines: [],
|
|
3581
3325
|
longestLineWidth: 0,
|
|
3326
|
+
maxLineY: 0,
|
|
3582
3327
|
minimumSliderSize: 20,
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
lineNumbers,
|
|
3328
|
+
minLineY: 0,
|
|
3329
|
+
numberOfVisiblelines: 0,
|
|
3586
3330
|
numberOfVisibleLines: 0,
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3331
|
+
primarySelectionIndex: 0,
|
|
3332
|
+
rowHeight,
|
|
3333
|
+
savedSelections,
|
|
3334
|
+
scrollBarHeight: 0,
|
|
3335
|
+
scrollBarWidth: 0,
|
|
3336
|
+
selections: new Uint32Array(),
|
|
3337
|
+
tabSize,
|
|
3338
|
+
textInfos: [],
|
|
3339
|
+
tokenizerId: 0,
|
|
3590
3340
|
uid: id,
|
|
3591
|
-
|
|
3341
|
+
undoStack: [],
|
|
3342
|
+
uri,
|
|
3343
|
+
validLines: [],
|
|
3592
3344
|
widgets: [],
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3345
|
+
width,
|
|
3346
|
+
x,
|
|
3347
|
+
y
|
|
3596
3348
|
};
|
|
3349
|
+
|
|
3597
3350
|
// TODO avoid creating intermediate editors here
|
|
3598
3351
|
const newEditor1 = setBounds(editor, x, y, width, height, 9);
|
|
3599
3352
|
const newEditor2 = setText(newEditor1, content);
|
|
@@ -3628,6 +3381,12 @@ const createEditor = async ({
|
|
|
3628
3381
|
if (diagnosticsEnabled) {
|
|
3629
3382
|
await updateDiagnostics(newEditor4);
|
|
3630
3383
|
}
|
|
3384
|
+
const completionsOnTypeRaw = await get$1('editor.completionsOnType');
|
|
3385
|
+
const completionsOnType = Boolean(completionsOnTypeRaw);
|
|
3386
|
+
set$6(id, emptyEditor, {
|
|
3387
|
+
...newEditor4,
|
|
3388
|
+
completionsOnType
|
|
3389
|
+
});
|
|
3631
3390
|
};
|
|
3632
3391
|
|
|
3633
3392
|
// @ts-ignore
|
|
@@ -3824,9 +3583,9 @@ const editorReplaceSelections = (editor, replacement, origin) => {
|
|
|
3824
3583
|
return replaceRange(editor, selections, replacement, origin);
|
|
3825
3584
|
};
|
|
3826
3585
|
|
|
3827
|
-
const getAccurateColumnIndexAscii = (line, guess, averageCharWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth) => {
|
|
3586
|
+
const getAccurateColumnIndexAscii = async (line, guess, averageCharWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth) => {
|
|
3828
3587
|
for (let i = guess; i < line.length; i++) {
|
|
3829
|
-
const width = measureTextWidth(line.slice(0, i), fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
|
|
3588
|
+
const width = await measureTextWidth(line.slice(0, i), fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
|
|
3830
3589
|
if (eventX - width < averageCharWidth / 2) {
|
|
3831
3590
|
return i;
|
|
3832
3591
|
}
|
|
@@ -3873,14 +3632,13 @@ const create$8 = () => {
|
|
|
3873
3632
|
};
|
|
3874
3633
|
};
|
|
3875
3634
|
|
|
3876
|
-
|
|
3877
|
-
const getAccurateColumnIndexUnicode = (line, guess, averageCharWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
3635
|
+
const getAccurateColumnIndexUnicode = async (line, guess, averageCharWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
3878
3636
|
const segmenter = create$8();
|
|
3879
3637
|
const segments = segmenter.getSegments(line);
|
|
3880
3638
|
const isMonospaceFont = false;
|
|
3881
3639
|
const charWidth = 0;
|
|
3882
3640
|
for (const segment of segments) {
|
|
3883
|
-
const width = measureTextWidth(line.slice(0, segment.index), fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
|
|
3641
|
+
const width = await measureTextWidth(line.slice(0, segment.index), fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
|
|
3884
3642
|
if (eventX - width < averageCharWidth) {
|
|
3885
3643
|
return segment.index;
|
|
3886
3644
|
}
|
|
@@ -3893,13 +3651,10 @@ const isAscii = line => {
|
|
|
3893
3651
|
return RE_ASCII.test(line);
|
|
3894
3652
|
};
|
|
3895
3653
|
|
|
3896
|
-
// @ts-ignore
|
|
3897
3654
|
const guessOffset = (eventX, averageCharWidth) => {
|
|
3898
3655
|
const guess = Math.round(eventX / averageCharWidth);
|
|
3899
3656
|
return guess;
|
|
3900
3657
|
};
|
|
3901
|
-
|
|
3902
|
-
// @ts-ignore
|
|
3903
3658
|
const normalizeGuess = (line, guess, tabSize) => {
|
|
3904
3659
|
let normalizedGuess = guess;
|
|
3905
3660
|
for (let i = 0; i < guess; i++) {
|
|
@@ -3909,9 +3664,7 @@ const normalizeGuess = (line, guess, tabSize) => {
|
|
|
3909
3664
|
}
|
|
3910
3665
|
return normalizedGuess;
|
|
3911
3666
|
};
|
|
3912
|
-
|
|
3913
|
-
// @ts-ignore
|
|
3914
|
-
const getAccurateColumnIndex = (line, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth, tabSize, eventX) => {
|
|
3667
|
+
const getAccurateColumnIndex = async (line, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth, tabSize, eventX) => {
|
|
3915
3668
|
string(line);
|
|
3916
3669
|
number(fontWeight);
|
|
3917
3670
|
number(fontSize);
|
|
@@ -3927,18 +3680,18 @@ const getAccurateColumnIndex = (line, fontWeight, fontSize, fontFamily, letterSp
|
|
|
3927
3680
|
const normalizedGuess = normalizeGuess(line, guess, tabSize);
|
|
3928
3681
|
const text = line.slice(0, normalizedGuess);
|
|
3929
3682
|
const normalizedText = normalizeText(text, normalize, tabSize);
|
|
3930
|
-
const actual = measureTextWidth(normalizedText, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
|
|
3683
|
+
const actual = await measureTextWidth(normalizedText, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
|
|
3931
3684
|
const isAscii$1 = isAscii(line);
|
|
3932
3685
|
if (isAscii$1) {
|
|
3933
3686
|
if (Math.abs(eventX - actual) < charWidth / 2) {
|
|
3934
3687
|
return normalizedGuess;
|
|
3935
3688
|
}
|
|
3936
|
-
return getAccurateColumnIndexAscii(line, normalizedGuess, charWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
|
|
3689
|
+
return await getAccurateColumnIndexAscii(line, normalizedGuess, charWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
|
|
3937
3690
|
}
|
|
3938
|
-
return getAccurateColumnIndexUnicode(line, normalizedGuess, charWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing);
|
|
3691
|
+
return await getAccurateColumnIndexUnicode(line, normalizedGuess, charWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing);
|
|
3939
3692
|
};
|
|
3940
3693
|
|
|
3941
|
-
const at = (editor, eventX, eventY) => {
|
|
3694
|
+
const at = async (editor, eventX, eventY) => {
|
|
3942
3695
|
object(editor);
|
|
3943
3696
|
number(eventX);
|
|
3944
3697
|
number(eventY);
|
|
@@ -3964,7 +3717,7 @@ const at = (editor, eventX, eventY) => {
|
|
|
3964
3717
|
}
|
|
3965
3718
|
const clampedRowIndex = clamp(rowIndex, 0, lines.length - 1);
|
|
3966
3719
|
const line = lines[clampedRowIndex];
|
|
3967
|
-
const columnIndex = getAccurateColumnIndex(line, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth, tabSize, eventX);
|
|
3720
|
+
const columnIndex = await getAccurateColumnIndex(line, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth, tabSize, eventX);
|
|
3968
3721
|
return {
|
|
3969
3722
|
rowIndex: clampedRowIndex,
|
|
3970
3723
|
columnIndex
|
|
@@ -4020,7 +3773,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, isError
|
|
|
4020
3773
|
const y$1 = y(editor, rowIndex);
|
|
4021
3774
|
const displayErrorMessage = message;
|
|
4022
3775
|
// @ts-ignore
|
|
4023
|
-
await invoke$
|
|
3776
|
+
await invoke$a('Editor.showOverlayMessage', editor, 'Viewlet.send', editor.uid, 'showOverlayMessage', x$1, y$1, displayErrorMessage);
|
|
4024
3777
|
if (!isError) {
|
|
4025
3778
|
const handleTimeout = () => {
|
|
4026
3779
|
editorHideMessage(editor);
|
|
@@ -4077,7 +3830,7 @@ const braceCompletion = async (editor, text) => {
|
|
|
4077
3830
|
// @ts-ignore
|
|
4078
3831
|
const offset = offsetAt(editor, editor.cursor);
|
|
4079
3832
|
// @ts-ignore
|
|
4080
|
-
const result = await invoke$
|
|
3833
|
+
const result = await invoke$a('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
|
|
4081
3834
|
if (result) {
|
|
4082
3835
|
const closingBrace = getMatchingClosingBrace$1(text);
|
|
4083
3836
|
const insertText = text + closingBrace;
|
|
@@ -4167,15 +3920,15 @@ const launchRenameWorker = async () => {
|
|
|
4167
3920
|
return rpc;
|
|
4168
3921
|
};
|
|
4169
3922
|
|
|
4170
|
-
let workerPromise$
|
|
4171
|
-
const getOrCreate$
|
|
4172
|
-
if (!workerPromise$
|
|
4173
|
-
workerPromise$
|
|
3923
|
+
let workerPromise$2;
|
|
3924
|
+
const getOrCreate$2 = () => {
|
|
3925
|
+
if (!workerPromise$2) {
|
|
3926
|
+
workerPromise$2 = launchRenameWorker();
|
|
4174
3927
|
}
|
|
4175
|
-
return workerPromise$
|
|
3928
|
+
return workerPromise$2;
|
|
4176
3929
|
};
|
|
4177
3930
|
const invoke$5 = async (method, ...params) => {
|
|
4178
|
-
const worker = await getOrCreate$
|
|
3931
|
+
const worker = await getOrCreate$2();
|
|
4179
3932
|
return await worker.invoke(method, ...params);
|
|
4180
3933
|
};
|
|
4181
3934
|
|
|
@@ -4194,7 +3947,7 @@ const closeRename = async editor => {
|
|
|
4194
3947
|
}
|
|
4195
3948
|
const renameWidget = widgets[renameWidgetIndex];
|
|
4196
3949
|
await invoke$5('Rename.close', renameWidget.newState.uid);
|
|
4197
|
-
const latest = get$
|
|
3950
|
+
const latest = get$5(uid);
|
|
4198
3951
|
const {
|
|
4199
3952
|
newState
|
|
4200
3953
|
} = latest;
|
|
@@ -4345,7 +4098,7 @@ const compositionEnd = (editor, data) => {
|
|
|
4345
4098
|
const writeText = async text => {
|
|
4346
4099
|
try {
|
|
4347
4100
|
string(text);
|
|
4348
|
-
await invoke$
|
|
4101
|
+
await invoke$a('ClipBoard.writeText', /* text */text);
|
|
4349
4102
|
} catch (error) {
|
|
4350
4103
|
throw new VError(error, 'Failed to write text to clipboard');
|
|
4351
4104
|
}
|
|
@@ -4982,7 +4735,7 @@ const deleteWordRight = editor => {
|
|
|
4982
4735
|
|
|
4983
4736
|
const findAllReferences = async editor => {
|
|
4984
4737
|
// @ts-ignore
|
|
4985
|
-
await invoke$
|
|
4738
|
+
await invoke$a('SideBar.show', 'References', /* focus */true);
|
|
4986
4739
|
return editor;
|
|
4987
4740
|
};
|
|
4988
4741
|
|
|
@@ -5070,7 +4823,7 @@ const getWordBefore = (editor, rowIndex, columnIndex) => {
|
|
|
5070
4823
|
// @ts-ignore
|
|
5071
4824
|
const getDefinition = async (editor, offset) => {
|
|
5072
4825
|
// @ts-ignore
|
|
5073
|
-
const definition = await invoke$
|
|
4826
|
+
const definition = await invoke$a('ExtensionHostDefinition.executeDefinitionProvider', editor, offset);
|
|
5074
4827
|
return definition;
|
|
5075
4828
|
};
|
|
5076
4829
|
|
|
@@ -5249,7 +5002,7 @@ const goTo = async ({
|
|
|
5249
5002
|
endRowIndex: definition.endRowIndex,
|
|
5250
5003
|
endColumnIndex: definition.endColumnIndex
|
|
5251
5004
|
};
|
|
5252
|
-
await invoke$
|
|
5005
|
+
await invoke$a(/* Main.openUri */'Main.openUri', /* uri */uri, /* focus */true, context);
|
|
5253
5006
|
return editor;
|
|
5254
5007
|
} catch (error) {
|
|
5255
5008
|
// TODO if editor is already disposed at this point, do nothing
|
|
@@ -5327,7 +5080,7 @@ const getNoLocationFoundMessage = info => {
|
|
|
5327
5080
|
|
|
5328
5081
|
const getTypeDefinition = async (editor, offset) => {
|
|
5329
5082
|
// @ts-ignore
|
|
5330
|
-
const definition = await invoke$
|
|
5083
|
+
const definition = await invoke$a('ExtensionHostTypeDefinition.executeTypeDefinitionProvider', editor, offset);
|
|
5331
5084
|
return definition;
|
|
5332
5085
|
};
|
|
5333
5086
|
|
|
@@ -5482,7 +5235,7 @@ const handleClickAtPosition = async (editor, modifier, rowIndex, columnIndex) =>
|
|
|
5482
5235
|
const Editor = 3;
|
|
5483
5236
|
|
|
5484
5237
|
const handleContextMenu = async (editor, button, x, y) => {
|
|
5485
|
-
await invoke$
|
|
5238
|
+
await invoke$a(/* ContextMenu.show */'ContextMenu.show', /* x */x, /* y */y, /* id */Editor);
|
|
5486
5239
|
return editor;
|
|
5487
5240
|
};
|
|
5488
5241
|
|
|
@@ -5511,8 +5264,8 @@ const selectWord = (editor, rowIndex, columnIndex) => {
|
|
|
5511
5264
|
return scheduleSelections(editor, newSelections);
|
|
5512
5265
|
};
|
|
5513
5266
|
|
|
5514
|
-
const handleDoubleClick = (editor, modifier, x, y) => {
|
|
5515
|
-
const position = at(editor, x, y);
|
|
5267
|
+
const handleDoubleClick = async (editor, modifier, x, y) => {
|
|
5268
|
+
const position = await at(editor, x, y);
|
|
5516
5269
|
return selectWord(editor, position.rowIndex, position.columnIndex);
|
|
5517
5270
|
};
|
|
5518
5271
|
|
|
@@ -5537,7 +5290,7 @@ const handleSingleClick = async (editor, modifier, x, y) => {
|
|
|
5537
5290
|
number(modifier);
|
|
5538
5291
|
number(x);
|
|
5539
5292
|
number(y);
|
|
5540
|
-
const position = at(editor, x, y);
|
|
5293
|
+
const position = await at(editor, x, y);
|
|
5541
5294
|
return handleClickAtPosition(editor, modifier, position.rowIndex, position.columnIndex);
|
|
5542
5295
|
};
|
|
5543
5296
|
|
|
@@ -5621,7 +5374,7 @@ const onHoverIdle = async () => {
|
|
|
5621
5374
|
y,
|
|
5622
5375
|
editor
|
|
5623
5376
|
} = get();
|
|
5624
|
-
at(editor, x, y);
|
|
5377
|
+
await at(editor, x, y);
|
|
5625
5378
|
await showHover$1();
|
|
5626
5379
|
};
|
|
5627
5380
|
const hoverDelay = 300;
|
|
@@ -5658,7 +5411,7 @@ const handleMouseMoveWithAltKey = async (editor, x, y) => {
|
|
|
5658
5411
|
object(editor);
|
|
5659
5412
|
number(x);
|
|
5660
5413
|
number(y);
|
|
5661
|
-
const position = at(editor, x, y);
|
|
5414
|
+
const position = await at(editor, x, y);
|
|
5662
5415
|
const documentOffset = offsetAt(editor, position.rowIndex, position.columnIndex);
|
|
5663
5416
|
try {
|
|
5664
5417
|
const definition = await getDefinition(editor, documentOffset);
|
|
@@ -6090,7 +5843,7 @@ const indentMore = editor => {
|
|
|
6090
5843
|
|
|
6091
5844
|
const getLanguageConfiguration = async editor => {
|
|
6092
5845
|
// @ts-ignore
|
|
6093
|
-
return invoke$
|
|
5846
|
+
return invoke$a('Languages.getLanguageConfiguration', {
|
|
6094
5847
|
uri: editor.uri,
|
|
6095
5848
|
languageId: editor.languageId
|
|
6096
5849
|
});
|
|
@@ -6213,8 +5966,8 @@ const moveRectangleSelection = (editor, position) => {
|
|
|
6213
5966
|
};
|
|
6214
5967
|
|
|
6215
5968
|
// @ts-ignore
|
|
6216
|
-
const moveRectangleSelectionPx = (editor, x, y) => {
|
|
6217
|
-
at(editor, x, y);
|
|
5969
|
+
const moveRectangleSelectionPx = async (editor, x, y) => {
|
|
5970
|
+
await at(editor, x, y);
|
|
6218
5971
|
};
|
|
6219
5972
|
|
|
6220
5973
|
const LessThan = -1;
|
|
@@ -6349,11 +6102,11 @@ const continueScrollingAndMovingSelection = async () => {
|
|
|
6349
6102
|
};
|
|
6350
6103
|
|
|
6351
6104
|
// @ts-ignore
|
|
6352
|
-
const moveSelectionPx = (editor, x, y) => {
|
|
6105
|
+
const moveSelectionPx = async (editor, x, y) => {
|
|
6353
6106
|
object(editor);
|
|
6354
6107
|
number(x);
|
|
6355
6108
|
number(y);
|
|
6356
|
-
const position = at(editor, x, y);
|
|
6109
|
+
const position = await at(editor, x, y);
|
|
6357
6110
|
if (!hasListener() && (position.rowIndex < editor.minLineY || position.rowIndex > editor.maxLineY)) {
|
|
6358
6111
|
requestAnimationFrame(continueScrollingAndMovingSelection);
|
|
6359
6112
|
setEditor(editor);
|
|
@@ -6432,25 +6185,10 @@ const create$4 = () => {
|
|
|
6432
6185
|
return completionWidget;
|
|
6433
6186
|
};
|
|
6434
6187
|
|
|
6435
|
-
const
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
const rpc = await launchWorker(name, url, intializeCommand);
|
|
6440
|
-
return rpc;
|
|
6441
|
-
};
|
|
6442
|
-
|
|
6443
|
-
let workerPromise$2;
|
|
6444
|
-
const getOrCreate$2 = () => {
|
|
6445
|
-
if (!workerPromise$2) {
|
|
6446
|
-
workerPromise$2 = launchCompletionWorker();
|
|
6447
|
-
}
|
|
6448
|
-
return workerPromise$2;
|
|
6449
|
-
};
|
|
6450
|
-
const invoke$4 = async (method, ...params) => {
|
|
6451
|
-
const worker = await getOrCreate$2();
|
|
6452
|
-
return await worker.invoke(method, ...params);
|
|
6453
|
-
};
|
|
6188
|
+
const {
|
|
6189
|
+
setFactory,
|
|
6190
|
+
invoke: invoke$4
|
|
6191
|
+
} = createLazyRpc(CompletionWorker);
|
|
6454
6192
|
|
|
6455
6193
|
const newStateGenerator$4 = async (state, parentUid) => {
|
|
6456
6194
|
const {
|
|
@@ -6462,7 +6200,7 @@ const newStateGenerator$4 = async (state, parentUid) => {
|
|
|
6462
6200
|
} = state;
|
|
6463
6201
|
const {
|
|
6464
6202
|
newState
|
|
6465
|
-
} = get$
|
|
6203
|
+
} = get$5(parentUid);
|
|
6466
6204
|
const {
|
|
6467
6205
|
languageId
|
|
6468
6206
|
} = newState;
|
|
@@ -6515,18 +6253,18 @@ const launchFindWidgetWorker = async () => {
|
|
|
6515
6253
|
const rpcId = 9002;
|
|
6516
6254
|
const launch = async () => {
|
|
6517
6255
|
// TODO race condition
|
|
6518
|
-
if (get$
|
|
6256
|
+
if (get$7(rpcId)) {
|
|
6519
6257
|
return;
|
|
6520
6258
|
}
|
|
6521
6259
|
const rpc = await launchFindWidgetWorker();
|
|
6522
|
-
set$
|
|
6260
|
+
set$b(rpcId, rpc);
|
|
6523
6261
|
};
|
|
6524
6262
|
const invoke$3 = async (method, ...params) => {
|
|
6525
|
-
const rpc = get$
|
|
6263
|
+
const rpc = get$7(rpcId);
|
|
6526
6264
|
return await rpc.invoke(method, ...params);
|
|
6527
6265
|
};
|
|
6528
6266
|
const dispose = async () => {
|
|
6529
|
-
const rpc = get$
|
|
6267
|
+
const rpc = get$7(rpcId);
|
|
6530
6268
|
remove$8(rpcId);
|
|
6531
6269
|
if (rpc) {
|
|
6532
6270
|
await rpc.dispose();
|
|
@@ -6538,7 +6276,7 @@ const dispose = async () => {
|
|
|
6538
6276
|
};
|
|
6539
6277
|
|
|
6540
6278
|
const getEditor = editorUid => {
|
|
6541
|
-
const instance = get$
|
|
6279
|
+
const instance = get$5(editorUid);
|
|
6542
6280
|
if (!instance) {
|
|
6543
6281
|
throw new Error(`editor ${editorUid} not found`);
|
|
6544
6282
|
}
|
|
@@ -6632,7 +6370,7 @@ const newStateGenerator$2 = async (state, parentUid) => {
|
|
|
6632
6370
|
} = state;
|
|
6633
6371
|
const {
|
|
6634
6372
|
newState
|
|
6635
|
-
} = get$
|
|
6373
|
+
} = get$5(parentUid);
|
|
6636
6374
|
const {
|
|
6637
6375
|
languageId
|
|
6638
6376
|
} = newState;
|
|
@@ -6686,7 +6424,7 @@ const pasteText = (editor, text) => {
|
|
|
6686
6424
|
|
|
6687
6425
|
const paste = async editor => {
|
|
6688
6426
|
// @ts-ignore
|
|
6689
|
-
const text = await invoke$
|
|
6427
|
+
const text = await invoke$a('ClipBoard.readText');
|
|
6690
6428
|
string(text);
|
|
6691
6429
|
return pasteText(editor, text);
|
|
6692
6430
|
};
|
|
@@ -6815,6 +6553,10 @@ const handleError = async error => {
|
|
|
6815
6553
|
}
|
|
6816
6554
|
};
|
|
6817
6555
|
|
|
6556
|
+
// @ts-ignore
|
|
6557
|
+
// @ts-ignore
|
|
6558
|
+
// @ts-ignore
|
|
6559
|
+
|
|
6818
6560
|
// @ts-ignore
|
|
6819
6561
|
const getNewEditor = async editor => {
|
|
6820
6562
|
return editor;
|
|
@@ -6828,7 +6570,7 @@ const save = async editor => {
|
|
|
6828
6570
|
} = editor;
|
|
6829
6571
|
const newEditor = await getNewEditor(editor);
|
|
6830
6572
|
const content = getText$1(newEditor);
|
|
6831
|
-
await invoke$
|
|
6573
|
+
await invoke$a('FileSystem.writeFile', uri, content);
|
|
6832
6574
|
return newEditor;
|
|
6833
6575
|
} catch (error) {
|
|
6834
6576
|
// @ts-ignore
|
|
@@ -7135,7 +6877,7 @@ const selectInsideString = editor => {
|
|
|
7135
6877
|
|
|
7136
6878
|
const getNewSelections = async (editor, selections) => {
|
|
7137
6879
|
// @ts-ignore
|
|
7138
|
-
const newSelections = await invoke$
|
|
6880
|
+
const newSelections = await invoke$a('ExtensionHostSelection.executeGrowSelection', editor, selections);
|
|
7139
6881
|
if (newSelections.length === 0) {
|
|
7140
6882
|
return selections;
|
|
7141
6883
|
}
|
|
@@ -7522,7 +7264,7 @@ const newStateGenerator$1 = async (state, parentUid) => {
|
|
|
7522
7264
|
} = state;
|
|
7523
7265
|
const {
|
|
7524
7266
|
newState
|
|
7525
|
-
} = get$
|
|
7267
|
+
} = get$5(parentUid);
|
|
7526
7268
|
const {
|
|
7527
7269
|
languageId
|
|
7528
7270
|
} = newState;
|
|
@@ -7542,7 +7284,7 @@ const showHover3 = async editor => {
|
|
|
7542
7284
|
|
|
7543
7285
|
const EditorHover = 'EditorHover';
|
|
7544
7286
|
const showHover = async state => {
|
|
7545
|
-
await invoke$
|
|
7287
|
+
await invoke$a('Viewlet.openWidget', EditorHover);
|
|
7546
7288
|
return state;
|
|
7547
7289
|
};
|
|
7548
7290
|
|
|
@@ -7606,7 +7348,7 @@ const newStateGenerator = async (state, parentUid) => {
|
|
|
7606
7348
|
} = state;
|
|
7607
7349
|
const {
|
|
7608
7350
|
newState
|
|
7609
|
-
} = get$
|
|
7351
|
+
} = get$5(parentUid);
|
|
7610
7352
|
const {
|
|
7611
7353
|
languageId
|
|
7612
7354
|
} = newState;
|
|
@@ -8131,9 +7873,16 @@ const toggleComment = async editor => {
|
|
|
8131
7873
|
}
|
|
8132
7874
|
};
|
|
8133
7875
|
|
|
8134
|
-
const type = (editor, text) => {
|
|
7876
|
+
const type = async (editor, text) => {
|
|
8135
7877
|
const changes = editorReplaceSelections(editor, [text], EditorType);
|
|
8136
|
-
|
|
7878
|
+
const newEditor = await scheduleDocumentAndCursorsSelections(editor, changes);
|
|
7879
|
+
if (newEditor.completionsOnType) {
|
|
7880
|
+
// TODO if completion widget is already visible, advance
|
|
7881
|
+
// TODO if character typed is space or tab or separator, close completions
|
|
7882
|
+
const withCompletion = await openCompletion(newEditor);
|
|
7883
|
+
return withCompletion;
|
|
7884
|
+
}
|
|
7885
|
+
return newEditor;
|
|
8137
7886
|
};
|
|
8138
7887
|
|
|
8139
7888
|
const Slash = '/';
|
|
@@ -8212,7 +7961,7 @@ const typeWithAutoClosingQuote = (editor, text) => {
|
|
|
8212
7961
|
const typeWithAutoClosingTag = async (editor, text) => {
|
|
8213
7962
|
const offset = offsetAt(editor, editor.selections[0], editor.selections[1]);
|
|
8214
7963
|
// @ts-ignore
|
|
8215
|
-
const result = await invoke$
|
|
7964
|
+
const result = await invoke$a('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
|
|
8216
7965
|
if (!result) {
|
|
8217
7966
|
const changes = editorReplaceSelections(editor, [text], EditorType);
|
|
8218
7967
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
@@ -8538,7 +8287,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
8538
8287
|
...state,
|
|
8539
8288
|
commands
|
|
8540
8289
|
};
|
|
8541
|
-
const latest = get$
|
|
8290
|
+
const latest = get$5(editor.uid).newState;
|
|
8542
8291
|
const newEditor = updateWidget(latest, widgetId, newState);
|
|
8543
8292
|
return newEditor;
|
|
8544
8293
|
};
|
|
@@ -8832,7 +8581,7 @@ const getHoverPositionXy = (editor, rowIndex, wordStart, documentationHeight) =>
|
|
|
8832
8581
|
};
|
|
8833
8582
|
const getEditorHoverInfo = async (editorUid, position) => {
|
|
8834
8583
|
number(editorUid);
|
|
8835
|
-
const instance = get$
|
|
8584
|
+
const instance = get$5(editorUid);
|
|
8836
8585
|
const editor = instance.newState;
|
|
8837
8586
|
const {
|
|
8838
8587
|
selections
|
|
@@ -9228,12 +8977,12 @@ const getEditorSourceActions = async editorId => {
|
|
|
9228
8977
|
}
|
|
9229
8978
|
const {
|
|
9230
8979
|
newState
|
|
9231
|
-
} = get$
|
|
8980
|
+
} = get$5(editorId);
|
|
9232
8981
|
const {
|
|
9233
8982
|
languageId
|
|
9234
8983
|
} = newState;
|
|
9235
8984
|
// @ts-ignore
|
|
9236
|
-
const allActions = await invoke$
|
|
8985
|
+
const allActions = await invoke$a('GetEditorSourceActions.getEditorSourceActions');
|
|
9237
8986
|
const filtered = filterActions(allActions, languageId);
|
|
9238
8987
|
return filtered;
|
|
9239
8988
|
};
|
|
@@ -9256,14 +9005,14 @@ const getWordAtOffset = editor => {
|
|
|
9256
9005
|
};
|
|
9257
9006
|
|
|
9258
9007
|
const setFocus = async focusKey => {
|
|
9259
|
-
await invoke$
|
|
9008
|
+
await invoke$a('Focus.setFocus', focusKey);
|
|
9260
9009
|
};
|
|
9261
9010
|
const unsetAdditionalFocus = async focusKey => {
|
|
9262
9011
|
if (!focusKey) {
|
|
9263
9012
|
return;
|
|
9264
9013
|
}
|
|
9265
9014
|
// @ts-ignore
|
|
9266
|
-
await invoke$
|
|
9015
|
+
await invoke$a('Focus.removeAdditionalFocus', focusKey);
|
|
9267
9016
|
};
|
|
9268
9017
|
|
|
9269
9018
|
const FocusEditor = 12;
|
|
@@ -9804,7 +9553,7 @@ const getProblems = async () => {
|
|
|
9804
9553
|
const keys = getKeys$1();
|
|
9805
9554
|
const editors = keys.map(key => {
|
|
9806
9555
|
const numericKey = parseInt(key);
|
|
9807
|
-
const editor = get$
|
|
9556
|
+
const editor = get$5(numericKey);
|
|
9808
9557
|
return editor;
|
|
9809
9558
|
});
|
|
9810
9559
|
const newEditors = editors.map(editor => editor.newState);
|
|
@@ -9919,7 +9668,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
9919
9668
|
commandMap: {}
|
|
9920
9669
|
});
|
|
9921
9670
|
if (rpcId) {
|
|
9922
|
-
set$
|
|
9671
|
+
set$b(rpcId, rpc);
|
|
9923
9672
|
}
|
|
9924
9673
|
};
|
|
9925
9674
|
|
|
@@ -9952,7 +9701,7 @@ const getWidgetName = widgetId => {
|
|
|
9952
9701
|
const saveWidgetState = async keys => {
|
|
9953
9702
|
const savedStates = Object.create(null);
|
|
9954
9703
|
for (const key of keys) {
|
|
9955
|
-
const editor = get$
|
|
9704
|
+
const editor = get$5(parseInt(key));
|
|
9956
9705
|
const {
|
|
9957
9706
|
widgets
|
|
9958
9707
|
} = editor.newState;
|
|
@@ -9971,7 +9720,7 @@ const restoreWidgetState = async (keys, savedStates) => {
|
|
|
9971
9720
|
const newEditors = [];
|
|
9972
9721
|
for (const key of keys) {
|
|
9973
9722
|
const editorUid = parseInt(key);
|
|
9974
|
-
const editor = get$
|
|
9723
|
+
const editor = get$5(editorUid);
|
|
9975
9724
|
const {
|
|
9976
9725
|
widgets
|
|
9977
9726
|
} = editor.newState;
|
|
@@ -10023,26 +9772,22 @@ const hotReload = async () => {
|
|
|
10023
9772
|
|
|
10024
9773
|
// TODO ask renderer worker to rerender all editors
|
|
10025
9774
|
// @ts-ignore
|
|
10026
|
-
await invoke$
|
|
9775
|
+
await invoke$a(`Editor.rerender`);
|
|
10027
9776
|
isReloading = false;
|
|
10028
9777
|
};
|
|
10029
9778
|
|
|
10030
9779
|
const sendMessagePortToExtensionHostWorker2 = async (port, initialCommand, rpcId) => {
|
|
10031
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, initialCommand, rpcId);
|
|
9780
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, initialCommand, rpcId);
|
|
10032
9781
|
};
|
|
10033
9782
|
|
|
10034
9783
|
const createExtensionHostRpc = async () => {
|
|
10035
9784
|
try {
|
|
10036
|
-
const {
|
|
10037
|
-
port1,
|
|
10038
|
-
port2
|
|
10039
|
-
} = getPortTuple();
|
|
10040
9785
|
const initialCommand = 'HandleMessagePort.handleMessagePort2';
|
|
10041
|
-
|
|
10042
|
-
await sendMessagePortToExtensionHostWorker2(port2, initialCommand, EditorWorker);
|
|
10043
|
-
const rpc = await PlainMessagePortRpcParent.create({
|
|
9786
|
+
const rpc = await TransferMessagePortRpcParent.create({
|
|
10044
9787
|
commandMap: {},
|
|
10045
|
-
|
|
9788
|
+
async send(port) {
|
|
9789
|
+
await sendMessagePortToExtensionHostWorker2(port, initialCommand, EditorWorker);
|
|
9790
|
+
}
|
|
10046
9791
|
});
|
|
10047
9792
|
return rpc;
|
|
10048
9793
|
} catch (error) {
|
|
@@ -10055,34 +9800,23 @@ const initializeExtensionHost = async () => {
|
|
|
10055
9800
|
set$1(extensionHostRpc);
|
|
10056
9801
|
};
|
|
10057
9802
|
|
|
10058
|
-
const sendMessagePortToSyntaxHighlightingWorker = async
|
|
9803
|
+
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
10059
9804
|
try {
|
|
10060
|
-
|
|
10061
|
-
port1,
|
|
10062
|
-
port2
|
|
10063
|
-
} = getPortTuple();
|
|
10064
|
-
await invokeAndTransfer(
|
|
9805
|
+
await invokeAndTransfer$1(
|
|
10065
9806
|
// @ts-ignore
|
|
10066
|
-
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker',
|
|
10067
|
-
return port2;
|
|
9807
|
+
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
10068
9808
|
} catch {
|
|
10069
|
-
|
|
10070
|
-
port1,
|
|
10071
|
-
port2
|
|
10072
|
-
} = getPortTuple();
|
|
10073
|
-
await invokeAndTransfer(
|
|
9809
|
+
await invokeAndTransfer$1(
|
|
10074
9810
|
// @ts-ignore
|
|
10075
|
-
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker',
|
|
10076
|
-
return port2;
|
|
9811
|
+
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort');
|
|
10077
9812
|
}
|
|
10078
9813
|
};
|
|
10079
9814
|
|
|
10080
9815
|
const createSyntaxHighlightingWorkerRpc = async () => {
|
|
10081
9816
|
try {
|
|
10082
|
-
const
|
|
10083
|
-
const rpc = await PlainMessagePortRpcParent.create({
|
|
9817
|
+
const rpc = await TransferMessagePortRpcParent.create({
|
|
10084
9818
|
commandMap: {},
|
|
10085
|
-
|
|
9819
|
+
send: sendMessagePortToSyntaxHighlightingWorker
|
|
10086
9820
|
});
|
|
10087
9821
|
return rpc;
|
|
10088
9822
|
} catch (error) {
|
|
@@ -10101,7 +9835,16 @@ const initializeSyntaxHighlighting = async (syntaxHighlightingEnabled, syncIncre
|
|
|
10101
9835
|
}
|
|
10102
9836
|
};
|
|
10103
9837
|
|
|
9838
|
+
const launchCompletionWorker = async () => {
|
|
9839
|
+
const name = 'Completion Worker';
|
|
9840
|
+
const url = 'completionWorkerMain.js';
|
|
9841
|
+
const intializeCommand = 'Completions.initialize';
|
|
9842
|
+
const rpc = await launchWorker(name, url, intializeCommand);
|
|
9843
|
+
return rpc;
|
|
9844
|
+
};
|
|
9845
|
+
|
|
10104
9846
|
const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
|
|
9847
|
+
setFactory(launchCompletionWorker);
|
|
10105
9848
|
await Promise.all([initializeSyntaxHighlighting(syntaxHighlightingEnabled, syncIncremental), initializeExtensionHost()]);
|
|
10106
9849
|
};
|
|
10107
9850
|
|
|
@@ -10276,21 +10019,21 @@ const getSelectionsVirtualDom = selections => {
|
|
|
10276
10019
|
};
|
|
10277
10020
|
|
|
10278
10021
|
const addWidget = widget => {
|
|
10279
|
-
const module = get$
|
|
10022
|
+
const module = get$6(widget.id);
|
|
10280
10023
|
if (!module) {
|
|
10281
10024
|
throw new Error('unsupported widget');
|
|
10282
10025
|
}
|
|
10283
10026
|
return module.add(widget);
|
|
10284
10027
|
};
|
|
10285
10028
|
const renderWidget = widget => {
|
|
10286
|
-
const module = get$
|
|
10029
|
+
const module = get$6(widget.id);
|
|
10287
10030
|
if (!module) {
|
|
10288
10031
|
throw new Error('unsupported widget');
|
|
10289
10032
|
}
|
|
10290
10033
|
return module.render(widget);
|
|
10291
10034
|
};
|
|
10292
10035
|
const removeWidget = widget => {
|
|
10293
|
-
const module = get$
|
|
10036
|
+
const module = get$6(widget.id);
|
|
10294
10037
|
if (!module) {
|
|
10295
10038
|
throw new Error('unsupported widget');
|
|
10296
10039
|
}
|
|
@@ -10326,11 +10069,11 @@ const renderSelections = {
|
|
|
10326
10069
|
isEqual(oldState, newState) {
|
|
10327
10070
|
return oldState.selections === newState.selections && oldState.focused === newState.focused && oldState.minLineY === newState.minLineY && oldState.deltaX === newState.deltaX;
|
|
10328
10071
|
},
|
|
10329
|
-
apply(oldState, newState) {
|
|
10072
|
+
apply: async (oldState, newState) => {
|
|
10330
10073
|
const {
|
|
10331
10074
|
cursorInfos,
|
|
10332
10075
|
selectionInfos
|
|
10333
|
-
} = getVisible(newState);
|
|
10076
|
+
} = await getVisible(newState);
|
|
10334
10077
|
const cursorsDom = getCursorsVirtualDom(cursorInfos);
|
|
10335
10078
|
const selectionsDom = getSelectionsVirtualDom(selectionInfos);
|
|
10336
10079
|
return [/* method */'setSelections', cursorsDom, selectionsDom];
|
|
@@ -10471,8 +10214,8 @@ const renderWidgets = {
|
|
|
10471
10214
|
multiple: true
|
|
10472
10215
|
};
|
|
10473
10216
|
const render$6 = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets, renderFocusContext, renderAdditionalFocusContext];
|
|
10474
|
-
const renderEditor = id => {
|
|
10475
|
-
const instance = get$
|
|
10217
|
+
const renderEditor = async id => {
|
|
10218
|
+
const instance = get$5(id);
|
|
10476
10219
|
if (!instance) {
|
|
10477
10220
|
return [];
|
|
10478
10221
|
}
|
|
@@ -10484,7 +10227,7 @@ const renderEditor = id => {
|
|
|
10484
10227
|
set$6(id, newState, newState);
|
|
10485
10228
|
for (const item of render$6) {
|
|
10486
10229
|
if (!item.isEqual(oldState, newState)) {
|
|
10487
|
-
const result = item.apply(oldState, newState);
|
|
10230
|
+
const result = await item.apply(oldState, newState);
|
|
10488
10231
|
// @ts-ignore
|
|
10489
10232
|
if (item.multiple) {
|
|
10490
10233
|
commands.push(...result);
|
|
@@ -10538,7 +10281,7 @@ const setDebugEnabled = (state, enabled) => {
|
|
|
10538
10281
|
};
|
|
10539
10282
|
|
|
10540
10283
|
const invoke = async (method, ...params) => {
|
|
10541
|
-
const worker = get$
|
|
10284
|
+
const worker = get$7(DebugWorker);
|
|
10542
10285
|
return worker.invoke(method, ...params);
|
|
10543
10286
|
};
|
|
10544
10287
|
|
|
@@ -10554,7 +10297,7 @@ const getKey = () => {
|
|
|
10554
10297
|
const updateDebugInfo = async debugId => {
|
|
10555
10298
|
const newInfo = await getDebugHighlight(debugId);
|
|
10556
10299
|
const key = getKey();
|
|
10557
|
-
const instance = get$
|
|
10300
|
+
const instance = get$5(key);
|
|
10558
10301
|
if (!instance) {
|
|
10559
10302
|
return;
|
|
10560
10303
|
}
|
|
@@ -10568,7 +10311,7 @@ const updateDebugInfo = async debugId => {
|
|
|
10568
10311
|
};
|
|
10569
10312
|
set$6(key, oldState, newEditor);
|
|
10570
10313
|
// @ts-ignore
|
|
10571
|
-
await invoke$
|
|
10314
|
+
await invoke$a('Editor.rerender', key);
|
|
10572
10315
|
};
|
|
10573
10316
|
|
|
10574
10317
|
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'
|
|
@@ -10602,7 +10345,7 @@ const widgetCommands = {
|
|
|
10602
10345
|
// TODO only store editor state in editor worker, not in renderer worker also
|
|
10603
10346
|
|
|
10604
10347
|
const wrapCommand = fn => async (editorUid, ...args) => {
|
|
10605
|
-
const oldInstance = get$
|
|
10348
|
+
const oldInstance = get$5(editorUid);
|
|
10606
10349
|
const state = oldInstance.newState;
|
|
10607
10350
|
const newEditor = await fn(state, ...args);
|
|
10608
10351
|
if (state === newEditor) {
|
|
@@ -10613,7 +10356,7 @@ const wrapCommand = fn => async (editorUid, ...args) => {
|
|
|
10613
10356
|
// TODO combine neweditor with latest editor?
|
|
10614
10357
|
|
|
10615
10358
|
set$6(editorUid, state, newEditor);
|
|
10616
|
-
const commands = renderEditor(editorUid);
|
|
10359
|
+
const commands = await renderEditor(editorUid);
|
|
10617
10360
|
return {
|
|
10618
10361
|
...newEditor,
|
|
10619
10362
|
commands
|
|
@@ -10873,7 +10616,7 @@ const listen = async () => {
|
|
|
10873
10616
|
const rpc = await WebWorkerRpcClient.create({
|
|
10874
10617
|
commandMap: commandMap
|
|
10875
10618
|
});
|
|
10876
|
-
set$
|
|
10619
|
+
set$9(rpc);
|
|
10877
10620
|
};
|
|
10878
10621
|
|
|
10879
10622
|
const CodeGeneratorInput = 'CodeGeneratorInput';
|