@lvce-editor/editor-worker 19.66.3 → 19.66.5
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/dist/editorWorkerMain.js +232 -163
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -733,6 +733,23 @@ const restoreMessageError = (error, _currentStack) => {
|
|
|
733
733
|
}
|
|
734
734
|
return restoredError;
|
|
735
735
|
};
|
|
736
|
+
const getFallbackMessage = error => {
|
|
737
|
+
if (error && typeof error.message === 'string' && error.message) {
|
|
738
|
+
return error.message;
|
|
739
|
+
}
|
|
740
|
+
if (error && error.data) {
|
|
741
|
+
return getFallbackMessage(error.data);
|
|
742
|
+
}
|
|
743
|
+
const stringified = String(error);
|
|
744
|
+
if (stringified !== '[object Object]') {
|
|
745
|
+
return stringified;
|
|
746
|
+
}
|
|
747
|
+
try {
|
|
748
|
+
return JSON.stringify(error);
|
|
749
|
+
} catch {
|
|
750
|
+
return stringified;
|
|
751
|
+
}
|
|
752
|
+
};
|
|
736
753
|
const restoreJsonRpcError = error => {
|
|
737
754
|
const currentStack = getCurrentStack();
|
|
738
755
|
if (error && error instanceof Error) {
|
|
@@ -741,13 +758,13 @@ const restoreJsonRpcError = error => {
|
|
|
741
758
|
if (error && error.code && error.code === MethodNotFound) {
|
|
742
759
|
return restoreMethodNotFoundError(error, currentStack);
|
|
743
760
|
}
|
|
761
|
+
if (error && error.error) {
|
|
762
|
+
return restoreJsonRpcError(error.error);
|
|
763
|
+
}
|
|
744
764
|
if (error && error.message) {
|
|
745
765
|
return restoreMessageError(error);
|
|
746
766
|
}
|
|
747
|
-
|
|
748
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
749
|
-
}
|
|
750
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
767
|
+
return new Error(`JsonRpc Error: ${getFallbackMessage(error)}`);
|
|
751
768
|
};
|
|
752
769
|
const unwrapJsonRpcResult = responseMessage => {
|
|
753
770
|
if ('error' in responseMessage) {
|
|
@@ -826,7 +843,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
826
843
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
827
844
|
return create$1$1(id, errorProperty);
|
|
828
845
|
};
|
|
829
|
-
const create$
|
|
846
|
+
const create$l = (message, result) => {
|
|
830
847
|
return {
|
|
831
848
|
id: message.id,
|
|
832
849
|
jsonrpc: Two$1,
|
|
@@ -835,7 +852,7 @@ const create$j = (message, result) => {
|
|
|
835
852
|
};
|
|
836
853
|
const getSuccessResponse = (message, result) => {
|
|
837
854
|
const resultProperty = result ?? null;
|
|
838
|
-
return create$
|
|
855
|
+
return create$l(message, resultProperty);
|
|
839
856
|
};
|
|
840
857
|
const getErrorResponseSimple = (id, error) => {
|
|
841
858
|
return {
|
|
@@ -934,7 +951,7 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
934
951
|
|
|
935
952
|
const Two = '2.0';
|
|
936
953
|
|
|
937
|
-
const create$
|
|
954
|
+
const create$k = (method, params) => {
|
|
938
955
|
return {
|
|
939
956
|
jsonrpc: Two,
|
|
940
957
|
method,
|
|
@@ -942,7 +959,7 @@ const create$i = (method, params) => {
|
|
|
942
959
|
};
|
|
943
960
|
};
|
|
944
961
|
|
|
945
|
-
const create$
|
|
962
|
+
const create$j = (id, method, params) => {
|
|
946
963
|
const message = {
|
|
947
964
|
id,
|
|
948
965
|
jsonrpc: Two,
|
|
@@ -953,12 +970,12 @@ const create$h = (id, method, params) => {
|
|
|
953
970
|
};
|
|
954
971
|
|
|
955
972
|
let id = 0;
|
|
956
|
-
const create$
|
|
973
|
+
const create$i = () => {
|
|
957
974
|
return ++id;
|
|
958
975
|
};
|
|
959
976
|
|
|
960
977
|
const registerPromise = map => {
|
|
961
|
-
const id = create$
|
|
978
|
+
const id = create$i();
|
|
962
979
|
const {
|
|
963
980
|
promise,
|
|
964
981
|
resolve
|
|
@@ -975,7 +992,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
|
|
|
975
992
|
id,
|
|
976
993
|
promise
|
|
977
994
|
} = registerPromise(callbacks);
|
|
978
|
-
const message = create$
|
|
995
|
+
const message = create$j(id, method, params);
|
|
979
996
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
980
997
|
ipc.sendAndTransfer(message);
|
|
981
998
|
} else {
|
|
@@ -1011,7 +1028,7 @@ const createRpc = ipc => {
|
|
|
1011
1028
|
* @deprecated
|
|
1012
1029
|
*/
|
|
1013
1030
|
send(method, ...params) {
|
|
1014
|
-
const message = create$
|
|
1031
|
+
const message = create$k(method, params);
|
|
1015
1032
|
ipc.send(message);
|
|
1016
1033
|
}
|
|
1017
1034
|
};
|
|
@@ -1079,7 +1096,7 @@ const createSharedLazyRpc = factory => {
|
|
|
1079
1096
|
};
|
|
1080
1097
|
};
|
|
1081
1098
|
|
|
1082
|
-
const create$
|
|
1099
|
+
const create$h = async ({
|
|
1083
1100
|
commandMap,
|
|
1084
1101
|
isMessagePortOpen = true,
|
|
1085
1102
|
messagePort
|
|
@@ -1097,7 +1114,7 @@ const create$f = async ({
|
|
|
1097
1114
|
return rpc;
|
|
1098
1115
|
};
|
|
1099
1116
|
|
|
1100
|
-
const create$
|
|
1117
|
+
const create$g = async ({
|
|
1101
1118
|
commandMap,
|
|
1102
1119
|
isMessagePortOpen,
|
|
1103
1120
|
send
|
|
@@ -1107,20 +1124,20 @@ const create$e = async ({
|
|
|
1107
1124
|
port2
|
|
1108
1125
|
} = new MessageChannel();
|
|
1109
1126
|
await send(port1);
|
|
1110
|
-
return create$
|
|
1127
|
+
return create$h({
|
|
1111
1128
|
commandMap,
|
|
1112
1129
|
isMessagePortOpen,
|
|
1113
1130
|
messagePort: port2
|
|
1114
1131
|
});
|
|
1115
1132
|
};
|
|
1116
1133
|
|
|
1117
|
-
const create$
|
|
1134
|
+
const create$f = async ({
|
|
1118
1135
|
commandMap,
|
|
1119
1136
|
isMessagePortOpen,
|
|
1120
1137
|
send
|
|
1121
1138
|
}) => {
|
|
1122
1139
|
return createSharedLazyRpc(() => {
|
|
1123
|
-
return create$
|
|
1140
|
+
return create$g({
|
|
1124
1141
|
commandMap,
|
|
1125
1142
|
isMessagePortOpen,
|
|
1126
1143
|
send
|
|
@@ -1128,17 +1145,17 @@ const create$d = async ({
|
|
|
1128
1145
|
});
|
|
1129
1146
|
};
|
|
1130
1147
|
|
|
1131
|
-
const create$
|
|
1148
|
+
const create$e = async ({
|
|
1132
1149
|
commandMap,
|
|
1133
1150
|
messagePort
|
|
1134
1151
|
}) => {
|
|
1135
|
-
return create$
|
|
1152
|
+
return create$h({
|
|
1136
1153
|
commandMap,
|
|
1137
1154
|
messagePort
|
|
1138
1155
|
});
|
|
1139
1156
|
};
|
|
1140
1157
|
|
|
1141
|
-
const create$
|
|
1158
|
+
const create$d = async ({
|
|
1142
1159
|
commandMap
|
|
1143
1160
|
}) => {
|
|
1144
1161
|
// TODO create a commandMap per rpc instance
|
|
@@ -1181,7 +1198,7 @@ const remove$8 = id => {
|
|
|
1181
1198
|
};
|
|
1182
1199
|
|
|
1183
1200
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1184
|
-
const create$
|
|
1201
|
+
const create$c = rpcId => {
|
|
1185
1202
|
return {
|
|
1186
1203
|
async dispose() {
|
|
1187
1204
|
const rpc = get$9(rpcId);
|
|
@@ -1310,26 +1327,26 @@ const SetPatches = 'Viewlet.setPatches';
|
|
|
1310
1327
|
const FocusEditorText$1 = 12;
|
|
1311
1328
|
|
|
1312
1329
|
const {
|
|
1313
|
-
invoke: invoke$
|
|
1330
|
+
invoke: invoke$j,
|
|
1314
1331
|
set: set$g
|
|
1315
|
-
} = create$
|
|
1332
|
+
} = create$c(DialogWorker);
|
|
1316
1333
|
|
|
1317
1334
|
const {
|
|
1318
|
-
invoke: invoke$
|
|
1335
|
+
invoke: invoke$i,
|
|
1319
1336
|
set: set$f
|
|
1320
|
-
} = create$
|
|
1337
|
+
} = create$c(DragAndDropWorker);
|
|
1321
1338
|
|
|
1322
1339
|
const {
|
|
1323
|
-
invoke: invoke$
|
|
1340
|
+
invoke: invoke$h,
|
|
1324
1341
|
set: set$e
|
|
1325
|
-
} = create$
|
|
1342
|
+
} = create$c(ErrorWorker);
|
|
1326
1343
|
|
|
1327
1344
|
const {
|
|
1328
|
-
invoke: invoke$
|
|
1345
|
+
invoke: invoke$g,
|
|
1329
1346
|
set: set$d
|
|
1330
|
-
} = create$
|
|
1347
|
+
} = create$c(ExtensionManagementWorker);
|
|
1331
1348
|
const getLanguages$1 = (platform, assetDir) => {
|
|
1332
|
-
return invoke$
|
|
1349
|
+
return invoke$g('Extensions.getLanguages', platform, assetDir);
|
|
1333
1350
|
};
|
|
1334
1351
|
|
|
1335
1352
|
const createLazyRpc = rpcId => {
|
|
@@ -1406,29 +1423,29 @@ const createLazyRpc = rpcId => {
|
|
|
1406
1423
|
};
|
|
1407
1424
|
|
|
1408
1425
|
const {
|
|
1409
|
-
invoke: invoke$
|
|
1426
|
+
invoke: invoke$f,
|
|
1410
1427
|
set: set$c
|
|
1411
|
-
} = create$
|
|
1428
|
+
} = create$c(OpenerWorker);
|
|
1412
1429
|
const openUrl = async (url, platform) => {
|
|
1413
|
-
return invoke$
|
|
1430
|
+
return invoke$f('Open.openUrl', url, platform);
|
|
1414
1431
|
};
|
|
1415
1432
|
|
|
1416
1433
|
const {
|
|
1417
|
-
invoke: invoke$
|
|
1434
|
+
invoke: invoke$e,
|
|
1418
1435
|
set: set$b
|
|
1419
|
-
} = create$
|
|
1436
|
+
} = create$c(TextMeasurementWorker);
|
|
1420
1437
|
|
|
1421
1438
|
const {
|
|
1422
|
-
invoke: invoke$
|
|
1439
|
+
invoke: invoke$d,
|
|
1423
1440
|
invokeAndTransfer,
|
|
1424
1441
|
set: set$a
|
|
1425
|
-
} = create$
|
|
1442
|
+
} = create$c(RendererWorker);
|
|
1426
1443
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1427
1444
|
number(uid);
|
|
1428
1445
|
number(menuId);
|
|
1429
1446
|
number(x);
|
|
1430
1447
|
number(y);
|
|
1431
|
-
await invoke$
|
|
1448
|
+
await invoke$d('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1432
1449
|
};
|
|
1433
1450
|
const sendMessagePortToDragAndDropWorker = async port => {
|
|
1434
1451
|
const command = 'DragAndDrop.handleMessagePort';
|
|
@@ -1446,14 +1463,11 @@ const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
|
1446
1463
|
const command = 'Errors.handleMessagePort';
|
|
1447
1464
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1448
1465
|
};
|
|
1449
|
-
const readFile$1 = async uri => {
|
|
1450
|
-
return invoke$c('FileSystem.readFile', uri);
|
|
1451
|
-
};
|
|
1452
1466
|
const writeClipBoardText = async text => {
|
|
1453
|
-
await invoke$
|
|
1467
|
+
await invoke$d('ClipBoard.writeText', /* text */text);
|
|
1454
1468
|
};
|
|
1455
1469
|
const readClipBoardText = async () => {
|
|
1456
|
-
return invoke$
|
|
1470
|
+
return invoke$d('ClipBoard.readText');
|
|
1457
1471
|
};
|
|
1458
1472
|
const sendMessagePortToTextMeasurementWorker = async port => {
|
|
1459
1473
|
const command = 'TextMeasurement.handleMessagePort';
|
|
@@ -1464,10 +1478,10 @@ const sendMessagePortToExtensionManagementWorker$1 = async (port, rpcId) => {
|
|
|
1464
1478
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
|
|
1465
1479
|
};
|
|
1466
1480
|
const getPreference = async key => {
|
|
1467
|
-
return await invoke$
|
|
1481
|
+
return await invoke$d('Preferences.get', key);
|
|
1468
1482
|
};
|
|
1469
1483
|
const openUri = async (uri, focus, options) => {
|
|
1470
|
-
await invoke$
|
|
1484
|
+
await invoke$d('Main.openUri', {
|
|
1471
1485
|
...options,
|
|
1472
1486
|
focus,
|
|
1473
1487
|
uri
|
|
@@ -1478,13 +1492,13 @@ const sendMessagePortToSyntaxHighlightingWorker$1 = async port => {
|
|
|
1478
1492
|
};
|
|
1479
1493
|
|
|
1480
1494
|
const {
|
|
1481
|
-
invoke: invoke$
|
|
1495
|
+
invoke: invoke$c,
|
|
1482
1496
|
set: set$9
|
|
1483
|
-
} = create$
|
|
1497
|
+
} = create$c(MarkdownWorker);
|
|
1484
1498
|
|
|
1485
1499
|
const SyntaxHighlightingWorker = {
|
|
1486
1500
|
__proto__: null,
|
|
1487
|
-
invoke: invoke$
|
|
1501
|
+
invoke: invoke$c,
|
|
1488
1502
|
set: set$9
|
|
1489
1503
|
};
|
|
1490
1504
|
|
|
@@ -1492,7 +1506,7 @@ const toCommandId = key => {
|
|
|
1492
1506
|
const dotIndex = key.indexOf('.');
|
|
1493
1507
|
return key.slice(dotIndex + 1);
|
|
1494
1508
|
};
|
|
1495
|
-
const create$
|
|
1509
|
+
const create$b = () => {
|
|
1496
1510
|
const commandQueues = new Map();
|
|
1497
1511
|
const generations = Object.create(null);
|
|
1498
1512
|
const states = Object.create(null);
|
|
@@ -1755,7 +1769,7 @@ const activateByEvent = async (event, assetDir, platform) => {
|
|
|
1755
1769
|
string(event);
|
|
1756
1770
|
// Assert.string(assetDir)
|
|
1757
1771
|
// Assert.number(platform)
|
|
1758
|
-
await invoke$
|
|
1772
|
+
await invoke$g('Extensions.activateByEvent', event);
|
|
1759
1773
|
};
|
|
1760
1774
|
|
|
1761
1775
|
const codeGeneratorAccept = state => {
|
|
@@ -1782,9 +1796,9 @@ const toEditorValue = (value, originalValue) => {
|
|
|
1782
1796
|
return `0x${match[1]}`;
|
|
1783
1797
|
};
|
|
1784
1798
|
|
|
1785
|
-
const editorStates = create$
|
|
1799
|
+
const editorStates = create$b();
|
|
1786
1800
|
const {
|
|
1787
|
-
dispose: dispose$
|
|
1801
|
+
dispose: dispose$6,
|
|
1788
1802
|
getCommandIds,
|
|
1789
1803
|
registerCommands,
|
|
1790
1804
|
wrapGetter
|
|
@@ -2403,7 +2417,7 @@ const getInitialLineState = initialLineState => {
|
|
|
2403
2417
|
return deepCopy(initialLineState);
|
|
2404
2418
|
};
|
|
2405
2419
|
|
|
2406
|
-
const state$
|
|
2420
|
+
const state$e = {
|
|
2407
2421
|
warned: []
|
|
2408
2422
|
};
|
|
2409
2423
|
const flattenTokensArray = tokens => {
|
|
@@ -2415,10 +2429,10 @@ const flattenTokensArray = tokens => {
|
|
|
2415
2429
|
return flattened;
|
|
2416
2430
|
};
|
|
2417
2431
|
const warnDeprecatedArrayReturn = (languageId, fn) => {
|
|
2418
|
-
if (state$
|
|
2432
|
+
if (state$e.warned.includes(fn)) {
|
|
2419
2433
|
return;
|
|
2420
2434
|
}
|
|
2421
|
-
state$
|
|
2435
|
+
state$e.warned.push(fn);
|
|
2422
2436
|
console.warn(`tokenizers without hasArrayReturn=false are deprecated (language ${languageId})`);
|
|
2423
2437
|
};
|
|
2424
2438
|
const safeTokenizeLine = (languageId, tokenizeLine, line, lineStateAtStart, hasArrayReturn) => {
|
|
@@ -2479,40 +2493,40 @@ const TokenizePlainText = {
|
|
|
2479
2493
|
tokenizeLine
|
|
2480
2494
|
};
|
|
2481
2495
|
|
|
2482
|
-
const state$
|
|
2496
|
+
const state$d = {
|
|
2483
2497
|
enabled: false
|
|
2484
2498
|
};
|
|
2485
2499
|
const setEnabled$1 = value => {
|
|
2486
|
-
state$
|
|
2500
|
+
state$d.enabled = value;
|
|
2487
2501
|
};
|
|
2488
2502
|
const getEnabled$1 = () => {
|
|
2489
|
-
return state$
|
|
2503
|
+
return state$d.enabled;
|
|
2490
2504
|
};
|
|
2491
2505
|
|
|
2492
2506
|
const {
|
|
2493
|
-
invoke: invoke$
|
|
2507
|
+
invoke: invoke$b,
|
|
2494
2508
|
set: set$6
|
|
2495
2509
|
} = SyntaxHighlightingWorker;
|
|
2496
2510
|
|
|
2497
|
-
const state$
|
|
2511
|
+
const state$c = {
|
|
2498
2512
|
pending: Object.create(null),
|
|
2499
2513
|
tokenizePaths: Object.create(null),
|
|
2500
2514
|
tokenizers: Object.create(null)
|
|
2501
2515
|
};
|
|
2502
2516
|
const has = languageId => {
|
|
2503
|
-
return Object.hasOwn(state$
|
|
2517
|
+
return Object.hasOwn(state$c.tokenizers, languageId);
|
|
2504
2518
|
};
|
|
2505
2519
|
const set$5 = (languageId, tokenizer) => {
|
|
2506
|
-
state$
|
|
2520
|
+
state$c.tokenizers[languageId] = tokenizer;
|
|
2507
2521
|
};
|
|
2508
2522
|
const get$6 = languageId => {
|
|
2509
|
-
return state$
|
|
2523
|
+
return state$c.tokenizers[languageId];
|
|
2510
2524
|
};
|
|
2511
2525
|
const setTokenizePath = (languageId, tokenizePath) => {
|
|
2512
|
-
state$
|
|
2526
|
+
state$c.tokenizePaths[languageId] = tokenizePath;
|
|
2513
2527
|
};
|
|
2514
2528
|
const getTokenizePath$1 = languageId => {
|
|
2515
|
-
return state$
|
|
2529
|
+
return state$c.tokenizePaths[languageId] || '';
|
|
2516
2530
|
};
|
|
2517
2531
|
const setTokenizePaths = languages => {
|
|
2518
2532
|
for (const language of languages) {
|
|
@@ -2522,7 +2536,7 @@ const setTokenizePaths = languages => {
|
|
|
2522
2536
|
}
|
|
2523
2537
|
};
|
|
2524
2538
|
const isPending = languageId => {
|
|
2525
|
-
return Object.hasOwn(state$
|
|
2539
|
+
return Object.hasOwn(state$c.pending, languageId);
|
|
2526
2540
|
};
|
|
2527
2541
|
|
|
2528
2542
|
const tokenMaps = Object.create(null);
|
|
@@ -2541,7 +2555,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
2541
2555
|
setTokenizePath(languageId, tokenizePath);
|
|
2542
2556
|
if (getEnabled$1()) {
|
|
2543
2557
|
// @ts-ignore
|
|
2544
|
-
const tokenMap = await invoke$
|
|
2558
|
+
const tokenMap = await invoke$b('Tokenizer.load', languageId, tokenizePath);
|
|
2545
2559
|
set$4(languageId, tokenMap);
|
|
2546
2560
|
return;
|
|
2547
2561
|
}
|
|
@@ -2705,10 +2719,18 @@ const getTokensViewport = (editor, startLineIndex, endLineIndex) => {
|
|
|
2705
2719
|
};
|
|
2706
2720
|
};
|
|
2707
2721
|
|
|
2708
|
-
const sentLines = Object.create(null);
|
|
2709
|
-
|
|
2710
2722
|
// TODO only send changed lines to renderer process instead of all lines in viewport
|
|
2711
2723
|
const getTokensViewport2 = async (editor, startLineIndex, endLineIndex, syncIncremental) => {
|
|
2724
|
+
const {
|
|
2725
|
+
lifecycle
|
|
2726
|
+
} = editor;
|
|
2727
|
+
if (lifecycle?.disposed) {
|
|
2728
|
+
return {
|
|
2729
|
+
embeddedResults: [],
|
|
2730
|
+
tokenizersToLoad: [],
|
|
2731
|
+
tokens: []
|
|
2732
|
+
};
|
|
2733
|
+
}
|
|
2712
2734
|
if (getEnabled$1()) {
|
|
2713
2735
|
if (syncIncremental) {
|
|
2714
2736
|
const {
|
|
@@ -2719,23 +2741,23 @@ const getTokensViewport2 = async (editor, startLineIndex, endLineIndex, syncIncr
|
|
|
2719
2741
|
} = editor;
|
|
2720
2742
|
let hasLinesToSend = true;
|
|
2721
2743
|
let linesToSend = lines;
|
|
2722
|
-
if (sentLines
|
|
2744
|
+
if (lifecycle?.sentLines === lines) {
|
|
2723
2745
|
hasLinesToSend = false;
|
|
2724
2746
|
linesToSend = [];
|
|
2725
|
-
} else {
|
|
2726
|
-
sentLines
|
|
2747
|
+
} else if (lifecycle) {
|
|
2748
|
+
lifecycle.sentLines = lines;
|
|
2727
2749
|
}
|
|
2728
2750
|
const slimEditor = {
|
|
2729
2751
|
invalidStartIndex,
|
|
2730
2752
|
languageId
|
|
2731
2753
|
};
|
|
2732
|
-
return invoke$
|
|
2754
|
+
return invoke$b('GetTokensViewport.getTokensViewport', slimEditor,
|
|
2733
2755
|
// @ts-ignore
|
|
2734
2756
|
startLineIndex, endLineIndex, hasLinesToSend, id, linesToSend);
|
|
2735
2757
|
}
|
|
2736
2758
|
// TODO only send needed lines of text
|
|
2737
2759
|
// @ts-ignore
|
|
2738
|
-
return invoke$
|
|
2760
|
+
return invoke$b('GetTokensViewport.getTokensViewport', editor, startLineIndex, endLineIndex, true, editor.id, editor.lines);
|
|
2739
2761
|
}
|
|
2740
2762
|
return getTokensViewport(editor, startLineIndex, endLineIndex);
|
|
2741
2763
|
};
|
|
@@ -3353,14 +3375,14 @@ const getVisible$1 = async (editor, syncIncremental) => {
|
|
|
3353
3375
|
};
|
|
3354
3376
|
};
|
|
3355
3377
|
|
|
3356
|
-
const state$
|
|
3378
|
+
const state$b = {
|
|
3357
3379
|
enabled: false
|
|
3358
3380
|
};
|
|
3359
3381
|
const setEnabled = value => {
|
|
3360
|
-
state$
|
|
3382
|
+
state$b.enabled = value;
|
|
3361
3383
|
};
|
|
3362
3384
|
const getEnabled = () => {
|
|
3363
|
-
return state$
|
|
3385
|
+
return state$b.enabled;
|
|
3364
3386
|
};
|
|
3365
3387
|
|
|
3366
3388
|
// TODO this should be in a separate scrolling module
|
|
@@ -3410,7 +3432,7 @@ const setDeltaY$1 = async (state, value) => {
|
|
|
3410
3432
|
const emptyIncrementalEdits = [];
|
|
3411
3433
|
|
|
3412
3434
|
const getIncrementalEdits = async (oldState, newState) => {
|
|
3413
|
-
if (!newState.undoStack) {
|
|
3435
|
+
if (newState.lifecycle?.disposed || !newState.undoStack) {
|
|
3414
3436
|
return emptyIncrementalEdits;
|
|
3415
3437
|
}
|
|
3416
3438
|
if (oldState.undoStack === newState.undoStack) {
|
|
@@ -3429,7 +3451,7 @@ const getIncrementalEdits = async (oldState, newState) => {
|
|
|
3429
3451
|
const oldLine = oldState.lines[rowIndex];
|
|
3430
3452
|
const newLine = lines[rowIndex];
|
|
3431
3453
|
// @ts-ignore
|
|
3432
|
-
const incrementalEdits = await invoke$
|
|
3454
|
+
const incrementalEdits = await invoke$b(
|
|
3433
3455
|
// @ts-ignore
|
|
3434
3456
|
'TokenizeIncremental.tokenizeIncremental', newState.uid,
|
|
3435
3457
|
// @ts-ignore
|
|
@@ -3649,7 +3671,7 @@ const start = delivery => {
|
|
|
3649
3671
|
delivery.running = run$1(delivery);
|
|
3650
3672
|
return delivery.running;
|
|
3651
3673
|
};
|
|
3652
|
-
const dispose$
|
|
3674
|
+
const dispose$5 = rpcId => {
|
|
3653
3675
|
const delivery = deliveries.get(rpcId);
|
|
3654
3676
|
if (delivery) {
|
|
3655
3677
|
delivery.disposed = true;
|
|
@@ -3659,7 +3681,7 @@ const dispose$4 = rpcId => {
|
|
|
3659
3681
|
const send$2 = (rpcId, rpc, status) => {
|
|
3660
3682
|
let delivery = deliveries.get(rpcId);
|
|
3661
3683
|
if (!delivery || delivery.rpc !== rpc) {
|
|
3662
|
-
dispose$
|
|
3684
|
+
dispose$5(rpcId);
|
|
3663
3685
|
delivery = {
|
|
3664
3686
|
baseline: undefined,
|
|
3665
3687
|
disposed: false,
|
|
@@ -3677,7 +3699,7 @@ const send$2 = (rpcId, rpc, status) => {
|
|
|
3677
3699
|
return delivery.running || start(delivery);
|
|
3678
3700
|
};
|
|
3679
3701
|
|
|
3680
|
-
const state$
|
|
3702
|
+
const state$a = Object.create(null);
|
|
3681
3703
|
|
|
3682
3704
|
/**
|
|
3683
3705
|
* Register a listener for a specific event type
|
|
@@ -3687,13 +3709,13 @@ const state$9 = Object.create(null);
|
|
|
3687
3709
|
const registerListener$1 = (listenerType, rpcId) => {
|
|
3688
3710
|
number(listenerType);
|
|
3689
3711
|
number(rpcId);
|
|
3690
|
-
if (!Object.hasOwn(state$
|
|
3691
|
-
state$
|
|
3712
|
+
if (!Object.hasOwn(state$a, listenerType)) {
|
|
3713
|
+
state$a[listenerType] = [];
|
|
3692
3714
|
}
|
|
3693
3715
|
|
|
3694
3716
|
// Avoid duplicate registrations
|
|
3695
|
-
if (!state$
|
|
3696
|
-
state$
|
|
3717
|
+
if (!state$a[listenerType].includes(rpcId)) {
|
|
3718
|
+
state$a[listenerType].push(rpcId);
|
|
3697
3719
|
}
|
|
3698
3720
|
};
|
|
3699
3721
|
|
|
@@ -3706,12 +3728,12 @@ const unregisterListener$1 = (listenerType, rpcId) => {
|
|
|
3706
3728
|
number(listenerType);
|
|
3707
3729
|
number(rpcId);
|
|
3708
3730
|
if (listenerType === EditorSelection$1) {
|
|
3709
|
-
dispose$
|
|
3731
|
+
dispose$5(rpcId);
|
|
3710
3732
|
}
|
|
3711
|
-
if (Object.hasOwn(state$
|
|
3712
|
-
const index = state$
|
|
3733
|
+
if (Object.hasOwn(state$a, listenerType)) {
|
|
3734
|
+
const index = state$a[listenerType].indexOf(rpcId);
|
|
3713
3735
|
if (index !== -1) {
|
|
3714
|
-
state$
|
|
3736
|
+
state$a[listenerType].splice(index, 1);
|
|
3715
3737
|
}
|
|
3716
3738
|
}
|
|
3717
3739
|
};
|
|
@@ -3723,7 +3745,7 @@ const unregisterListener$1 = (listenerType, rpcId) => {
|
|
|
3723
3745
|
*/
|
|
3724
3746
|
const getListeners = listenerType => {
|
|
3725
3747
|
number(listenerType);
|
|
3726
|
-
return state$
|
|
3748
|
+
return state$a[listenerType] || [];
|
|
3727
3749
|
};
|
|
3728
3750
|
|
|
3729
3751
|
/**
|
|
@@ -3822,11 +3844,31 @@ const splitLines = lines => {
|
|
|
3822
3844
|
return lines.split('\n');
|
|
3823
3845
|
};
|
|
3824
3846
|
|
|
3847
|
+
const state$9 = {};
|
|
3848
|
+
const create$a = () => create$g({
|
|
3849
|
+
commandMap: {},
|
|
3850
|
+
send: port => invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, 'FileSystem.connect')
|
|
3851
|
+
});
|
|
3852
|
+
const invoke$a = async (method, ...args) => {
|
|
3853
|
+
state$9.rpcPromise ||= create$a();
|
|
3854
|
+
let rpc;
|
|
3855
|
+
try {
|
|
3856
|
+
const {
|
|
3857
|
+
rpcPromise
|
|
3858
|
+
} = state$9;
|
|
3859
|
+
rpc = await rpcPromise;
|
|
3860
|
+
} catch (error) {
|
|
3861
|
+
delete state$9.rpcPromise;
|
|
3862
|
+
throw error;
|
|
3863
|
+
}
|
|
3864
|
+
return rpc.invoke(method, ...args);
|
|
3865
|
+
};
|
|
3866
|
+
|
|
3825
3867
|
const invoke$9 = async (applicationId, method, ...args) => {
|
|
3826
|
-
return applicationId === undefined ? invoke$
|
|
3868
|
+
return applicationId === undefined ? invoke$d(method, ...args) : invoke$d('Application.execute', applicationId, method, ...args);
|
|
3827
3869
|
};
|
|
3828
3870
|
const readFile = async (applicationId, uri) => {
|
|
3829
|
-
return applicationId === undefined ?
|
|
3871
|
+
return applicationId === undefined ? invoke$a('FileSystem.readFile', uri) : invoke$a('ApplicationFileSystem.execute', applicationId, 'readFile', uri);
|
|
3830
3872
|
};
|
|
3831
3873
|
|
|
3832
3874
|
const notifyTabModifiedStatusChange = async (uri, modified, applicationId) => {
|
|
@@ -3868,7 +3910,7 @@ const measureTextWidthFast = async (text, charWidth) => {
|
|
|
3868
3910
|
};
|
|
3869
3911
|
|
|
3870
3912
|
const measureTextWidthSlow = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
3871
|
-
const width = await invoke$
|
|
3913
|
+
const width = await invoke$e('TextMeasurement.measureTextWidth', text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
|
|
3872
3914
|
return width;
|
|
3873
3915
|
};
|
|
3874
3916
|
|
|
@@ -4574,7 +4616,7 @@ const updateColorPickerValue$1 = async (editor, value) => {
|
|
|
4574
4616
|
};
|
|
4575
4617
|
|
|
4576
4618
|
const invoke$8 = async (applicationId, method, ...args) => {
|
|
4577
|
-
return applicationId === undefined ? invoke$
|
|
4619
|
+
return applicationId === undefined ? invoke$g(method, ...args) : invoke$g('Extensions.invokeForApplication', applicationId, method, ...args);
|
|
4578
4620
|
};
|
|
4579
4621
|
|
|
4580
4622
|
const validTypes = new Set(['added', 'deleted', 'modified']);
|
|
@@ -5174,7 +5216,7 @@ const getColorPickerWorkerCommandMap = () => ({
|
|
|
5174
5216
|
const ModuleWorkerAndWorkaroundForChromeDevtoolsBug = 6;
|
|
5175
5217
|
|
|
5176
5218
|
const launchWorker = async (name, url, intializeCommand, commandMap = {}) => {
|
|
5177
|
-
const rpc = await create$
|
|
5219
|
+
const rpc = await create$g({
|
|
5178
5220
|
commandMap,
|
|
5179
5221
|
isMessagePortOpen: true,
|
|
5180
5222
|
async send(port) {
|
|
@@ -5230,6 +5272,10 @@ const loadContent$3 = async (state, parentUid) => {
|
|
|
5230
5272
|
};
|
|
5231
5273
|
};
|
|
5232
5274
|
|
|
5275
|
+
const create$9 = () => ({
|
|
5276
|
+
disposed: false
|
|
5277
|
+
});
|
|
5278
|
+
|
|
5233
5279
|
const ColorPicker = 41;
|
|
5234
5280
|
const EditorCompletion = 9;
|
|
5235
5281
|
const Empty = 0;
|
|
@@ -5310,6 +5356,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir, _langua
|
|
|
5310
5356
|
itemHeight: 20,
|
|
5311
5357
|
languageId: '',
|
|
5312
5358
|
letterSpacing: 0,
|
|
5359
|
+
lifecycle: create$9(),
|
|
5313
5360
|
lightBulbRowIndex: -1,
|
|
5314
5361
|
lineCache: [],
|
|
5315
5362
|
lineNumbers: false,
|
|
@@ -5530,7 +5577,7 @@ const get$3 = async key => {
|
|
|
5530
5577
|
return value;
|
|
5531
5578
|
};
|
|
5532
5579
|
const update = async settings => {
|
|
5533
|
-
await invoke$
|
|
5580
|
+
await invoke$d('Preferences.update', settings);
|
|
5534
5581
|
};
|
|
5535
5582
|
|
|
5536
5583
|
const createEditor = async ({
|
|
@@ -5629,6 +5676,7 @@ const createEditor = async ({
|
|
|
5629
5676
|
itemHeight: 20,
|
|
5630
5677
|
languageId: computedlanguageId,
|
|
5631
5678
|
letterSpacing,
|
|
5679
|
+
lifecycle: create$9(),
|
|
5632
5680
|
lineCache: [],
|
|
5633
5681
|
lineNumbers,
|
|
5634
5682
|
lines: [],
|
|
@@ -5790,7 +5838,9 @@ const createStandaloneEditor = async ({
|
|
|
5790
5838
|
cursorInfos,
|
|
5791
5839
|
selectionInfos
|
|
5792
5840
|
};
|
|
5793
|
-
|
|
5841
|
+
if (!createdEditor.lifecycle?.disposed) {
|
|
5842
|
+
set$8(id, createdEditor, finalEditor);
|
|
5843
|
+
}
|
|
5794
5844
|
};
|
|
5795
5845
|
|
|
5796
5846
|
const isEqual$5 = (oldState, newState) => {
|
|
@@ -5876,7 +5926,7 @@ const run = async (uid, token, save) => {
|
|
|
5876
5926
|
await save(token);
|
|
5877
5927
|
};
|
|
5878
5928
|
const schedule = (uid, save) => {
|
|
5879
|
-
dispose$
|
|
5929
|
+
dispose$4(uid);
|
|
5880
5930
|
const token = ++state$7.nextToken;
|
|
5881
5931
|
const timeout = setTimeout(run, autoSaveDelay, uid, token, save);
|
|
5882
5932
|
pendingSaves.set(uid, {
|
|
@@ -5891,9 +5941,9 @@ const consume = (uid, token) => {
|
|
|
5891
5941
|
if (!isLatest(uid, token)) {
|
|
5892
5942
|
return;
|
|
5893
5943
|
}
|
|
5894
|
-
dispose$
|
|
5944
|
+
dispose$4(uid);
|
|
5895
5945
|
};
|
|
5896
|
-
const dispose$
|
|
5946
|
+
const dispose$4 = uid => {
|
|
5897
5947
|
const pendingSave = pendingSaves.get(uid);
|
|
5898
5948
|
if (!pendingSave) {
|
|
5899
5949
|
return;
|
|
@@ -6016,8 +6066,8 @@ const invoke$6 = async (method, ...params) => {
|
|
|
6016
6066
|
const worker = await workerPromise;
|
|
6017
6067
|
return await worker.invoke(method, ...params);
|
|
6018
6068
|
};
|
|
6019
|
-
const dispose$
|
|
6020
|
-
if (getKeys$2().
|
|
6069
|
+
const dispose$3 = async () => {
|
|
6070
|
+
if (getKeys$2().some(uid => get$8(Number(uid))?.newState.widgets?.some(widget => widget.id === Rename$1))) {
|
|
6021
6071
|
return;
|
|
6022
6072
|
}
|
|
6023
6073
|
const promise = workerPromise;
|
|
@@ -6029,6 +6079,17 @@ const dispose$2 = async () => {
|
|
|
6029
6079
|
} catch {}
|
|
6030
6080
|
};
|
|
6031
6081
|
|
|
6082
|
+
const renderedDoms = new Map();
|
|
6083
|
+
const get$1 = uid => {
|
|
6084
|
+
return renderedDoms.get(uid);
|
|
6085
|
+
};
|
|
6086
|
+
const set$1 = (uid, dom) => {
|
|
6087
|
+
renderedDoms.set(uid, dom);
|
|
6088
|
+
};
|
|
6089
|
+
const dispose$2 = uid => {
|
|
6090
|
+
renderedDoms.delete(uid);
|
|
6091
|
+
};
|
|
6092
|
+
|
|
6032
6093
|
const addWidget$1 = widget => {
|
|
6033
6094
|
const module = get$7(widget.id);
|
|
6034
6095
|
if (!module) {
|
|
@@ -6050,11 +6111,11 @@ const next = editorUid => {
|
|
|
6050
6111
|
revisions.set(editorUid, revision);
|
|
6051
6112
|
return revision;
|
|
6052
6113
|
};
|
|
6053
|
-
const get
|
|
6114
|
+
const get = editorUid => {
|
|
6054
6115
|
return revisions.get(editorUid) || 0;
|
|
6055
6116
|
};
|
|
6056
6117
|
const record = (editorUid, revision) => {
|
|
6057
|
-
revisions.set(editorUid, Math.max(get
|
|
6118
|
+
revisions.set(editorUid, Math.max(get(editorUid), revision));
|
|
6058
6119
|
};
|
|
6059
6120
|
const dispose$1 = editorUid => {
|
|
6060
6121
|
revisions.delete(editorUid);
|
|
@@ -6110,20 +6171,31 @@ const disposeEditor = async editorUid => {
|
|
|
6110
6171
|
if (!editor) {
|
|
6111
6172
|
return [];
|
|
6112
6173
|
}
|
|
6174
|
+
if (editor.lifecycle) {
|
|
6175
|
+
editor.lifecycle.disposed = true;
|
|
6176
|
+
delete editor.lifecycle.sentLines;
|
|
6177
|
+
}
|
|
6178
|
+
// Invalidate the registry before awaiting widget or worker cleanup.
|
|
6179
|
+
dispose$6(editorUid);
|
|
6180
|
+
dispose$2(editorUid);
|
|
6181
|
+
dispose$4(editorUid);
|
|
6113
6182
|
clear$1(editorUid);
|
|
6183
|
+
dispose$1(editorUid);
|
|
6184
|
+
const pending = [];
|
|
6185
|
+
if (getEnabled$1()) {
|
|
6186
|
+
pending.push(invoke$b('TextDocument.dispose', editor.id));
|
|
6187
|
+
}
|
|
6114
6188
|
for (const widget of editor.widgets) {
|
|
6115
6189
|
if (widget.id === ColorPicker$2) {
|
|
6116
|
-
|
|
6190
|
+
pending.push(invoke$7('ColorPicker.dispose', widget.newState.uid));
|
|
6117
6191
|
}
|
|
6118
6192
|
}
|
|
6119
6193
|
const commands = renderWidgets$1(editor, {
|
|
6120
6194
|
...editor,
|
|
6121
6195
|
widgets: []
|
|
6122
6196
|
});
|
|
6123
|
-
dispose$
|
|
6124
|
-
|
|
6125
|
-
dispose$5(editorUid);
|
|
6126
|
-
await dispose$2();
|
|
6197
|
+
pending.push(dispose$3());
|
|
6198
|
+
await Promise.all(pending);
|
|
6127
6199
|
if (getKeys$2().length === 0) {
|
|
6128
6200
|
await notifyEditorStatusCleared();
|
|
6129
6201
|
}
|
|
@@ -6362,8 +6434,8 @@ const closeWidgetsMaybe = widgets => {
|
|
|
6362
6434
|
};
|
|
6363
6435
|
|
|
6364
6436
|
const logError = async (error, prefix) => {
|
|
6365
|
-
const prettyError = await invoke$
|
|
6366
|
-
await invoke$
|
|
6437
|
+
const prettyError = await invoke$h('Errors.prepare', error);
|
|
6438
|
+
await invoke$h('Errors.print', prettyError, prefix);
|
|
6367
6439
|
};
|
|
6368
6440
|
const logFallback = (error, prefix) => {
|
|
6369
6441
|
if (prefix) {
|
|
@@ -6700,7 +6772,7 @@ const showFilePicker = async platform => {
|
|
|
6700
6772
|
const {
|
|
6701
6773
|
canceled,
|
|
6702
6774
|
filePath
|
|
6703
|
-
} = await invoke$
|
|
6775
|
+
} = await invoke$f('Open.showSaveDialog', dialogTitle, [], platform);
|
|
6704
6776
|
if (canceled) {
|
|
6705
6777
|
return '';
|
|
6706
6778
|
}
|
|
@@ -6724,7 +6796,7 @@ const isPermissionDeniedError = error => {
|
|
|
6724
6796
|
};
|
|
6725
6797
|
const showSaveErrorDialog = async error => {
|
|
6726
6798
|
if (isPermissionDeniedError(error)) {
|
|
6727
|
-
await invoke$
|
|
6799
|
+
await invoke$j('ElectronDialog.showMessageBox', {
|
|
6728
6800
|
buttons: ['OK'],
|
|
6729
6801
|
defaultId: 0,
|
|
6730
6802
|
message: "You don't have permission to save changes to this file.",
|
|
@@ -6733,7 +6805,7 @@ const showSaveErrorDialog = async error => {
|
|
|
6733
6805
|
});
|
|
6734
6806
|
return;
|
|
6735
6807
|
}
|
|
6736
|
-
await invoke$
|
|
6808
|
+
await invoke$j('ElectronDialog.showMessageBox', {
|
|
6737
6809
|
buttons: ['OK'],
|
|
6738
6810
|
defaultId: 0,
|
|
6739
6811
|
detail: error.message,
|
|
@@ -7346,7 +7418,7 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
7346
7418
|
if (!newState) {
|
|
7347
7419
|
return editor;
|
|
7348
7420
|
}
|
|
7349
|
-
if (get
|
|
7421
|
+
if (get(editor.uid) !== widgetRevision) {
|
|
7350
7422
|
return get$8(editor.uid)?.newState || editor;
|
|
7351
7423
|
}
|
|
7352
7424
|
// @ts-ignore
|
|
@@ -8417,7 +8489,7 @@ const deleteWordRight = editor => {
|
|
|
8417
8489
|
|
|
8418
8490
|
const findAllReferences$1 = async editor => {
|
|
8419
8491
|
// @ts-ignore
|
|
8420
|
-
await invoke$
|
|
8492
|
+
await invoke$d('SideBar.show', 'References', /* focus */true);
|
|
8421
8493
|
return editor;
|
|
8422
8494
|
};
|
|
8423
8495
|
|
|
@@ -9113,7 +9185,7 @@ const clear = editor => {
|
|
|
9113
9185
|
decorations: filtered
|
|
9114
9186
|
};
|
|
9115
9187
|
};
|
|
9116
|
-
const set
|
|
9188
|
+
const set = (editor, offset, length) => {
|
|
9117
9189
|
if (matches(editor, offset, length)) {
|
|
9118
9190
|
return editor;
|
|
9119
9191
|
}
|
|
@@ -9216,10 +9288,10 @@ const startTextDrag = async (state, x, y) => {
|
|
|
9216
9288
|
}
|
|
9217
9289
|
try {
|
|
9218
9290
|
if (state.textDragId) {
|
|
9219
|
-
await invoke$
|
|
9291
|
+
await invoke$i('DragAndDrop.discardTextDrag', state.textDragId);
|
|
9220
9292
|
}
|
|
9221
9293
|
const text = getText$1(state).slice(startOffset, endOffset);
|
|
9222
|
-
const textDragId = await invoke$
|
|
9294
|
+
const textDragId = await invoke$i('DragAndDrop.createTextDrag', {
|
|
9223
9295
|
endOffset,
|
|
9224
9296
|
sourceUri: state.uri,
|
|
9225
9297
|
startOffset,
|
|
@@ -9330,7 +9402,7 @@ const handleMouseMoveWithAltKey = async (editor, x, y) => {
|
|
|
9330
9402
|
if (!definition) {
|
|
9331
9403
|
return clear(editor);
|
|
9332
9404
|
}
|
|
9333
|
-
return set
|
|
9405
|
+
return set(editor, wordOffset, wordLength);
|
|
9334
9406
|
} catch (error) {
|
|
9335
9407
|
if (isNoDefinitionProviderFoundError(error)) {
|
|
9336
9408
|
return clear(editor);
|
|
@@ -9354,7 +9426,7 @@ const getDiagnosticHoverDetail = ({
|
|
|
9354
9426
|
|
|
9355
9427
|
const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
|
|
9356
9428
|
// @ts-ignore
|
|
9357
|
-
return invoke$
|
|
9429
|
+
return invoke$d('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, lineHeight, width);
|
|
9358
9430
|
};
|
|
9359
9431
|
|
|
9360
9432
|
const maximumWidth = 600;
|
|
@@ -9629,7 +9701,7 @@ const applyHoverContent = async (editor, getNewState) => {
|
|
|
9629
9701
|
const widgetRevision = next(editor.uid);
|
|
9630
9702
|
const widget = widgets[widgetIndex];
|
|
9631
9703
|
const newState = await getNewState(widget.newState);
|
|
9632
|
-
if (get
|
|
9704
|
+
if (get(editor.uid) !== widgetRevision) {
|
|
9633
9705
|
return editor;
|
|
9634
9706
|
}
|
|
9635
9707
|
if (!newState) {
|
|
@@ -9678,7 +9750,7 @@ const showHover = async (editor, position, token) => {
|
|
|
9678
9750
|
return;
|
|
9679
9751
|
}
|
|
9680
9752
|
set$8(editor.uid, latestInstance.oldState, newEditor);
|
|
9681
|
-
await invoke$
|
|
9753
|
+
await invoke$d('Editor.renderPending', editor.uid);
|
|
9682
9754
|
};
|
|
9683
9755
|
|
|
9684
9756
|
// TODO several things can happen:
|
|
@@ -9770,7 +9842,7 @@ const editorHandleNativeSelectionChange = (editor, range) => {
|
|
|
9770
9842
|
const handlePointerCaptureLost = async editor => {
|
|
9771
9843
|
if (editor.textDragId) {
|
|
9772
9844
|
try {
|
|
9773
|
-
await invoke$
|
|
9845
|
+
await invoke$i('DragAndDrop.discardTextDrag', editor.textDragId);
|
|
9774
9846
|
} catch {
|
|
9775
9847
|
// The pointer state still needs to be reset if the worker is unavailable.
|
|
9776
9848
|
}
|
|
@@ -10058,7 +10130,7 @@ const handlePointerUp = async editor => {
|
|
|
10058
10130
|
return resetEditor;
|
|
10059
10131
|
}
|
|
10060
10132
|
try {
|
|
10061
|
-
const data = await invoke$
|
|
10133
|
+
const data = await invoke$i('DragAndDrop.takeTextDrag', editor.textDragId);
|
|
10062
10134
|
if (!data) {
|
|
10063
10135
|
return resetEditor;
|
|
10064
10136
|
}
|
|
@@ -10385,7 +10457,7 @@ const indentMore = editor => {
|
|
|
10385
10457
|
|
|
10386
10458
|
const getLanguageConfiguration = async editor => {
|
|
10387
10459
|
// @ts-ignore
|
|
10388
|
-
return invoke$
|
|
10460
|
+
return invoke$d('Languages.getLanguageConfiguration', {
|
|
10389
10461
|
languageId: editor.languageId,
|
|
10390
10462
|
uri: editor.uri
|
|
10391
10463
|
});
|
|
@@ -10696,14 +10768,14 @@ const addWidget = (widget, id, render) => {
|
|
|
10696
10768
|
};
|
|
10697
10769
|
|
|
10698
10770
|
const setFocus = async focusKey => {
|
|
10699
|
-
await invoke$
|
|
10771
|
+
await invoke$d('Focus.setFocus', focusKey);
|
|
10700
10772
|
};
|
|
10701
10773
|
const unsetAdditionalFocus = async focusKey => {
|
|
10702
10774
|
if (!focusKey) {
|
|
10703
10775
|
return;
|
|
10704
10776
|
}
|
|
10705
10777
|
// @ts-ignore
|
|
10706
|
-
await invoke$
|
|
10778
|
+
await invoke$d('Focus.removeAdditionalFocus', focusKey);
|
|
10707
10779
|
};
|
|
10708
10780
|
|
|
10709
10781
|
const FocusEditor = 12;
|
|
@@ -10903,7 +10975,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
10903
10975
|
const latestChildIndex = latestAfterInvoke.widgets.findIndex(isWidget);
|
|
10904
10976
|
if (latestChildIndex === -1) {
|
|
10905
10977
|
set$8(editor.uid, editor, latestAfterInvoke);
|
|
10906
|
-
await dispose$
|
|
10978
|
+
await dispose$3();
|
|
10907
10979
|
return latestAfterInvoke;
|
|
10908
10980
|
}
|
|
10909
10981
|
const diff = await invoke(`${name}.diff2`, uid);
|
|
@@ -11207,11 +11279,11 @@ const openRename = async editor => {
|
|
|
11207
11279
|
try {
|
|
11208
11280
|
editorWithRenameWidget = await addWidgetToEditor(Rename$1, FocusEditorRename$1, editor, create$1, newStateGenerator$1, fullFocus);
|
|
11209
11281
|
} catch (error) {
|
|
11210
|
-
await dispose$
|
|
11282
|
+
await dispose$3();
|
|
11211
11283
|
throw error;
|
|
11212
11284
|
}
|
|
11213
11285
|
if (editorWithRenameWidget === editor) {
|
|
11214
|
-
await dispose$
|
|
11286
|
+
await dispose$3();
|
|
11215
11287
|
return editor;
|
|
11216
11288
|
}
|
|
11217
11289
|
const wordBefore = getWordBefore(editor, rowIndex, columnIndex);
|
|
@@ -13645,7 +13717,7 @@ const executeViewletCommand$1 = async (commandMap, uid, commandId, ...args) => {
|
|
|
13645
13717
|
throw new TypeError(`Viewlet command not found: ${commandId}`);
|
|
13646
13718
|
}
|
|
13647
13719
|
await fn(uid, ...args);
|
|
13648
|
-
await invoke$
|
|
13720
|
+
await invoke$d('Viewlet.executeViewletCommand', uid, '__renderPending', false);
|
|
13649
13721
|
};
|
|
13650
13722
|
|
|
13651
13723
|
const executeWidgetCommand = async (editor, name, method, _uid, widgetId, ...params) => {
|
|
@@ -13823,7 +13895,7 @@ const getDiagnostics$1 = async editorUid => {
|
|
|
13823
13895
|
};
|
|
13824
13896
|
|
|
13825
13897
|
const ensure = async (fontName, fontUrl) => {
|
|
13826
|
-
await invoke$
|
|
13898
|
+
await invoke$e('TextMeasurement.ensureFont', fontName, fontUrl);
|
|
13827
13899
|
};
|
|
13828
13900
|
|
|
13829
13901
|
const findWidgetFocusContexts = [FindWidget, FocusFindWidgetReplace$1, FocusFindWidgetOptions, FocusFindWidgetToggleReplace, FocusFindWidgetPreviousMatchButton, FocusFindWidgetNextMatchButton, FocusFindWidgetCloseButton, FocusFindWidgetReplaceButton, FocusFindWidgetReplaceAllButton];
|
|
@@ -14471,7 +14543,7 @@ const handleBeforeInput = (editor, inputType, data) => {
|
|
|
14471
14543
|
};
|
|
14472
14544
|
|
|
14473
14545
|
const handleMessagePort = async (port, rpcId) => {
|
|
14474
|
-
const rpc = await create$
|
|
14546
|
+
const rpc = await create$e({
|
|
14475
14547
|
commandMap: {},
|
|
14476
14548
|
messagePort: port
|
|
14477
14549
|
});
|
|
@@ -14847,7 +14919,7 @@ const hotReload = async () => {
|
|
|
14847
14919
|
|
|
14848
14920
|
// TODO ask renderer worker to rerender all editors
|
|
14849
14921
|
// @ts-ignore
|
|
14850
|
-
await invoke$
|
|
14922
|
+
await invoke$d(`Editor.rerender`);
|
|
14851
14923
|
} finally {
|
|
14852
14924
|
state.isReloading = false;
|
|
14853
14925
|
}
|
|
@@ -14866,7 +14938,7 @@ const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
|
14866
14938
|
|
|
14867
14939
|
const createSyntaxHighlightingWorkerRpc = async () => {
|
|
14868
14940
|
try {
|
|
14869
|
-
const rpc = await create$
|
|
14941
|
+
const rpc = await create$g({
|
|
14870
14942
|
commandMap: {},
|
|
14871
14943
|
send: sendMessagePortToSyntaxHighlightingWorker
|
|
14872
14944
|
});
|
|
@@ -15043,6 +15115,9 @@ const loadContent = async (state, savedState, largeFile = false) => {
|
|
|
15043
15115
|
textInfos: []
|
|
15044
15116
|
};
|
|
15045
15117
|
}
|
|
15118
|
+
if (state.lifecycle?.disposed) {
|
|
15119
|
+
return state;
|
|
15120
|
+
}
|
|
15046
15121
|
const savedLargeFile = !!savedState && typeof savedState === 'object' && savedState.largeFile === true;
|
|
15047
15122
|
largeFile ||= state.largeFile === true || existingEditor?.largeFile === true || savedLargeFile || content.length > largeFileContentLength;
|
|
15048
15123
|
const effectiveEditor = {
|
|
@@ -15200,7 +15275,7 @@ const refreshGutterDecorationsAll = async () => {
|
|
|
15200
15275
|
...latest.newState,
|
|
15201
15276
|
gutterDecorations: refreshedEditor.gutterDecorations
|
|
15202
15277
|
});
|
|
15203
|
-
await invoke$
|
|
15278
|
+
await invoke$d('Editor.renderPending', editor.id);
|
|
15204
15279
|
}
|
|
15205
15280
|
}
|
|
15206
15281
|
};
|
|
@@ -16097,14 +16172,6 @@ const getScrollBarDiagnostics = (editor, diagnostics) => {
|
|
|
16097
16172
|
return scrollBarDecorations;
|
|
16098
16173
|
};
|
|
16099
16174
|
|
|
16100
|
-
const renderedDoms = new Map();
|
|
16101
|
-
const get = uid => {
|
|
16102
|
-
return renderedDoms.get(uid);
|
|
16103
|
-
};
|
|
16104
|
-
const set = (uid, dom) => {
|
|
16105
|
-
renderedDoms.set(uid, dom);
|
|
16106
|
-
};
|
|
16107
|
-
|
|
16108
16175
|
const getDom = state => {
|
|
16109
16176
|
const {
|
|
16110
16177
|
diagnostics = [],
|
|
@@ -16130,13 +16197,13 @@ const mergeConflictsEqual = (oldState, newState) => {
|
|
|
16130
16197
|
});
|
|
16131
16198
|
};
|
|
16132
16199
|
const renderIncremental = (oldState, newState) => {
|
|
16133
|
-
const oldDom = oldState.initial || !mergeConflictsEqual(oldState, newState) ? getDom(oldState) : get(newState.uid) || getDom(oldState);
|
|
16200
|
+
const oldDom = oldState.initial || !mergeConflictsEqual(oldState, newState) ? getDom(oldState) : get$1(newState.uid) || getDom(oldState);
|
|
16134
16201
|
const newDom = getDom(newState);
|
|
16135
16202
|
const patches = diffTree(oldDom, newDom);
|
|
16136
16203
|
if (patches.length === 0) {
|
|
16137
16204
|
return [];
|
|
16138
16205
|
}
|
|
16139
|
-
set(newState.uid, newDom);
|
|
16206
|
+
set$1(newState.uid, newDom);
|
|
16140
16207
|
return [SetPatches, newState.uid, patches];
|
|
16141
16208
|
};
|
|
16142
16209
|
|
|
@@ -16504,9 +16571,11 @@ const saveState = (state, savedState) => {
|
|
|
16504
16571
|
...(largeFile && {
|
|
16505
16572
|
largeFile: true
|
|
16506
16573
|
}),
|
|
16507
|
-
|
|
16508
|
-
|
|
16509
|
-
|
|
16574
|
+
...((redoStack.length > 0 || undoStack.length > 0) && {
|
|
16575
|
+
lines,
|
|
16576
|
+
redoStack,
|
|
16577
|
+
undoStack
|
|
16578
|
+
})
|
|
16510
16579
|
};
|
|
16511
16580
|
};
|
|
16512
16581
|
|
|
@@ -16570,7 +16639,7 @@ const updateDebugInfo = async debugId => {
|
|
|
16570
16639
|
};
|
|
16571
16640
|
set$8(key, oldState, newEditor);
|
|
16572
16641
|
// @ts-ignore
|
|
16573
|
-
await invoke$
|
|
16642
|
+
await invoke$d('Editor.rerender', key);
|
|
16574
16643
|
};
|
|
16575
16644
|
|
|
16576
16645
|
const queues = {};
|
|
@@ -16619,7 +16688,7 @@ const executeDiagnosticProvider = async editor => {
|
|
|
16619
16688
|
return executeIsolatedDiagnosticProvider(editor);
|
|
16620
16689
|
};
|
|
16621
16690
|
|
|
16622
|
-
const invoke = (...args) => invoke$
|
|
16691
|
+
const invoke = (...args) => invoke$d(...args);
|
|
16623
16692
|
|
|
16624
16693
|
/**
|
|
16625
16694
|
* Merges link decorations with diagnostic decorations
|
|
@@ -16797,7 +16866,7 @@ const saveAfterDelay = async (uid, token) => {
|
|
|
16797
16866
|
});
|
|
16798
16867
|
await save$1(uid);
|
|
16799
16868
|
if (didSave) {
|
|
16800
|
-
await invoke$
|
|
16869
|
+
await invoke$d('Editor.renderPending', uid);
|
|
16801
16870
|
}
|
|
16802
16871
|
};
|
|
16803
16872
|
|
|
@@ -16846,7 +16915,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
16846
16915
|
}
|
|
16847
16916
|
const newEditorWithDerivedState = await updateDerivedState(state, newEditor);
|
|
16848
16917
|
set$8(uid, state, newEditorWithDerivedState);
|
|
16849
|
-
await dispose$
|
|
16918
|
+
await dispose$3();
|
|
16850
16919
|
if (editorDiagnosticEffect.isActive(state, newEditorWithDerivedState)) {
|
|
16851
16920
|
void editorDiagnosticEffect.apply(newEditorWithDerivedState);
|
|
16852
16921
|
}
|
|
@@ -16883,7 +16952,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
16883
16952
|
if (lines !== finalEditor.lines && !isUntitledFile(finalEditor.uri)) {
|
|
16884
16953
|
schedule(uid, token => saveAfterDelay(uid, token));
|
|
16885
16954
|
} else if (modified && !finalEditor.modified) {
|
|
16886
|
-
dispose$
|
|
16955
|
+
dispose$4(uid);
|
|
16887
16956
|
}
|
|
16888
16957
|
return returnState ? finalEditor : undefined;
|
|
16889
16958
|
});
|
|
@@ -17224,7 +17293,7 @@ for (const [key, value] of Object.entries(commandMap)) {
|
|
|
17224
17293
|
}
|
|
17225
17294
|
|
|
17226
17295
|
const initializeDragAndDropWorker = async () => {
|
|
17227
|
-
const rpc = await create$
|
|
17296
|
+
const rpc = await create$f({
|
|
17228
17297
|
commandMap: {},
|
|
17229
17298
|
send: sendMessagePortToDragAndDropWorker
|
|
17230
17299
|
});
|
|
@@ -17232,7 +17301,7 @@ const initializeDragAndDropWorker = async () => {
|
|
|
17232
17301
|
};
|
|
17233
17302
|
|
|
17234
17303
|
const initializeErrorWorker = async () => {
|
|
17235
|
-
const rpc = await create$
|
|
17304
|
+
const rpc = await create$f({
|
|
17236
17305
|
commandMap: {},
|
|
17237
17306
|
send(port) {
|
|
17238
17307
|
return sendMessagePortToErrorWorker(port, EditorWorker);
|
|
@@ -17242,7 +17311,7 @@ const initializeErrorWorker = async () => {
|
|
|
17242
17311
|
};
|
|
17243
17312
|
|
|
17244
17313
|
const createExtensionManagementWorkerRpc = async () => {
|
|
17245
|
-
const rpc = await create$
|
|
17314
|
+
const rpc = await create$f({
|
|
17246
17315
|
commandMap: {},
|
|
17247
17316
|
async send(port) {
|
|
17248
17317
|
await sendMessagePortToExtensionManagementWorker$1(port, EditorWorker);
|
|
@@ -17265,7 +17334,7 @@ const send$1 = port => {
|
|
|
17265
17334
|
return sendMessagePortToOpenerWorker(port);
|
|
17266
17335
|
};
|
|
17267
17336
|
const initializeOpenerWorker = async () => {
|
|
17268
|
-
const rpc = await create$
|
|
17337
|
+
const rpc = await create$f({
|
|
17269
17338
|
commandMap: {},
|
|
17270
17339
|
send: send$1
|
|
17271
17340
|
});
|
|
@@ -17273,7 +17342,7 @@ const initializeOpenerWorker = async () => {
|
|
|
17273
17342
|
};
|
|
17274
17343
|
|
|
17275
17344
|
const initializeRendererWorker = async () => {
|
|
17276
|
-
const rpc = await create$
|
|
17345
|
+
const rpc = await create$d({
|
|
17277
17346
|
commandMap: commandMap
|
|
17278
17347
|
});
|
|
17279
17348
|
set$a(rpc);
|
|
@@ -17283,7 +17352,7 @@ const send = port => {
|
|
|
17283
17352
|
return sendMessagePortToTextMeasurementWorker(port);
|
|
17284
17353
|
};
|
|
17285
17354
|
const initializeTextMeasurementWorker = async () => {
|
|
17286
|
-
const rpc = await create$
|
|
17355
|
+
const rpc = await create$f({
|
|
17287
17356
|
commandMap: {},
|
|
17288
17357
|
send
|
|
17289
17358
|
});
|
|
@@ -17293,7 +17362,7 @@ const initializeTextMeasurementWorker = async () => {
|
|
|
17293
17362
|
const listen = async () => {
|
|
17294
17363
|
registerCommands(commandMap);
|
|
17295
17364
|
await Promise.all([initializeRendererWorker(), initializeDragAndDropWorker(), initializeErrorWorker(), initializeExtensionManagementWorker(), initializeTextMeasurementWorker(), initializeOpenerWorker()]);
|
|
17296
|
-
const dialogRpc = await create$
|
|
17365
|
+
const dialogRpc = await create$f({
|
|
17297
17366
|
commandMap: {},
|
|
17298
17367
|
send: sendMessagePortToDialogWorker
|
|
17299
17368
|
});
|