@lvce-editor/editor-worker 5.7.0 → 5.9.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/dist/editorWorkerMain.js +214 -247
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
const commands = Object.create(null);
|
|
2
|
-
const registerCommand = (key, fn) => {
|
|
3
|
-
commands[key] = fn;
|
|
4
|
-
};
|
|
5
2
|
const register = commandMap => {
|
|
6
|
-
|
|
7
|
-
registerCommand(key, value);
|
|
8
|
-
}
|
|
3
|
+
Object.assign(commands, commandMap);
|
|
9
4
|
};
|
|
10
5
|
const getCommand = key => {
|
|
11
6
|
return commands[key];
|
|
@@ -23,13 +18,13 @@ const codeGeneratorAccept = state => {
|
|
|
23
18
|
return state;
|
|
24
19
|
};
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
class AssertionError extends Error {
|
|
27
22
|
constructor(message) {
|
|
28
23
|
super(message);
|
|
29
24
|
this.name = 'AssertionError';
|
|
30
25
|
}
|
|
31
|
-
}
|
|
32
|
-
const getType
|
|
26
|
+
}
|
|
27
|
+
const getType = value => {
|
|
33
28
|
switch (typeof value) {
|
|
34
29
|
case 'number':
|
|
35
30
|
return 'number';
|
|
@@ -52,40 +47,40 @@ const getType$1 = value => {
|
|
|
52
47
|
}
|
|
53
48
|
};
|
|
54
49
|
const object = value => {
|
|
55
|
-
const type = getType
|
|
50
|
+
const type = getType(value);
|
|
56
51
|
if (type !== 'object') {
|
|
57
|
-
throw new AssertionError
|
|
52
|
+
throw new AssertionError('expected value to be of type object');
|
|
58
53
|
}
|
|
59
54
|
};
|
|
60
|
-
const number
|
|
61
|
-
const type = getType
|
|
55
|
+
const number = value => {
|
|
56
|
+
const type = getType(value);
|
|
62
57
|
if (type !== 'number') {
|
|
63
|
-
throw new AssertionError
|
|
58
|
+
throw new AssertionError('expected value to be of type number');
|
|
64
59
|
}
|
|
65
60
|
};
|
|
66
61
|
const array = value => {
|
|
67
|
-
const type = getType
|
|
62
|
+
const type = getType(value);
|
|
68
63
|
if (type !== 'array') {
|
|
69
|
-
throw new AssertionError
|
|
64
|
+
throw new AssertionError('expected value to be of type array');
|
|
70
65
|
}
|
|
71
66
|
};
|
|
72
67
|
const string = value => {
|
|
73
|
-
const type = getType
|
|
68
|
+
const type = getType(value);
|
|
74
69
|
if (type !== 'string') {
|
|
75
|
-
throw new AssertionError
|
|
70
|
+
throw new AssertionError('expected value to be of type string');
|
|
76
71
|
}
|
|
77
72
|
};
|
|
78
73
|
const boolean = value => {
|
|
79
|
-
const type = getType
|
|
74
|
+
const type = getType(value);
|
|
80
75
|
if (type !== 'boolean') {
|
|
81
|
-
throw new AssertionError
|
|
76
|
+
throw new AssertionError('expected value to be of type boolean');
|
|
82
77
|
}
|
|
83
78
|
};
|
|
84
79
|
|
|
85
80
|
const clamp = (num, min, max) => {
|
|
86
|
-
number
|
|
87
|
-
number
|
|
88
|
-
number
|
|
81
|
+
number(num);
|
|
82
|
+
number(min);
|
|
83
|
+
number(max);
|
|
89
84
|
return Math.min(Math.max(num, min), max);
|
|
90
85
|
};
|
|
91
86
|
|
|
@@ -304,10 +299,10 @@ const applyEdits = (textDocument, changes) => {
|
|
|
304
299
|
const endColumnIndex = change.end.columnIndex;
|
|
305
300
|
const inserted = change.inserted;
|
|
306
301
|
const deleted = change.deleted;
|
|
307
|
-
number
|
|
308
|
-
number
|
|
309
|
-
number
|
|
310
|
-
number
|
|
302
|
+
number(startRowIndex);
|
|
303
|
+
number(endRowIndex);
|
|
304
|
+
number(startColumnIndex);
|
|
305
|
+
number(endColumnIndex);
|
|
311
306
|
array(inserted);
|
|
312
307
|
array(deleted);
|
|
313
308
|
if (startRowIndex === endRowIndex) {
|
|
@@ -377,8 +372,8 @@ const getSelectionText = (textDocument, range) => {
|
|
|
377
372
|
};
|
|
378
373
|
const offsetAtSync = async (textDocument, positionRowIndex, positionColumnIndex) => {
|
|
379
374
|
object(textDocument);
|
|
380
|
-
number
|
|
381
|
-
number
|
|
375
|
+
number(positionRowIndex);
|
|
376
|
+
number(positionColumnIndex);
|
|
382
377
|
let offset = 0;
|
|
383
378
|
let rowIndex = 0;
|
|
384
379
|
const lines = textDocument.lines;
|
|
@@ -392,8 +387,8 @@ const offsetAtSync = async (textDocument, positionRowIndex, positionColumnIndex)
|
|
|
392
387
|
};
|
|
393
388
|
const offsetAt = (textDocument, positionRowIndex, positionColumnIndex) => {
|
|
394
389
|
object(textDocument);
|
|
395
|
-
number
|
|
396
|
-
number
|
|
390
|
+
number(positionRowIndex);
|
|
391
|
+
number(positionColumnIndex);
|
|
397
392
|
let offset = 0;
|
|
398
393
|
let rowIndex = 0;
|
|
399
394
|
const lines = textDocument.lines;
|
|
@@ -432,7 +427,7 @@ const positionAt = (textDocument, offset) => {
|
|
|
432
427
|
// TODO this should be in a separate scrolling module
|
|
433
428
|
const setDeltaY$3 = (state, value) => {
|
|
434
429
|
object(state);
|
|
435
|
-
number
|
|
430
|
+
number(value);
|
|
436
431
|
const {
|
|
437
432
|
finalDeltaY,
|
|
438
433
|
deltaY,
|
|
@@ -525,11 +520,11 @@ const getContext = () => {
|
|
|
525
520
|
|
|
526
521
|
const measureTextWidthSlow = (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
527
522
|
string(text);
|
|
528
|
-
number
|
|
529
|
-
number
|
|
523
|
+
number(fontWeight);
|
|
524
|
+
number(fontSize);
|
|
530
525
|
string(fontFamily);
|
|
531
526
|
boolean(isMonoSpaceFont);
|
|
532
|
-
number
|
|
527
|
+
number(charWidth);
|
|
533
528
|
if (typeof letterSpacing !== 'number') {
|
|
534
529
|
throw new TypeError('letterSpacing must be of type number');
|
|
535
530
|
}
|
|
@@ -565,12 +560,12 @@ const getX = (line, column, fontWeight, fontSize, fontFamily, isMonospaceFont, l
|
|
|
565
560
|
return 0;
|
|
566
561
|
}
|
|
567
562
|
string(line);
|
|
568
|
-
number
|
|
569
|
-
number
|
|
570
|
-
number
|
|
563
|
+
number(tabSize);
|
|
564
|
+
number(halfCursorWidth);
|
|
565
|
+
number(width);
|
|
571
566
|
boolean(isMonospaceFont);
|
|
572
|
-
number
|
|
573
|
-
number
|
|
567
|
+
number(averageCharWidth);
|
|
568
|
+
number(difference);
|
|
574
569
|
if (column === 0) {
|
|
575
570
|
return 0;
|
|
576
571
|
}
|
|
@@ -1037,11 +1032,11 @@ const setText = (editor, text) => {
|
|
|
1037
1032
|
|
|
1038
1033
|
const editors = Object.create(null);
|
|
1039
1034
|
const get$6 = id => {
|
|
1040
|
-
number
|
|
1035
|
+
number(id);
|
|
1041
1036
|
return editors[id];
|
|
1042
1037
|
};
|
|
1043
1038
|
const set$6 = (id, oldEditor, newEditor) => {
|
|
1044
|
-
number
|
|
1039
|
+
number(id);
|
|
1045
1040
|
object(oldEditor);
|
|
1046
1041
|
object(newEditor);
|
|
1047
1042
|
editors[id] = {
|
|
@@ -1058,57 +1053,21 @@ const TabCompletionExecuteTabCompletionProvider = 'ExtensionHost.executeTabCompl
|
|
|
1058
1053
|
const TextDocumentSyncFull = 'ExtensionHostTextDocument.syncFull';
|
|
1059
1054
|
|
|
1060
1055
|
const Two = '2.0';
|
|
1061
|
-
|
|
1062
|
-
constructor(message) {
|
|
1063
|
-
super(message);
|
|
1064
|
-
this.name = 'AssertionError';
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
const getType = value => {
|
|
1068
|
-
switch (typeof value) {
|
|
1069
|
-
case 'number':
|
|
1070
|
-
return 'number';
|
|
1071
|
-
case 'function':
|
|
1072
|
-
return 'function';
|
|
1073
|
-
case 'string':
|
|
1074
|
-
return 'string';
|
|
1075
|
-
case 'object':
|
|
1076
|
-
if (value === null) {
|
|
1077
|
-
return 'null';
|
|
1078
|
-
}
|
|
1079
|
-
if (Array.isArray(value)) {
|
|
1080
|
-
return 'array';
|
|
1081
|
-
}
|
|
1082
|
-
return 'object';
|
|
1083
|
-
case 'boolean':
|
|
1084
|
-
return 'boolean';
|
|
1085
|
-
default:
|
|
1086
|
-
return 'unknown';
|
|
1087
|
-
}
|
|
1088
|
-
};
|
|
1089
|
-
const number = value => {
|
|
1090
|
-
const type = getType(value);
|
|
1091
|
-
if (type !== 'number') {
|
|
1092
|
-
throw new AssertionError('expected value to be of type number');
|
|
1093
|
-
}
|
|
1094
|
-
};
|
|
1095
|
-
const state$1$1 = {
|
|
1056
|
+
const state$9 = {
|
|
1096
1057
|
callbacks: Object.create(null)
|
|
1097
1058
|
};
|
|
1098
1059
|
const set$5 = (id, fn) => {
|
|
1099
|
-
state$
|
|
1060
|
+
state$9.callbacks[id] = fn;
|
|
1100
1061
|
};
|
|
1101
1062
|
const get$5 = id => {
|
|
1102
|
-
return state$
|
|
1063
|
+
return state$9.callbacks[id];
|
|
1103
1064
|
};
|
|
1104
1065
|
const remove$8 = id => {
|
|
1105
|
-
delete state$
|
|
1106
|
-
};
|
|
1107
|
-
const state$9 = {
|
|
1108
|
-
id: 0
|
|
1066
|
+
delete state$9.callbacks[id];
|
|
1109
1067
|
};
|
|
1068
|
+
let id = 0;
|
|
1110
1069
|
const create$3$1 = () => {
|
|
1111
|
-
return ++
|
|
1070
|
+
return ++id;
|
|
1112
1071
|
};
|
|
1113
1072
|
const warn$1 = (...args) => {
|
|
1114
1073
|
console.warn(...args);
|
|
@@ -1125,15 +1084,14 @@ const registerPromise = () => {
|
|
|
1125
1084
|
promise
|
|
1126
1085
|
};
|
|
1127
1086
|
};
|
|
1128
|
-
const resolve = (id,
|
|
1129
|
-
number(id);
|
|
1087
|
+
const resolve = (id, response) => {
|
|
1130
1088
|
const fn = get$5(id);
|
|
1131
1089
|
if (!fn) {
|
|
1132
|
-
console.log(
|
|
1090
|
+
console.log(response);
|
|
1133
1091
|
warn$1(`callback ${id} may already be disposed`);
|
|
1134
1092
|
return;
|
|
1135
1093
|
}
|
|
1136
|
-
fn(
|
|
1094
|
+
fn(response);
|
|
1137
1095
|
remove$8(id);
|
|
1138
1096
|
};
|
|
1139
1097
|
const create$2$1 = (method, params) => {
|
|
@@ -1355,32 +1313,42 @@ const defaultRequiresSocket = () => {
|
|
|
1355
1313
|
return false;
|
|
1356
1314
|
};
|
|
1357
1315
|
const defaultResolve = resolve;
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
let execute;
|
|
1362
|
-
let preparePrettyError;
|
|
1363
|
-
let logError;
|
|
1364
|
-
let resolve;
|
|
1365
|
-
let requiresSocket;
|
|
1316
|
+
|
|
1317
|
+
// TODO maybe remove this in v6 or v7, only accept options object to simplify the code
|
|
1318
|
+
const normalizeParams = args => {
|
|
1366
1319
|
if (args.length === 1) {
|
|
1367
|
-
const
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
message = args[1];
|
|
1378
|
-
execute = args[2];
|
|
1379
|
-
resolve = args[3];
|
|
1380
|
-
preparePrettyError = args[4];
|
|
1381
|
-
logError = args[5];
|
|
1382
|
-
requiresSocket = args[6];
|
|
1320
|
+
const options = args[0];
|
|
1321
|
+
return {
|
|
1322
|
+
ipc: options.ipc,
|
|
1323
|
+
message: options.message,
|
|
1324
|
+
execute: options.execute,
|
|
1325
|
+
resolve: options.resolve || defaultResolve,
|
|
1326
|
+
preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
|
|
1327
|
+
logError: options.logError || defaultLogError,
|
|
1328
|
+
requiresSocket: options.requiresSocket || defaultRequiresSocket
|
|
1329
|
+
};
|
|
1383
1330
|
}
|
|
1331
|
+
return {
|
|
1332
|
+
ipc: args[0],
|
|
1333
|
+
message: args[1],
|
|
1334
|
+
execute: args[2],
|
|
1335
|
+
resolve: args[3],
|
|
1336
|
+
preparePrettyError: args[4],
|
|
1337
|
+
logError: args[5],
|
|
1338
|
+
requiresSocket: args[6]
|
|
1339
|
+
};
|
|
1340
|
+
};
|
|
1341
|
+
const handleJsonRpcMessage = async (...args) => {
|
|
1342
|
+
const options = normalizeParams(args);
|
|
1343
|
+
const {
|
|
1344
|
+
message,
|
|
1345
|
+
ipc,
|
|
1346
|
+
execute,
|
|
1347
|
+
resolve,
|
|
1348
|
+
preparePrettyError,
|
|
1349
|
+
logError,
|
|
1350
|
+
requiresSocket
|
|
1351
|
+
} = options;
|
|
1384
1352
|
if ('id' in message) {
|
|
1385
1353
|
if ('method' in message) {
|
|
1386
1354
|
const response = await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
|
|
@@ -1401,25 +1369,24 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
1401
1369
|
}
|
|
1402
1370
|
throw new JsonRpcError('unexpected message');
|
|
1403
1371
|
};
|
|
1404
|
-
const
|
|
1372
|
+
const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
1405
1373
|
const {
|
|
1406
1374
|
message,
|
|
1407
1375
|
promise
|
|
1408
1376
|
} = create$2$1(method, params);
|
|
1409
|
-
ipc.
|
|
1377
|
+
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
1378
|
+
ipc.sendAndTransfer(message);
|
|
1379
|
+
} else {
|
|
1380
|
+
ipc.send(message);
|
|
1381
|
+
}
|
|
1410
1382
|
const responseMessage = await promise;
|
|
1411
|
-
|
|
1412
|
-
return result;
|
|
1383
|
+
return unwrapJsonRpcResult(responseMessage);
|
|
1413
1384
|
};
|
|
1414
|
-
const
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
ipc.sendAndTransfer(message);
|
|
1420
|
-
const responseMessage = await promise;
|
|
1421
|
-
const result = unwrapJsonRpcResult(responseMessage);
|
|
1422
|
-
return result;
|
|
1385
|
+
const invoke$5 = (ipc, method, ...params) => {
|
|
1386
|
+
return invokeHelper(ipc, method, params, false);
|
|
1387
|
+
};
|
|
1388
|
+
const invokeAndTransfer$2 = (ipc, method, ...params) => {
|
|
1389
|
+
return invokeHelper(ipc, method, params, true);
|
|
1423
1390
|
};
|
|
1424
1391
|
|
|
1425
1392
|
const requiresSocket = () => {
|
|
@@ -1492,7 +1459,7 @@ const invokeAndTransfer$1 = async (method, ...params) => {
|
|
|
1492
1459
|
const ipc = get$4();
|
|
1493
1460
|
return invokeAndTransfer$2(ipc, method, ...params);
|
|
1494
1461
|
};
|
|
1495
|
-
const listen$
|
|
1462
|
+
const listen$7 = ipc => {
|
|
1496
1463
|
set$4(ipc);
|
|
1497
1464
|
};
|
|
1498
1465
|
|
|
@@ -1547,7 +1514,7 @@ const create$d = async () => {
|
|
|
1547
1514
|
}
|
|
1548
1515
|
return port2;
|
|
1549
1516
|
};
|
|
1550
|
-
const wrap$
|
|
1517
|
+
const wrap$2 = port => {
|
|
1551
1518
|
return {
|
|
1552
1519
|
port,
|
|
1553
1520
|
/**
|
|
@@ -1581,7 +1548,7 @@ const wrap$3 = port => {
|
|
|
1581
1548
|
const IpcParentWithExtensionHostWorker = {
|
|
1582
1549
|
__proto__: null,
|
|
1583
1550
|
create: create$d,
|
|
1584
|
-
wrap: wrap$
|
|
1551
|
+
wrap: wrap$2
|
|
1585
1552
|
};
|
|
1586
1553
|
|
|
1587
1554
|
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
@@ -1737,7 +1704,7 @@ const createRpc = method => {
|
|
|
1737
1704
|
};
|
|
1738
1705
|
|
|
1739
1706
|
const {
|
|
1740
|
-
listen: listen$
|
|
1707
|
+
listen: listen$6,
|
|
1741
1708
|
invoke: invoke$2
|
|
1742
1709
|
} = createRpc(ExtensionHostWorker);
|
|
1743
1710
|
|
|
@@ -1933,7 +1900,7 @@ const createEditor = async ({
|
|
|
1933
1900
|
uri,
|
|
1934
1901
|
diagnosticsEnabled
|
|
1935
1902
|
}) => {
|
|
1936
|
-
number
|
|
1903
|
+
number(id);
|
|
1937
1904
|
string(content);
|
|
1938
1905
|
const charWidth = measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing);
|
|
1939
1906
|
const editor = {
|
|
@@ -2208,14 +2175,14 @@ const normalizeGuess = (line, guess, tabSize) => {
|
|
|
2208
2175
|
// @ts-ignore
|
|
2209
2176
|
const getAccurateColumnIndex = (line, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth, tabSize, eventX) => {
|
|
2210
2177
|
string(line);
|
|
2211
|
-
number
|
|
2212
|
-
number
|
|
2178
|
+
number(fontWeight);
|
|
2179
|
+
number(fontSize);
|
|
2213
2180
|
string(fontFamily);
|
|
2214
|
-
number
|
|
2181
|
+
number(letterSpacing);
|
|
2215
2182
|
boolean(isMonospaceFont);
|
|
2216
|
-
number
|
|
2217
|
-
number
|
|
2218
|
-
number
|
|
2183
|
+
number(charWidth);
|
|
2184
|
+
number(tabSize);
|
|
2185
|
+
number(eventX);
|
|
2219
2186
|
// Assert.greaterZero(charWidth)
|
|
2220
2187
|
const guess = guessOffset(eventX, charWidth);
|
|
2221
2188
|
const normalize = shouldNormalizeText(line);
|
|
@@ -2235,8 +2202,8 @@ const getAccurateColumnIndex = (line, fontWeight, fontSize, fontFamily, letterSp
|
|
|
2235
2202
|
|
|
2236
2203
|
const at = (editor, eventX, eventY) => {
|
|
2237
2204
|
object(editor);
|
|
2238
|
-
number
|
|
2239
|
-
number
|
|
2205
|
+
number(eventX);
|
|
2206
|
+
number(eventY);
|
|
2240
2207
|
const {
|
|
2241
2208
|
y,
|
|
2242
2209
|
deltaY,
|
|
@@ -2309,8 +2276,8 @@ const state$7 = {
|
|
|
2309
2276
|
// @ts-ignore
|
|
2310
2277
|
const editorShowMessage = async (editor, rowIndex, columnIndex, message, isError) => {
|
|
2311
2278
|
object(editor);
|
|
2312
|
-
number
|
|
2313
|
-
number
|
|
2279
|
+
number(rowIndex);
|
|
2280
|
+
number(columnIndex);
|
|
2314
2281
|
string(message);
|
|
2315
2282
|
const x$1 = x(editor, rowIndex, columnIndex);
|
|
2316
2283
|
const y$1 = y(editor, rowIndex);
|
|
@@ -2656,10 +2623,10 @@ const compositionEnd = (editor, data) => {
|
|
|
2656
2623
|
|
|
2657
2624
|
const normalizeLine$1 = line => {
|
|
2658
2625
|
if (line.startsWith('Error: ')) {
|
|
2659
|
-
return line.slice(
|
|
2626
|
+
return line.slice('Error: '.length);
|
|
2660
2627
|
}
|
|
2661
2628
|
if (line.startsWith('VError: ')) {
|
|
2662
|
-
return line.slice(
|
|
2629
|
+
return line.slice('VError: '.length);
|
|
2663
2630
|
}
|
|
2664
2631
|
return line;
|
|
2665
2632
|
};
|
|
@@ -2782,7 +2749,7 @@ const copyLineDown = editor => {
|
|
|
2782
2749
|
selections
|
|
2783
2750
|
} = editor;
|
|
2784
2751
|
const rowIndex = selections[0];
|
|
2785
|
-
number
|
|
2752
|
+
number(rowIndex);
|
|
2786
2753
|
const position = {
|
|
2787
2754
|
rowIndex,
|
|
2788
2755
|
columnIndex: 0
|
|
@@ -3088,8 +3055,8 @@ const cursorHome = editor => {
|
|
|
3088
3055
|
|
|
3089
3056
|
const cursorSet = (editor, rowIndex, columnIndex) => {
|
|
3090
3057
|
object(editor);
|
|
3091
|
-
number
|
|
3092
|
-
number
|
|
3058
|
+
number(rowIndex);
|
|
3059
|
+
number(columnIndex);
|
|
3093
3060
|
const selectionEdits = fromRange(rowIndex, columnIndex, rowIndex, columnIndex);
|
|
3094
3061
|
return scheduleSelections(editor, selectionEdits);
|
|
3095
3062
|
};
|
|
@@ -3815,9 +3782,9 @@ const getFn = modifier => {
|
|
|
3815
3782
|
};
|
|
3816
3783
|
const handleSingleClick = async (editor, modifier, x, y) => {
|
|
3817
3784
|
object(editor);
|
|
3818
|
-
number
|
|
3819
|
-
number
|
|
3820
|
-
number
|
|
3785
|
+
number(modifier);
|
|
3786
|
+
number(x);
|
|
3787
|
+
number(y);
|
|
3821
3788
|
const position = at(editor, x, y);
|
|
3822
3789
|
const fn = getFn(modifier);
|
|
3823
3790
|
const newEditor = await fn(editor, position);
|
|
@@ -3856,8 +3823,8 @@ const selectLine = editor => {
|
|
|
3856
3823
|
// @ts-ignore
|
|
3857
3824
|
const handleTripleClick = (editor, modifier, x, y) => {
|
|
3858
3825
|
object(editor);
|
|
3859
|
-
number
|
|
3860
|
-
number
|
|
3826
|
+
number(x);
|
|
3827
|
+
number(y);
|
|
3861
3828
|
return {
|
|
3862
3829
|
newState: selectLine(editor),
|
|
3863
3830
|
commands: []
|
|
@@ -3948,8 +3915,8 @@ const getTokenIndex = (tokens, offset) => {
|
|
|
3948
3915
|
// @ts-ignore
|
|
3949
3916
|
const handleMouseMoveWithAltKey = async (editor, x, y) => {
|
|
3950
3917
|
object(editor);
|
|
3951
|
-
number
|
|
3952
|
-
number
|
|
3918
|
+
number(x);
|
|
3919
|
+
number(y);
|
|
3953
3920
|
const position = at(editor, x, y);
|
|
3954
3921
|
const documentOffset = offsetAt(editor, position.rowIndex, position.columnIndex);
|
|
3955
3922
|
try {
|
|
@@ -4287,9 +4254,9 @@ const setDeltaYFixedValue = (editor, deltaY) => {
|
|
|
4287
4254
|
|
|
4288
4255
|
// @ts-ignore
|
|
4289
4256
|
const setDelta = (editor, deltaMode, eventDeltaX, eventDeltaY) => {
|
|
4290
|
-
number
|
|
4291
|
-
number
|
|
4292
|
-
number
|
|
4257
|
+
number(deltaMode);
|
|
4258
|
+
number(eventDeltaX);
|
|
4259
|
+
number(eventDeltaY);
|
|
4293
4260
|
// @ts-ignore
|
|
4294
4261
|
const {
|
|
4295
4262
|
deltaX,
|
|
@@ -4648,8 +4615,8 @@ const continueScrollingAndMovingSelection = async () => {
|
|
|
4648
4615
|
// @ts-ignore
|
|
4649
4616
|
const moveSelectionPx = (editor, x, y) => {
|
|
4650
4617
|
object(editor);
|
|
4651
|
-
number
|
|
4652
|
-
number
|
|
4618
|
+
number(x);
|
|
4619
|
+
number(y);
|
|
4653
4620
|
const position = at(editor, x, y);
|
|
4654
4621
|
if (!hasListener() && (position.rowIndex < editor.minLineY || position.rowIndex > editor.maxLineY)) {
|
|
4655
4622
|
requestAnimationFrame(continueScrollingAndMovingSelection);
|
|
@@ -5023,9 +4990,9 @@ const getFinalDeltaY = (height, itemHeight, itemsLength) => {
|
|
|
5023
4990
|
};
|
|
5024
4991
|
|
|
5025
4992
|
const getListHeight = (itemsLength, itemHeight, maxHeight) => {
|
|
5026
|
-
number
|
|
5027
|
-
number
|
|
5028
|
-
number
|
|
4993
|
+
number(itemsLength);
|
|
4994
|
+
number(itemHeight);
|
|
4995
|
+
number(maxHeight);
|
|
5029
4996
|
if (itemsLength === 0) {
|
|
5030
4997
|
return itemHeight;
|
|
5031
4998
|
}
|
|
@@ -6479,7 +6446,7 @@ const getEnabled$1 = () => {
|
|
|
6479
6446
|
};
|
|
6480
6447
|
|
|
6481
6448
|
const {
|
|
6482
|
-
listen: listen$
|
|
6449
|
+
listen: listen$5,
|
|
6483
6450
|
invoke: invoke$1
|
|
6484
6451
|
} = createRpc(SyntaxHighlightingWorker);
|
|
6485
6452
|
|
|
@@ -6642,7 +6609,7 @@ const create$2 = () => {
|
|
|
6642
6609
|
|
|
6643
6610
|
const executeHoverProvider = async (editor, offset) => {
|
|
6644
6611
|
object(editor);
|
|
6645
|
-
number
|
|
6612
|
+
number(offset);
|
|
6646
6613
|
return execute({
|
|
6647
6614
|
event: OnHover,
|
|
6648
6615
|
editor,
|
|
@@ -6654,14 +6621,14 @@ const executeHoverProvider = async (editor, offset) => {
|
|
|
6654
6621
|
|
|
6655
6622
|
const getHover = async (editor, offset) => {
|
|
6656
6623
|
object(editor);
|
|
6657
|
-
number
|
|
6624
|
+
number(offset);
|
|
6658
6625
|
// TODO invoke extension host worker directly
|
|
6659
6626
|
const hover = await executeHoverProvider(editor, offset);
|
|
6660
6627
|
return hover;
|
|
6661
6628
|
};
|
|
6662
6629
|
|
|
6663
6630
|
let _ipc;
|
|
6664
|
-
const listen$
|
|
6631
|
+
const listen$4 = async () => {
|
|
6665
6632
|
const ipc = await create$a({
|
|
6666
6633
|
method: RendererProcess
|
|
6667
6634
|
});
|
|
@@ -6810,7 +6777,7 @@ const getHoverPositionXy = (editor, rowIndex, wordStart, documentationHeight) =>
|
|
|
6810
6777
|
};
|
|
6811
6778
|
};
|
|
6812
6779
|
const getEditorHoverInfo = async (editorUid, position) => {
|
|
6813
|
-
number
|
|
6780
|
+
number(editorUid);
|
|
6814
6781
|
const instance = get$6(editorUid);
|
|
6815
6782
|
const editor = instance.newState;
|
|
6816
6783
|
const {
|
|
@@ -7802,7 +7769,7 @@ const getNumberOfVisibleItems = (listHeight, itemHeight) => {
|
|
|
7802
7769
|
|
|
7803
7770
|
const setDeltaY = (state, value) => {
|
|
7804
7771
|
object(state);
|
|
7805
|
-
number
|
|
7772
|
+
number(value);
|
|
7806
7773
|
const {
|
|
7807
7774
|
itemHeight,
|
|
7808
7775
|
finalDeltaY,
|
|
@@ -7827,8 +7794,8 @@ const setDeltaY = (state, value) => {
|
|
|
7827
7794
|
};
|
|
7828
7795
|
|
|
7829
7796
|
const handleWheel = (state, deltaMode, deltaY) => {
|
|
7830
|
-
number
|
|
7831
|
-
number
|
|
7797
|
+
number(deltaMode);
|
|
7798
|
+
number(deltaY);
|
|
7832
7799
|
return setDeltaY(state, state.deltaY + deltaY);
|
|
7833
7800
|
};
|
|
7834
7801
|
|
|
@@ -8480,15 +8447,15 @@ const getEnabled = () => {
|
|
|
8480
8447
|
};
|
|
8481
8448
|
|
|
8482
8449
|
const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
|
|
8483
|
-
await listen$
|
|
8450
|
+
await listen$4();
|
|
8484
8451
|
if (syntaxHighlightingEnabled) {
|
|
8485
8452
|
setEnabled$1(true);
|
|
8486
|
-
await listen$
|
|
8453
|
+
await listen$5();
|
|
8487
8454
|
}
|
|
8488
8455
|
if (syncIncremental) {
|
|
8489
8456
|
setEnabled(true);
|
|
8490
8457
|
}
|
|
8491
|
-
await listen$
|
|
8458
|
+
await listen$6();
|
|
8492
8459
|
};
|
|
8493
8460
|
|
|
8494
8461
|
// TODO move cursor
|
|
@@ -9671,6 +9638,27 @@ const Auto = () => {
|
|
|
9671
9638
|
const getData$1 = event => {
|
|
9672
9639
|
return event.data;
|
|
9673
9640
|
};
|
|
9641
|
+
const attachEvents = that => {
|
|
9642
|
+
const handleMessage = (...args) => {
|
|
9643
|
+
const data = that.getData(...args);
|
|
9644
|
+
that.dispatchEvent(new MessageEvent('message', {
|
|
9645
|
+
data
|
|
9646
|
+
}));
|
|
9647
|
+
};
|
|
9648
|
+
that.onMessage(handleMessage);
|
|
9649
|
+
const handleClose = event => {
|
|
9650
|
+
that.dispatchEvent(new Event('close'));
|
|
9651
|
+
};
|
|
9652
|
+
that.onClose(handleClose);
|
|
9653
|
+
};
|
|
9654
|
+
class Ipc extends EventTarget {
|
|
9655
|
+
constructor(rawIpc) {
|
|
9656
|
+
super();
|
|
9657
|
+
this._rawIpc = rawIpc;
|
|
9658
|
+
attachEvents(this);
|
|
9659
|
+
}
|
|
9660
|
+
}
|
|
9661
|
+
const readyMessage = 'ready';
|
|
9674
9662
|
const walkValue = (value, transferrables, isTransferrable) => {
|
|
9675
9663
|
if (!value) {
|
|
9676
9664
|
return;
|
|
@@ -9721,35 +9709,56 @@ const getTransferrables = value => {
|
|
|
9721
9709
|
walkValue(value, transferrables, isTransferrable);
|
|
9722
9710
|
return transferrables;
|
|
9723
9711
|
};
|
|
9724
|
-
const
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
data
|
|
9729
|
-
}));
|
|
9730
|
-
};
|
|
9731
|
-
that.onMessage(handleMessage);
|
|
9732
|
-
const handleClose = event => {
|
|
9733
|
-
that.dispatchEvent(new Event('close'));
|
|
9734
|
-
};
|
|
9735
|
-
that.onClose(handleClose);
|
|
9712
|
+
const listen$3 = ({
|
|
9713
|
+
port
|
|
9714
|
+
}) => {
|
|
9715
|
+
return port;
|
|
9736
9716
|
};
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9717
|
+
const signal$3 = port => {
|
|
9718
|
+
port.postMessage(readyMessage);
|
|
9719
|
+
};
|
|
9720
|
+
class IpcChildWithMessagePort extends Ipc {
|
|
9721
|
+
constructor(port) {
|
|
9722
|
+
super(port);
|
|
9723
|
+
}
|
|
9724
|
+
getData(event) {
|
|
9725
|
+
return getData$1(event);
|
|
9726
|
+
}
|
|
9727
|
+
send(message) {
|
|
9728
|
+
this._rawIpc.postMessage(message);
|
|
9729
|
+
}
|
|
9730
|
+
sendAndTransfer(message) {
|
|
9731
|
+
const transfer = getTransferrables(message);
|
|
9732
|
+
this._rawIpc.postMessage(message, transfer);
|
|
9733
|
+
}
|
|
9734
|
+
dispose() {
|
|
9735
|
+
// ignore
|
|
9736
|
+
}
|
|
9737
|
+
onClose(callback) {
|
|
9738
|
+
// ignore
|
|
9739
|
+
}
|
|
9740
|
+
onMessage(callback) {
|
|
9741
|
+
this._rawIpc.addEventListener('message', callback);
|
|
9742
|
+
this._rawIpc.start();
|
|
9742
9743
|
}
|
|
9743
9744
|
}
|
|
9744
|
-
const
|
|
9745
|
-
|
|
9745
|
+
const wrap$6 = port => {
|
|
9746
|
+
return new IpcChildWithMessagePort(port);
|
|
9747
|
+
};
|
|
9748
|
+
const IpcChildWithMessagePort$1 = {
|
|
9749
|
+
__proto__: null,
|
|
9750
|
+
listen: listen$3,
|
|
9751
|
+
signal: signal$3,
|
|
9752
|
+
wrap: wrap$6
|
|
9753
|
+
};
|
|
9754
|
+
const listen$2 = () => {
|
|
9746
9755
|
// @ts-ignore
|
|
9747
9756
|
if (typeof WorkerGlobalScope === 'undefined') {
|
|
9748
9757
|
throw new TypeError('module is not in web worker scope');
|
|
9749
9758
|
}
|
|
9750
9759
|
return globalThis;
|
|
9751
9760
|
};
|
|
9752
|
-
const signal$
|
|
9761
|
+
const signal$2 = global => {
|
|
9753
9762
|
global.postMessage(readyMessage);
|
|
9754
9763
|
};
|
|
9755
9764
|
class IpcChildWithModuleWorker extends Ipc {
|
|
@@ -9775,14 +9784,14 @@ class IpcChildWithModuleWorker extends Ipc {
|
|
|
9775
9784
|
this._rawIpc.addEventListener('message', callback);
|
|
9776
9785
|
}
|
|
9777
9786
|
}
|
|
9778
|
-
const wrap$
|
|
9787
|
+
const wrap$5 = global => {
|
|
9779
9788
|
return new IpcChildWithModuleWorker(global);
|
|
9780
9789
|
};
|
|
9781
9790
|
const IpcChildWithModuleWorker$1 = {
|
|
9782
9791
|
__proto__: null,
|
|
9783
|
-
listen: listen$
|
|
9784
|
-
signal: signal$
|
|
9785
|
-
wrap: wrap$
|
|
9792
|
+
listen: listen$2,
|
|
9793
|
+
signal: signal$2,
|
|
9794
|
+
wrap: wrap$5
|
|
9786
9795
|
};
|
|
9787
9796
|
const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
|
|
9788
9797
|
const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
|
|
@@ -9899,10 +9908,10 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
9899
9908
|
};
|
|
9900
9909
|
const normalizeLine = line => {
|
|
9901
9910
|
if (line.startsWith('Error: ')) {
|
|
9902
|
-
return line.slice(
|
|
9911
|
+
return line.slice('Error: '.length);
|
|
9903
9912
|
}
|
|
9904
9913
|
if (line.startsWith('VError: ')) {
|
|
9905
|
-
return line.slice(
|
|
9914
|
+
return line.slice('VError: '.length);
|
|
9906
9915
|
}
|
|
9907
9916
|
return line;
|
|
9908
9917
|
};
|
|
@@ -10000,10 +10009,10 @@ const waitForFirstMessage = async port => {
|
|
|
10000
10009
|
// @ts-ignore
|
|
10001
10010
|
return event.data;
|
|
10002
10011
|
};
|
|
10003
|
-
const listen$
|
|
10004
|
-
const parentIpcRaw = listen$
|
|
10005
|
-
signal$
|
|
10006
|
-
const parentIpc = wrap$
|
|
10012
|
+
const listen$1$1 = async () => {
|
|
10013
|
+
const parentIpcRaw = listen$2();
|
|
10014
|
+
signal$2(parentIpcRaw);
|
|
10015
|
+
const parentIpc = wrap$5(parentIpcRaw);
|
|
10007
10016
|
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
10008
10017
|
if (firstMessage.method !== 'initialize') {
|
|
10009
10018
|
throw new IpcError('unexpected first message');
|
|
@@ -10048,55 +10057,13 @@ class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
|
10048
10057
|
this._rawIpc.start();
|
|
10049
10058
|
}
|
|
10050
10059
|
}
|
|
10051
|
-
const wrap$
|
|
10060
|
+
const wrap$4 = port => {
|
|
10052
10061
|
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
10053
10062
|
};
|
|
10054
10063
|
const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
10055
10064
|
__proto__: null,
|
|
10056
|
-
listen: listen$
|
|
10057
|
-
wrap: wrap$
|
|
10058
|
-
};
|
|
10059
|
-
const listen$2 = ({
|
|
10060
|
-
port
|
|
10061
|
-
}) => {
|
|
10062
|
-
return port;
|
|
10063
|
-
};
|
|
10064
|
-
const signal = port => {
|
|
10065
|
-
port.postMessage(readyMessage);
|
|
10066
|
-
};
|
|
10067
|
-
class IpcChildWithMessagePort extends Ipc {
|
|
10068
|
-
constructor(port) {
|
|
10069
|
-
super(port);
|
|
10070
|
-
}
|
|
10071
|
-
getData(event) {
|
|
10072
|
-
return getData$1(event);
|
|
10073
|
-
}
|
|
10074
|
-
send(message) {
|
|
10075
|
-
this._rawIpc.postMessage(message);
|
|
10076
|
-
}
|
|
10077
|
-
sendAndTransfer(message) {
|
|
10078
|
-
const transfer = getTransferrables(message);
|
|
10079
|
-
this._rawIpc.postMessage(message, transfer);
|
|
10080
|
-
}
|
|
10081
|
-
dispose() {
|
|
10082
|
-
// ignore
|
|
10083
|
-
}
|
|
10084
|
-
onClose(callback) {
|
|
10085
|
-
// ignore
|
|
10086
|
-
}
|
|
10087
|
-
onMessage(callback) {
|
|
10088
|
-
this._rawIpc.addEventListener('message', callback);
|
|
10089
|
-
this._rawIpc.start();
|
|
10090
|
-
}
|
|
10091
|
-
}
|
|
10092
|
-
const wrap$2 = port => {
|
|
10093
|
-
return new IpcChildWithMessagePort(port);
|
|
10094
|
-
};
|
|
10095
|
-
const IpcChildWithMessagePort$1 = {
|
|
10096
|
-
__proto__: null,
|
|
10097
|
-
listen: listen$2,
|
|
10098
|
-
signal,
|
|
10099
|
-
wrap: wrap$2
|
|
10065
|
+
listen: listen$1$1,
|
|
10066
|
+
wrap: wrap$4
|
|
10100
10067
|
};
|
|
10101
10068
|
|
|
10102
10069
|
const getModule = method => {
|
|
@@ -10133,7 +10100,7 @@ const listen = async () => {
|
|
|
10133
10100
|
method: Auto()
|
|
10134
10101
|
});
|
|
10135
10102
|
handleIpc(ipc);
|
|
10136
|
-
listen$
|
|
10103
|
+
listen$7(ipc);
|
|
10137
10104
|
};
|
|
10138
10105
|
|
|
10139
10106
|
const addWidget = (widget, id, render) => {
|