@lvce-editor/editor-worker 5.13.0 → 5.16.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 +517 -576
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -145,7 +145,7 @@ const InsertLineBreak = 'insertLineBreak';
|
|
|
145
145
|
const LineComment = 'lineComment';
|
|
146
146
|
const Rename$1 = 'rename';
|
|
147
147
|
const ReplaceAll$2 = 'replaceAll';
|
|
148
|
-
const ToggleBlockComment = 'toggleBlockComment';
|
|
148
|
+
const ToggleBlockComment$1 = 'toggleBlockComment';
|
|
149
149
|
|
|
150
150
|
const map$1 = Object.create(null);
|
|
151
151
|
const set$7 = (id, widget) => {
|
|
@@ -236,6 +236,34 @@ const getNewDeltaPercent = (height, scrollBarHeight, relativeY) => {
|
|
|
236
236
|
};
|
|
237
237
|
};
|
|
238
238
|
|
|
239
|
+
// TODO this should be in a separate scrolling module
|
|
240
|
+
const setDeltaY$3 = (state, value) => {
|
|
241
|
+
object(state);
|
|
242
|
+
number(value);
|
|
243
|
+
const {
|
|
244
|
+
finalDeltaY,
|
|
245
|
+
deltaY,
|
|
246
|
+
numberOfVisibleLines,
|
|
247
|
+
height,
|
|
248
|
+
scrollBarHeight,
|
|
249
|
+
itemHeight
|
|
250
|
+
} = state;
|
|
251
|
+
const newDeltaY = clamp(value, 0, finalDeltaY);
|
|
252
|
+
if (deltaY === newDeltaY) {
|
|
253
|
+
return state;
|
|
254
|
+
}
|
|
255
|
+
const newMinLineY = Math.floor(newDeltaY / itemHeight);
|
|
256
|
+
const newMaxLineY = newMinLineY + numberOfVisibleLines;
|
|
257
|
+
const scrollBarY = getScrollBarY(newDeltaY, finalDeltaY, height, scrollBarHeight);
|
|
258
|
+
return {
|
|
259
|
+
...state,
|
|
260
|
+
minLineY: newMinLineY,
|
|
261
|
+
maxLineY: newMaxLineY,
|
|
262
|
+
deltaY: newDeltaY,
|
|
263
|
+
scrollBarY
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
|
|
239
267
|
const splitLines$2 = lines => {
|
|
240
268
|
if (!lines) {
|
|
241
269
|
return [];
|
|
@@ -424,34 +452,6 @@ const positionAt = (textDocument, offset) => {
|
|
|
424
452
|
};
|
|
425
453
|
};
|
|
426
454
|
|
|
427
|
-
// TODO this should be in a separate scrolling module
|
|
428
|
-
const setDeltaY$3 = (state, value) => {
|
|
429
|
-
object(state);
|
|
430
|
-
number(value);
|
|
431
|
-
const {
|
|
432
|
-
finalDeltaY,
|
|
433
|
-
deltaY,
|
|
434
|
-
numberOfVisibleLines,
|
|
435
|
-
height,
|
|
436
|
-
scrollBarHeight,
|
|
437
|
-
itemHeight
|
|
438
|
-
} = state;
|
|
439
|
-
const newDeltaY = clamp(value, 0, finalDeltaY);
|
|
440
|
-
if (deltaY === newDeltaY) {
|
|
441
|
-
return state;
|
|
442
|
-
}
|
|
443
|
-
const newMinLineY = Math.floor(newDeltaY / itemHeight);
|
|
444
|
-
const newMaxLineY = newMinLineY + numberOfVisibleLines;
|
|
445
|
-
const scrollBarY = getScrollBarY(newDeltaY, finalDeltaY, height, scrollBarHeight);
|
|
446
|
-
return {
|
|
447
|
-
...state,
|
|
448
|
-
minLineY: newMinLineY,
|
|
449
|
-
maxLineY: newMaxLineY,
|
|
450
|
-
deltaY: newDeltaY,
|
|
451
|
-
scrollBarY
|
|
452
|
-
};
|
|
453
|
-
};
|
|
454
|
-
|
|
455
455
|
const getSelectionPairs = (selections, i) => {
|
|
456
456
|
const first = selections[i];
|
|
457
457
|
const second = selections[i + 1];
|
|
@@ -464,7 +464,7 @@ const getSelectionPairs = (selections, i) => {
|
|
|
464
464
|
};
|
|
465
465
|
|
|
466
466
|
const EmptyString$1 = '';
|
|
467
|
-
const NewLine$
|
|
467
|
+
const NewLine$3 = '\n';
|
|
468
468
|
const Space$2 = ' ';
|
|
469
469
|
const Tab$1 = '\t';
|
|
470
470
|
const DoubleQuote$1 = '"';
|
|
@@ -1067,9 +1067,6 @@ let id = 0;
|
|
|
1067
1067
|
const create$3$1 = () => {
|
|
1068
1068
|
return ++id;
|
|
1069
1069
|
};
|
|
1070
|
-
const warn$1 = (...args) => {
|
|
1071
|
-
console.warn(...args);
|
|
1072
|
-
};
|
|
1073
1070
|
const registerPromise = () => {
|
|
1074
1071
|
const id = create$3$1();
|
|
1075
1072
|
const {
|
|
@@ -1082,16 +1079,6 @@ const registerPromise = () => {
|
|
|
1082
1079
|
promise
|
|
1083
1080
|
};
|
|
1084
1081
|
};
|
|
1085
|
-
const resolve = (id, response) => {
|
|
1086
|
-
const fn = get$5(id);
|
|
1087
|
-
if (!fn) {
|
|
1088
|
-
console.log(response);
|
|
1089
|
-
warn$1(`callback ${id} may already be disposed`);
|
|
1090
|
-
return;
|
|
1091
|
-
}
|
|
1092
|
-
fn(response);
|
|
1093
|
-
remove$8(id);
|
|
1094
|
-
};
|
|
1095
1082
|
const create$2$1 = (method, params) => {
|
|
1096
1083
|
const {
|
|
1097
1084
|
id,
|
|
@@ -1114,7 +1101,7 @@ class JsonRpcError extends Error {
|
|
|
1114
1101
|
this.name = 'JsonRpcError';
|
|
1115
1102
|
}
|
|
1116
1103
|
}
|
|
1117
|
-
const NewLine$
|
|
1104
|
+
const NewLine$2 = '\n';
|
|
1118
1105
|
const DomException = 'DOMException';
|
|
1119
1106
|
const ReferenceError$1 = 'ReferenceError';
|
|
1120
1107
|
const SyntaxError$1 = 'SyntaxError';
|
|
@@ -1159,23 +1146,23 @@ const constructError = (message, type, name) => {
|
|
|
1159
1146
|
}
|
|
1160
1147
|
return new ErrorConstructor(message);
|
|
1161
1148
|
};
|
|
1162
|
-
const getNewLineIndex$
|
|
1163
|
-
return string.indexOf(NewLine$
|
|
1149
|
+
const getNewLineIndex$1 = (string, startIndex = undefined) => {
|
|
1150
|
+
return string.indexOf(NewLine$2, startIndex);
|
|
1164
1151
|
};
|
|
1165
1152
|
const getParentStack = error => {
|
|
1166
1153
|
let parentStack = error.stack || error.data || error.message || '';
|
|
1167
1154
|
if (parentStack.startsWith(' at')) {
|
|
1168
|
-
parentStack = error.message + NewLine$
|
|
1155
|
+
parentStack = error.message + NewLine$2 + parentStack;
|
|
1169
1156
|
}
|
|
1170
1157
|
return parentStack;
|
|
1171
1158
|
};
|
|
1172
1159
|
const joinLines$1 = lines => {
|
|
1173
|
-
return lines.join(NewLine$
|
|
1160
|
+
return lines.join(NewLine$2);
|
|
1174
1161
|
};
|
|
1175
1162
|
const MethodNotFound = -32601;
|
|
1176
1163
|
const Custom = -32001;
|
|
1177
1164
|
const splitLines$1 = lines => {
|
|
1178
|
-
return lines.split(NewLine$
|
|
1165
|
+
return lines.split(NewLine$2);
|
|
1179
1166
|
};
|
|
1180
1167
|
const restoreJsonRpcError = error => {
|
|
1181
1168
|
if (error && error instanceof Error) {
|
|
@@ -1185,14 +1172,14 @@ const restoreJsonRpcError = error => {
|
|
|
1185
1172
|
if (error && error.code && error.code === MethodNotFound) {
|
|
1186
1173
|
const restoredError = new JsonRpcError(error.message);
|
|
1187
1174
|
const parentStack = getParentStack(error);
|
|
1188
|
-
restoredError.stack = parentStack + NewLine$
|
|
1175
|
+
restoredError.stack = parentStack + NewLine$2 + currentStack;
|
|
1189
1176
|
return restoredError;
|
|
1190
1177
|
}
|
|
1191
1178
|
if (error && error.message) {
|
|
1192
1179
|
const restoredError = constructError(error.message, error.type, error.name);
|
|
1193
1180
|
if (error.data) {
|
|
1194
1181
|
if (error.data.stack && error.data.type && error.message) {
|
|
1195
|
-
restoredError.stack = error.data.type + ': ' + error.message + NewLine$
|
|
1182
|
+
restoredError.stack = error.data.type + ': ' + error.message + NewLine$2 + error.data.stack + NewLine$2 + currentStack;
|
|
1196
1183
|
} else if (error.data.stack) {
|
|
1197
1184
|
restoredError.stack = error.data.stack;
|
|
1198
1185
|
}
|
|
@@ -1212,7 +1199,7 @@ const restoreJsonRpcError = error => {
|
|
|
1212
1199
|
if (error.stack) {
|
|
1213
1200
|
const lowerStack = restoredError.stack || '';
|
|
1214
1201
|
// @ts-ignore
|
|
1215
|
-
const indexNewLine = getNewLineIndex$
|
|
1202
|
+
const indexNewLine = getNewLineIndex$1(lowerStack);
|
|
1216
1203
|
const parentStack = getParentStack(error);
|
|
1217
1204
|
// @ts-ignore
|
|
1218
1205
|
restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
|
|
@@ -1239,6 +1226,19 @@ const unwrapJsonRpcResult = responseMessage => {
|
|
|
1239
1226
|
}
|
|
1240
1227
|
throw new JsonRpcError('unexpected response message');
|
|
1241
1228
|
};
|
|
1229
|
+
const warn$1 = (...args) => {
|
|
1230
|
+
console.warn(...args);
|
|
1231
|
+
};
|
|
1232
|
+
const resolve = (id, response) => {
|
|
1233
|
+
const fn = get$5(id);
|
|
1234
|
+
if (!fn) {
|
|
1235
|
+
console.log(response);
|
|
1236
|
+
warn$1(`callback ${id} may already be disposed`);
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
fn(response);
|
|
1240
|
+
remove$8(id);
|
|
1241
|
+
};
|
|
1242
1242
|
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
1243
1243
|
const getErrorType = prettyError => {
|
|
1244
1244
|
if (prettyError && prettyError.type) {
|
|
@@ -1457,7 +1457,7 @@ const invokeAndTransfer$1 = async (method, ...params) => {
|
|
|
1457
1457
|
const ipc = get$4();
|
|
1458
1458
|
return invokeAndTransfer$2(ipc, method, ...params);
|
|
1459
1459
|
};
|
|
1460
|
-
const listen$
|
|
1460
|
+
const listen$5 = ipc => {
|
|
1461
1461
|
set$4(ipc);
|
|
1462
1462
|
};
|
|
1463
1463
|
|
|
@@ -1549,8 +1549,8 @@ const IpcParentWithExtensionHostWorker = {
|
|
|
1549
1549
|
wrap: wrap$2
|
|
1550
1550
|
};
|
|
1551
1551
|
|
|
1552
|
-
const
|
|
1553
|
-
await invokeAndTransfer('
|
|
1552
|
+
const sendMessagePortToRendererProcess = async port => {
|
|
1553
|
+
await invokeAndTransfer('SendMessagePortToRendererProcess.sendMessagePortToRendererProcess', port, 'HandleMessagePort.handleMessagePort');
|
|
1554
1554
|
};
|
|
1555
1555
|
|
|
1556
1556
|
const create$c = async () => {
|
|
@@ -1558,7 +1558,7 @@ const create$c = async () => {
|
|
|
1558
1558
|
port1,
|
|
1559
1559
|
port2
|
|
1560
1560
|
} = getPortTuple();
|
|
1561
|
-
await
|
|
1561
|
+
await sendMessagePortToRendererProcess(port1);
|
|
1562
1562
|
const event = await waitForFirstMessage$1(port2);
|
|
1563
1563
|
if (event.data !== 'ready') {
|
|
1564
1564
|
throw new IpcError$1('unexpected first message');
|
|
@@ -1596,14 +1596,14 @@ const wrap$1 = port => {
|
|
|
1596
1596
|
};
|
|
1597
1597
|
};
|
|
1598
1598
|
|
|
1599
|
-
const
|
|
1599
|
+
const IpcParentWithRendererProcess = {
|
|
1600
1600
|
__proto__: null,
|
|
1601
1601
|
create: create$c,
|
|
1602
1602
|
wrap: wrap$1
|
|
1603
1603
|
};
|
|
1604
1604
|
|
|
1605
|
-
const
|
|
1606
|
-
await invokeAndTransfer('
|
|
1605
|
+
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
1606
|
+
await invokeAndTransfer('SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort');
|
|
1607
1607
|
};
|
|
1608
1608
|
|
|
1609
1609
|
const create$b = async () => {
|
|
@@ -1611,7 +1611,7 @@ const create$b = async () => {
|
|
|
1611
1611
|
port1,
|
|
1612
1612
|
port2
|
|
1613
1613
|
} = getPortTuple();
|
|
1614
|
-
await
|
|
1614
|
+
await sendMessagePortToSyntaxHighlightingWorker(port1);
|
|
1615
1615
|
const event = await waitForFirstMessage$1(port2);
|
|
1616
1616
|
if (event.data !== 'ready') {
|
|
1617
1617
|
throw new IpcError$1('unexpected first message');
|
|
@@ -1649,7 +1649,7 @@ const wrap = port => {
|
|
|
1649
1649
|
};
|
|
1650
1650
|
};
|
|
1651
1651
|
|
|
1652
|
-
const
|
|
1652
|
+
const IpcParentWithSyntaxHighlightingWorker = {
|
|
1653
1653
|
__proto__: null,
|
|
1654
1654
|
create: create$b,
|
|
1655
1655
|
wrap
|
|
@@ -1672,7 +1672,7 @@ const create$a = async ({
|
|
|
1672
1672
|
method,
|
|
1673
1673
|
...options
|
|
1674
1674
|
}) => {
|
|
1675
|
-
const module =
|
|
1675
|
+
const module = getModule$1(method);
|
|
1676
1676
|
// @ts-ignore
|
|
1677
1677
|
const rawIpc = await module.create(options);
|
|
1678
1678
|
// @ts-ignore
|
|
@@ -1702,7 +1702,7 @@ const createRpc = method => {
|
|
|
1702
1702
|
};
|
|
1703
1703
|
|
|
1704
1704
|
const {
|
|
1705
|
-
listen: listen$
|
|
1705
|
+
listen: listen$4,
|
|
1706
1706
|
invoke: invoke$2
|
|
1707
1707
|
} = createRpc(ExtensionHostWorker);
|
|
1708
1708
|
|
|
@@ -1752,19 +1752,13 @@ const execute = async ({
|
|
|
1752
1752
|
return result;
|
|
1753
1753
|
};
|
|
1754
1754
|
|
|
1755
|
-
const combineResults$3 = results => {
|
|
1756
|
-
return results[0];
|
|
1757
|
-
};
|
|
1758
1755
|
const executeDiagnosticProvider = editor => {
|
|
1759
1756
|
return execute({
|
|
1760
1757
|
editor,
|
|
1761
1758
|
event: OnDiagnostic,
|
|
1762
1759
|
method: 'ExtensionHost.executeDiagnosticProvider',
|
|
1763
1760
|
args: [],
|
|
1764
|
-
noProviderFoundMessage: 'no diagnostic provider found'
|
|
1765
|
-
noProviderResult: [],
|
|
1766
|
-
combineResults: combineResults$3
|
|
1767
|
-
});
|
|
1761
|
+
noProviderFoundMessage: 'no diagnostic provider found'});
|
|
1768
1762
|
};
|
|
1769
1763
|
|
|
1770
1764
|
const getDiagnosticType = diagnostic => {
|
|
@@ -2212,7 +2206,6 @@ const at = (editor, eventX, eventY) => {
|
|
|
2212
2206
|
letterSpacing,
|
|
2213
2207
|
lines,
|
|
2214
2208
|
tabSize,
|
|
2215
|
-
differences,
|
|
2216
2209
|
isMonospaceFont,
|
|
2217
2210
|
charWidth
|
|
2218
2211
|
} = editor;
|
|
@@ -2364,15 +2357,6 @@ const cancelSelection = editor => {
|
|
|
2364
2357
|
return scheduleSelections(editor, newSelections);
|
|
2365
2358
|
};
|
|
2366
2359
|
|
|
2367
|
-
const CodeGenerator = 1;
|
|
2368
|
-
const ColorPicker$1 = 2;
|
|
2369
|
-
const Completion = 3;
|
|
2370
|
-
const CompletionDetail = 4;
|
|
2371
|
-
const Find = 5;
|
|
2372
|
-
const Hover = 6;
|
|
2373
|
-
const Rename = 7;
|
|
2374
|
-
const SourceAction = 8;
|
|
2375
|
-
|
|
2376
2360
|
const getIndex = (widgets, id) => {
|
|
2377
2361
|
for (const [i, widget] of widgets.entries()) {
|
|
2378
2362
|
if (widget.id === id) {
|
|
@@ -2387,6 +2371,15 @@ const removeEditorWidget = (widgets, id) => {
|
|
|
2387
2371
|
return newWidgets;
|
|
2388
2372
|
};
|
|
2389
2373
|
|
|
2374
|
+
const CodeGenerator = 1;
|
|
2375
|
+
const ColorPicker$1 = 2;
|
|
2376
|
+
const Completion = 3;
|
|
2377
|
+
const CompletionDetail = 4;
|
|
2378
|
+
const Find = 5;
|
|
2379
|
+
const Hover = 6;
|
|
2380
|
+
const Rename = 7;
|
|
2381
|
+
const SourceAction$1 = 8;
|
|
2382
|
+
|
|
2390
2383
|
const isMatchingWidget$2 = widget => {
|
|
2391
2384
|
return widget.id === CodeGenerator;
|
|
2392
2385
|
};
|
|
@@ -2464,7 +2457,7 @@ const closeRename = editor => {
|
|
|
2464
2457
|
};
|
|
2465
2458
|
|
|
2466
2459
|
const isMatchingWidget = widget => {
|
|
2467
|
-
return widget.id === SourceAction;
|
|
2460
|
+
return widget.id === SourceAction$1;
|
|
2468
2461
|
};
|
|
2469
2462
|
const closeSourceAction = editor => {
|
|
2470
2463
|
const {
|
|
@@ -2474,7 +2467,7 @@ const closeSourceAction = editor => {
|
|
|
2474
2467
|
if (index === -1) {
|
|
2475
2468
|
return editor;
|
|
2476
2469
|
}
|
|
2477
|
-
const newWidgets = removeEditorWidget(widgets, SourceAction);
|
|
2470
|
+
const newWidgets = removeEditorWidget(widgets, SourceAction$1);
|
|
2478
2471
|
return {
|
|
2479
2472
|
...editor,
|
|
2480
2473
|
widgets: newWidgets
|
|
@@ -2618,7 +2611,7 @@ const compositionEnd = (editor, data) => {
|
|
|
2618
2611
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
2619
2612
|
};
|
|
2620
2613
|
|
|
2621
|
-
const normalizeLine
|
|
2614
|
+
const normalizeLine = line => {
|
|
2622
2615
|
if (line.startsWith('Error: ')) {
|
|
2623
2616
|
return line.slice('Error: '.length);
|
|
2624
2617
|
}
|
|
@@ -2627,41 +2620,41 @@ const normalizeLine$1 = line => {
|
|
|
2627
2620
|
}
|
|
2628
2621
|
return line;
|
|
2629
2622
|
};
|
|
2630
|
-
const getCombinedMessage
|
|
2631
|
-
const stringifiedError = normalizeLine
|
|
2623
|
+
const getCombinedMessage = (error, message) => {
|
|
2624
|
+
const stringifiedError = normalizeLine(`${error}`);
|
|
2632
2625
|
if (message) {
|
|
2633
2626
|
return `${message}: ${stringifiedError}`;
|
|
2634
2627
|
}
|
|
2635
2628
|
return stringifiedError;
|
|
2636
2629
|
};
|
|
2637
|
-
const NewLine$
|
|
2638
|
-
const getNewLineIndex
|
|
2639
|
-
return string.indexOf(NewLine$
|
|
2630
|
+
const NewLine$1 = '\n';
|
|
2631
|
+
const getNewLineIndex = (string, startIndex = undefined) => {
|
|
2632
|
+
return string.indexOf(NewLine$1, startIndex);
|
|
2640
2633
|
};
|
|
2641
|
-
const mergeStacks
|
|
2634
|
+
const mergeStacks = (parent, child) => {
|
|
2642
2635
|
if (!child) {
|
|
2643
2636
|
return parent;
|
|
2644
2637
|
}
|
|
2645
|
-
const parentNewLineIndex = getNewLineIndex
|
|
2646
|
-
const childNewLineIndex = getNewLineIndex
|
|
2638
|
+
const parentNewLineIndex = getNewLineIndex(parent);
|
|
2639
|
+
const childNewLineIndex = getNewLineIndex(child);
|
|
2647
2640
|
if (childNewLineIndex === -1) {
|
|
2648
2641
|
return parent;
|
|
2649
2642
|
}
|
|
2650
2643
|
const parentFirstLine = parent.slice(0, parentNewLineIndex);
|
|
2651
2644
|
const childRest = child.slice(childNewLineIndex);
|
|
2652
|
-
const childFirstLine = normalizeLine
|
|
2645
|
+
const childFirstLine = normalizeLine(child.slice(0, childNewLineIndex));
|
|
2653
2646
|
if (parentFirstLine.includes(childFirstLine)) {
|
|
2654
2647
|
return parentFirstLine + childRest;
|
|
2655
2648
|
}
|
|
2656
2649
|
return child;
|
|
2657
2650
|
};
|
|
2658
|
-
|
|
2651
|
+
class VError extends Error {
|
|
2659
2652
|
constructor(error, message) {
|
|
2660
|
-
const combinedMessage = getCombinedMessage
|
|
2653
|
+
const combinedMessage = getCombinedMessage(error, message);
|
|
2661
2654
|
super(combinedMessage);
|
|
2662
2655
|
this.name = 'VError';
|
|
2663
2656
|
if (error instanceof Error) {
|
|
2664
|
-
this.stack = mergeStacks
|
|
2657
|
+
this.stack = mergeStacks(this.stack, error.stack);
|
|
2665
2658
|
}
|
|
2666
2659
|
if (error.codeFrame) {
|
|
2667
2660
|
// @ts-ignore
|
|
@@ -2672,14 +2665,14 @@ let VError$1 = class VError extends Error {
|
|
|
2672
2665
|
this.code = error.code;
|
|
2673
2666
|
}
|
|
2674
2667
|
}
|
|
2675
|
-
}
|
|
2668
|
+
}
|
|
2676
2669
|
|
|
2677
2670
|
const writeText = async text => {
|
|
2678
2671
|
try {
|
|
2679
2672
|
string(text);
|
|
2680
2673
|
await invoke$3('ClipBoard.writeText', /* text */text);
|
|
2681
2674
|
} catch (error) {
|
|
2682
|
-
throw new VError
|
|
2675
|
+
throw new VError(error, 'Failed to write text to clipboard');
|
|
2683
2676
|
}
|
|
2684
2677
|
};
|
|
2685
2678
|
|
|
@@ -3449,151 +3442,130 @@ const i18nString = (key, placeholders = emptyObject) => {
|
|
|
3449
3442
|
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
3450
3443
|
};
|
|
3451
3444
|
|
|
3452
|
-
const
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
MoveLineDown: 'Move Line Down',
|
|
3484
|
-
MoveLineUp: 'Move Line Up',
|
|
3485
|
-
NoCodeActionsAvailable: 'No code actions available',
|
|
3486
|
-
NoDefinitionFound: 'No definition found',
|
|
3487
|
-
NoDefinitionFoundFor: "No definition found for '{PH1}'",
|
|
3488
|
-
NoResults: 'No Results',
|
|
3489
|
-
NoTypeDefinitionFound: 'No type definition found',
|
|
3490
|
-
NoTypeDefinitionFoundFor: "No type definition found for '{PH1}'",
|
|
3491
|
-
OrganizeImports: 'Organize Imports',
|
|
3492
|
-
Paste: 'Paste',
|
|
3493
|
-
Redo: 'Redo',
|
|
3494
|
-
Replace: 'Replace',
|
|
3495
|
-
SelectAll: 'Select All',
|
|
3496
|
-
Separator: 'Separator',
|
|
3497
|
-
SortImports: 'Sort Imports',
|
|
3498
|
-
SourceAction: 'Source Action',
|
|
3499
|
-
SourceActions: 'Source Actions',
|
|
3500
|
-
ToggleBlockComment: 'Toggle Block Comment',
|
|
3501
|
-
ToggleLineComment: 'Toggle Line Comment',
|
|
3502
|
-
Undo: 'Undo'
|
|
3503
|
-
};
|
|
3445
|
+
const EditorCloseColorPicker = 'Editor: Close Color Picker';
|
|
3446
|
+
const EditorCopyLineDown = 'Editor: Copy Line Down';
|
|
3447
|
+
const EditorCopyLineUp = 'Editor: Copy Line Up';
|
|
3448
|
+
const EditorFormatDocumentForced = 'Editor: Format Document (forced)';
|
|
3449
|
+
const EditorGoToDefinition = 'Editor: Go To Definition';
|
|
3450
|
+
const EditorGoToTypeDefinition = 'Editor: Go To Type Definition';
|
|
3451
|
+
const EditorIndent = 'Editor: Indent';
|
|
3452
|
+
const EditorOpenColorPicker = 'Editor: Open Color Picker';
|
|
3453
|
+
const EditorSelectAllOccurrences = 'Editor: Select All Occurrences';
|
|
3454
|
+
const EditorSelectDown = 'Editor: Select Down';
|
|
3455
|
+
const EditorSelectInsideString = 'Editor: Select Inside String';
|
|
3456
|
+
const EditorSelectNextOccurrence = 'Editor: Select Next Occurrence';
|
|
3457
|
+
const EditorSelectUp = 'Editor: Select Up';
|
|
3458
|
+
const EditorShowHover = 'Show Hover';
|
|
3459
|
+
const EditorSortLinesAscending = 'Editor: Sort Lines Ascending';
|
|
3460
|
+
const EditorToggleComment = 'Editor: Toggle Comment';
|
|
3461
|
+
const EditorUnindent = 'Editor: Unindent';
|
|
3462
|
+
const EnterCode = 'Enter Code';
|
|
3463
|
+
const EscapeToClose = 'Escape to close';
|
|
3464
|
+
const FormatDocument = 'Format Document';
|
|
3465
|
+
const MoveLineDown = 'Move Line Down';
|
|
3466
|
+
const MoveLineUp = 'Move Line Up';
|
|
3467
|
+
const NoCodeActionsAvailable = 'No code actions available';
|
|
3468
|
+
const NoDefinitionFound = 'No definition found';
|
|
3469
|
+
const NoDefinitionFoundFor = "No definition found for '{PH1}'";
|
|
3470
|
+
const NoResults = 'No Results';
|
|
3471
|
+
const NoTypeDefinitionFound = 'No type definition found';
|
|
3472
|
+
const NoTypeDefinitionFoundFor = "No type definition found for '{PH1}'";
|
|
3473
|
+
const SourceAction = 'Source Action';
|
|
3474
|
+
const ToggleBlockComment = 'Toggle Block Comment';
|
|
3475
|
+
|
|
3504
3476
|
const noDefinitionFound = () => {
|
|
3505
|
-
return i18nString(
|
|
3477
|
+
return i18nString(NoDefinitionFound);
|
|
3506
3478
|
};
|
|
3507
3479
|
const noDefinitionFoundFor = word => {
|
|
3508
|
-
return i18nString(
|
|
3480
|
+
return i18nString(NoDefinitionFoundFor, {
|
|
3509
3481
|
PH1: word
|
|
3510
3482
|
});
|
|
3511
3483
|
};
|
|
3512
3484
|
const noTypeDefinitionFoundFor = word => {
|
|
3513
|
-
return i18nString(
|
|
3485
|
+
return i18nString(NoTypeDefinitionFoundFor, {
|
|
3514
3486
|
PH1: word
|
|
3515
3487
|
});
|
|
3516
3488
|
};
|
|
3517
3489
|
const noTypeDefinitionFound = () => {
|
|
3518
|
-
return i18nString(
|
|
3490
|
+
return i18nString(NoTypeDefinitionFound);
|
|
3519
3491
|
};
|
|
3520
3492
|
const noResults$1 = () => {
|
|
3521
|
-
return i18nString(
|
|
3493
|
+
return i18nString(NoResults);
|
|
3522
3494
|
};
|
|
3523
3495
|
const sourceAction = () => {
|
|
3524
|
-
return i18nString(
|
|
3496
|
+
return i18nString(SourceAction);
|
|
3525
3497
|
};
|
|
3526
3498
|
const noCodeActionsAvailable = () => {
|
|
3527
|
-
return i18nString(
|
|
3499
|
+
return i18nString(NoCodeActionsAvailable);
|
|
3528
3500
|
};
|
|
3529
3501
|
const escapeToClose = () => {
|
|
3530
|
-
return i18nString(
|
|
3502
|
+
return i18nString(EscapeToClose);
|
|
3531
3503
|
};
|
|
3532
3504
|
const enterCode = () => {
|
|
3533
|
-
return i18nString(
|
|
3505
|
+
return i18nString(EnterCode);
|
|
3534
3506
|
};
|
|
3535
3507
|
const toggleBlockComment$1 = () => {
|
|
3536
|
-
return i18nString(
|
|
3508
|
+
return i18nString(ToggleBlockComment);
|
|
3537
3509
|
};
|
|
3538
3510
|
const moveLineUp$1 = () => {
|
|
3539
|
-
return i18nString(
|
|
3511
|
+
return i18nString(MoveLineUp);
|
|
3540
3512
|
};
|
|
3541
3513
|
const moveLineDown$1 = () => {
|
|
3542
|
-
return i18nString(
|
|
3514
|
+
return i18nString(MoveLineDown);
|
|
3543
3515
|
};
|
|
3544
3516
|
const formatDocument = () => {
|
|
3545
|
-
return i18nString(
|
|
3517
|
+
return i18nString(FormatDocument);
|
|
3546
3518
|
};
|
|
3547
3519
|
const editorShowHover = () => {
|
|
3548
|
-
return i18nString(
|
|
3520
|
+
return i18nString(EditorShowHover);
|
|
3549
3521
|
};
|
|
3550
3522
|
const editorFormatDocumentForced = () => {
|
|
3551
|
-
return i18nString(
|
|
3523
|
+
return i18nString(EditorFormatDocumentForced);
|
|
3552
3524
|
};
|
|
3553
3525
|
const editorSelectNextOccurrence = () => {
|
|
3554
|
-
return i18nString(
|
|
3526
|
+
return i18nString(EditorSelectNextOccurrence);
|
|
3555
3527
|
};
|
|
3556
3528
|
const editorSelectAllOccurrences = () => {
|
|
3557
|
-
return i18nString(
|
|
3529
|
+
return i18nString(EditorSelectAllOccurrences);
|
|
3558
3530
|
};
|
|
3559
3531
|
const editorGoToDefinition = () => {
|
|
3560
|
-
return i18nString(
|
|
3532
|
+
return i18nString(EditorGoToDefinition);
|
|
3561
3533
|
};
|
|
3562
3534
|
const editorGoToTypeDefinition = () => {
|
|
3563
|
-
return i18nString(
|
|
3535
|
+
return i18nString(EditorGoToTypeDefinition);
|
|
3564
3536
|
};
|
|
3565
3537
|
const editorSelectInsideString = () => {
|
|
3566
|
-
return i18nString(
|
|
3538
|
+
return i18nString(EditorSelectInsideString);
|
|
3567
3539
|
};
|
|
3568
3540
|
const editorIndent = () => {
|
|
3569
|
-
return i18nString(
|
|
3541
|
+
return i18nString(EditorIndent);
|
|
3570
3542
|
};
|
|
3571
3543
|
const editorUnindent$1 = () => {
|
|
3572
|
-
return i18nString(
|
|
3544
|
+
return i18nString(EditorUnindent);
|
|
3573
3545
|
};
|
|
3574
3546
|
const editorSortLinesAscending = () => {
|
|
3575
|
-
return i18nString(
|
|
3547
|
+
return i18nString(EditorSortLinesAscending);
|
|
3576
3548
|
};
|
|
3577
3549
|
const editorToggleComment = () => {
|
|
3578
|
-
return i18nString(
|
|
3550
|
+
return i18nString(EditorToggleComment);
|
|
3579
3551
|
};
|
|
3580
3552
|
const editorSelectUp = () => {
|
|
3581
|
-
return i18nString(
|
|
3553
|
+
return i18nString(EditorSelectUp);
|
|
3582
3554
|
};
|
|
3583
3555
|
const editorSelectDown = () => {
|
|
3584
|
-
return i18nString(
|
|
3556
|
+
return i18nString(EditorSelectDown);
|
|
3585
3557
|
};
|
|
3586
3558
|
const editorOpenColorPicker = () => {
|
|
3587
|
-
return i18nString(
|
|
3559
|
+
return i18nString(EditorOpenColorPicker);
|
|
3588
3560
|
};
|
|
3589
3561
|
const editorCloseColorPicker = () => {
|
|
3590
|
-
return i18nString(
|
|
3562
|
+
return i18nString(EditorCloseColorPicker);
|
|
3591
3563
|
};
|
|
3592
3564
|
const editorCopyLineDown = () => {
|
|
3593
|
-
return i18nString(
|
|
3565
|
+
return i18nString(EditorCopyLineDown);
|
|
3594
3566
|
};
|
|
3595
3567
|
const editorCopyLineUp = () => {
|
|
3596
|
-
return i18nString(
|
|
3568
|
+
return i18nString(EditorCopyLineUp);
|
|
3597
3569
|
};
|
|
3598
3570
|
|
|
3599
3571
|
// @ts-ignore
|
|
@@ -3817,9 +3789,6 @@ const setPosition$1 = position => {
|
|
|
3817
3789
|
state$5.position = position;
|
|
3818
3790
|
};
|
|
3819
3791
|
|
|
3820
|
-
const Ctrl = 1;
|
|
3821
|
-
const Alt$1 = 2;
|
|
3822
|
-
|
|
3823
3792
|
// TODO first change cursor position, then run go to definition
|
|
3824
3793
|
// cursor should appear at mousedown position immediately
|
|
3825
3794
|
const handleSingleClickWithAlt = async (editor, position) => {
|
|
@@ -3836,6 +3805,7 @@ const handleSingleClickWithAlt = async (editor, position) => {
|
|
|
3836
3805
|
const newEditor2 = await goToDefinition(newEditor);
|
|
3837
3806
|
return newEditor2;
|
|
3838
3807
|
};
|
|
3808
|
+
|
|
3839
3809
|
const handleSingleClickWithCtrl = async (editor, position) => {
|
|
3840
3810
|
const selections = editor.selections;
|
|
3841
3811
|
for (let i = 0; i < selections.length; i += 4) {
|
|
@@ -3859,6 +3829,10 @@ const handleSingleClickWithCtrl = async (editor, position) => {
|
|
|
3859
3829
|
newSelections[insertIndex + 3] = position.columnIndex;
|
|
3860
3830
|
return scheduleSelections(editor, newSelections);
|
|
3861
3831
|
};
|
|
3832
|
+
|
|
3833
|
+
const Ctrl = 1;
|
|
3834
|
+
const Alt$1 = 2;
|
|
3835
|
+
|
|
3862
3836
|
const handleSingleClickDefault = (editor, position) => {
|
|
3863
3837
|
setPosition$1(position);
|
|
3864
3838
|
return {
|
|
@@ -3867,7 +3841,7 @@ const handleSingleClickDefault = (editor, position) => {
|
|
|
3867
3841
|
focused: true
|
|
3868
3842
|
};
|
|
3869
3843
|
};
|
|
3870
|
-
const
|
|
3844
|
+
const getClickHandler = modifier => {
|
|
3871
3845
|
switch (modifier) {
|
|
3872
3846
|
case Alt$1:
|
|
3873
3847
|
return handleSingleClickWithAlt;
|
|
@@ -3877,13 +3851,14 @@ const getFn = modifier => {
|
|
|
3877
3851
|
return handleSingleClickDefault;
|
|
3878
3852
|
}
|
|
3879
3853
|
};
|
|
3854
|
+
|
|
3880
3855
|
const handleSingleClick = async (editor, modifier, x, y) => {
|
|
3881
3856
|
object(editor);
|
|
3882
3857
|
number(modifier);
|
|
3883
3858
|
number(x);
|
|
3884
3859
|
number(y);
|
|
3885
3860
|
const position = at(editor, x, y);
|
|
3886
|
-
const fn =
|
|
3861
|
+
const fn = getClickHandler(modifier);
|
|
3887
3862
|
const newEditor = await fn(editor, position);
|
|
3888
3863
|
// switch (newEditor.completionState) {
|
|
3889
3864
|
// case EditorCompletionState.None:
|
|
@@ -4201,9 +4176,6 @@ const handleScrollBarHorizontalPointerDown = (state, eventX) => {
|
|
|
4201
4176
|
x,
|
|
4202
4177
|
deltaX,
|
|
4203
4178
|
width,
|
|
4204
|
-
finalDeltaY,
|
|
4205
|
-
height,
|
|
4206
|
-
scrollBarHeight,
|
|
4207
4179
|
longestLineWidth
|
|
4208
4180
|
} = state;
|
|
4209
4181
|
const relativeX = eventX - x;
|
|
@@ -4356,9 +4328,7 @@ const setDelta = (editor, deltaMode, eventDeltaX, eventDeltaY) => {
|
|
|
4356
4328
|
number(eventDeltaY);
|
|
4357
4329
|
// @ts-ignore
|
|
4358
4330
|
const {
|
|
4359
|
-
deltaX
|
|
4360
|
-
deltaY
|
|
4361
|
-
} = editor;
|
|
4331
|
+
deltaX} = editor;
|
|
4362
4332
|
if (eventDeltaX === 0) {
|
|
4363
4333
|
return setDeltaY$1(editor, eventDeltaY);
|
|
4364
4334
|
}
|
|
@@ -4812,9 +4782,6 @@ const create$5 = () => {
|
|
|
4812
4782
|
return completionWidget;
|
|
4813
4783
|
};
|
|
4814
4784
|
|
|
4815
|
-
const combineResults$2 = results => {
|
|
4816
|
-
return results[0] ?? [];
|
|
4817
|
-
};
|
|
4818
4785
|
const executeCompletionProvider = async (editor, offset) => {
|
|
4819
4786
|
return execute({
|
|
4820
4787
|
editor,
|
|
@@ -4822,12 +4789,7 @@ const executeCompletionProvider = async (editor, offset) => {
|
|
|
4822
4789
|
method: CompletionExecute,
|
|
4823
4790
|
args: [offset],
|
|
4824
4791
|
noProviderFoundMessage: 'no completion provider found',
|
|
4825
|
-
noProviderFoundResult: []
|
|
4826
|
-
combineResults: combineResults$2
|
|
4827
|
-
});
|
|
4828
|
-
};
|
|
4829
|
-
const combineResultsResolve = items => {
|
|
4830
|
-
return items[0] ?? undefined;
|
|
4792
|
+
noProviderFoundResult: []});
|
|
4831
4793
|
};
|
|
4832
4794
|
const executeResolveCompletionItem = async (editor, offset, name, completionItem) => {
|
|
4833
4795
|
return execute({
|
|
@@ -4836,9 +4798,7 @@ const executeResolveCompletionItem = async (editor, offset, name, completionItem
|
|
|
4836
4798
|
method: CompletionResolveExecute,
|
|
4837
4799
|
args: [offset, name, completionItem],
|
|
4838
4800
|
noProviderFoundMessage: 'no completion provider found',
|
|
4839
|
-
noProviderFoundResult: []
|
|
4840
|
-
combineResults: combineResultsResolve
|
|
4841
|
-
});
|
|
4801
|
+
noProviderFoundResult: []});
|
|
4842
4802
|
};
|
|
4843
4803
|
|
|
4844
4804
|
const getOffsetAtCursor = editor => {
|
|
@@ -5129,6 +5089,7 @@ const getWordAtOffset = editor => {
|
|
|
5129
5089
|
}
|
|
5130
5090
|
return '';
|
|
5131
5091
|
};
|
|
5092
|
+
|
|
5132
5093
|
const handleEditorType$2 = (editorUid, state, text) => {
|
|
5133
5094
|
const editor = getEditor(editorUid);
|
|
5134
5095
|
const {
|
|
@@ -5337,19 +5298,6 @@ const create$4 = () => {
|
|
|
5337
5298
|
return widget;
|
|
5338
5299
|
};
|
|
5339
5300
|
|
|
5340
|
-
// copied from https://github.com/microsoft/vscode/tree/main/src/vs/base/common/strings.ts by Microsoft (License MIT)
|
|
5341
|
-
|
|
5342
|
-
const RE_ESCAPE = /[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g;
|
|
5343
|
-
const escapeRegExpCharacters = value => {
|
|
5344
|
-
return value.replaceAll(RE_ESCAPE, '\\$&');
|
|
5345
|
-
};
|
|
5346
|
-
|
|
5347
|
-
const regexFlags = 'gi';
|
|
5348
|
-
const getSearchRegex = searchString => {
|
|
5349
|
-
const escaped = escapeRegExpCharacters(searchString);
|
|
5350
|
-
return new RegExp(escaped, regexFlags);
|
|
5351
|
-
};
|
|
5352
|
-
|
|
5353
5301
|
const findRegexMatches = (lines, regex) => {
|
|
5354
5302
|
if (!regex.global) {
|
|
5355
5303
|
throw new Error('regex must be global');
|
|
@@ -5372,6 +5320,19 @@ const findRegexMatches = (lines, regex) => {
|
|
|
5372
5320
|
return new Uint32Array(matches);
|
|
5373
5321
|
};
|
|
5374
5322
|
|
|
5323
|
+
// copied from https://github.com/microsoft/vscode/tree/main/src/vs/base/common/strings.ts by Microsoft (License MIT)
|
|
5324
|
+
|
|
5325
|
+
const RE_ESCAPE = /[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g;
|
|
5326
|
+
const escapeRegExpCharacters = value => {
|
|
5327
|
+
return value.replaceAll(RE_ESCAPE, '\\$&');
|
|
5328
|
+
};
|
|
5329
|
+
|
|
5330
|
+
const regexFlags = 'gi';
|
|
5331
|
+
const getSearchRegex = searchString => {
|
|
5332
|
+
const escaped = escapeRegExpCharacters(searchString);
|
|
5333
|
+
return new RegExp(escaped, regexFlags);
|
|
5334
|
+
};
|
|
5335
|
+
|
|
5375
5336
|
const findMatchesCaseInsensitive = (lines, searchString) => {
|
|
5376
5337
|
if (searchString.length === 0) {
|
|
5377
5338
|
return new Uint32Array([]);
|
|
@@ -5946,7 +5907,7 @@ const save = async editor => {
|
|
|
5946
5907
|
return newEditor;
|
|
5947
5908
|
} catch (error) {
|
|
5948
5909
|
// @ts-ignore
|
|
5949
|
-
const betterError = new VError
|
|
5910
|
+
const betterError = new VError(error, `Failed to save file "${editor.uri}"`);
|
|
5950
5911
|
await handleError(betterError);
|
|
5951
5912
|
return editor;
|
|
5952
5913
|
}
|
|
@@ -6235,6 +6196,23 @@ const selectInsideString = editor => {
|
|
|
6235
6196
|
return scheduleSelections(editor, newSelections);
|
|
6236
6197
|
};
|
|
6237
6198
|
|
|
6199
|
+
// import * as ExtensionHostSelection from '../ExtensionHost/ExtensionHostSelection.ts'
|
|
6200
|
+
|
|
6201
|
+
const getNewSelections = async (editor, selections) => {
|
|
6202
|
+
const newSelections = await invoke$3('ExtensionHostSelection.executeGrowSelection', editor, selections);
|
|
6203
|
+
if (newSelections.length === 0) {
|
|
6204
|
+
return selections;
|
|
6205
|
+
}
|
|
6206
|
+
return new Uint32Array(newSelections);
|
|
6207
|
+
};
|
|
6208
|
+
const selectionGrow = async editor => {
|
|
6209
|
+
const {
|
|
6210
|
+
selections
|
|
6211
|
+
} = editor;
|
|
6212
|
+
const newSelections = await getNewSelections(editor, selections);
|
|
6213
|
+
return scheduleSelections(editor, newSelections);
|
|
6214
|
+
};
|
|
6215
|
+
|
|
6238
6216
|
// TODO handle virtual space
|
|
6239
6217
|
|
|
6240
6218
|
// TODO editors behave differently when selecting next occurrence, for example:
|
|
@@ -6446,23 +6424,6 @@ const selectWordRight = editor => {
|
|
|
6446
6424
|
return editorSelectHorizontalRight(editor, wordRight);
|
|
6447
6425
|
};
|
|
6448
6426
|
|
|
6449
|
-
// import * as ExtensionHostSelection from '../ExtensionHost/ExtensionHostSelection.ts'
|
|
6450
|
-
|
|
6451
|
-
const getNewSelections = async (editor, selections) => {
|
|
6452
|
-
const newSelections = await invoke$3('ExtensionHostSelection.executeGrowSelection', editor, selections);
|
|
6453
|
-
if (newSelections.length === 0) {
|
|
6454
|
-
return selections;
|
|
6455
|
-
}
|
|
6456
|
-
return new Uint32Array(newSelections);
|
|
6457
|
-
};
|
|
6458
|
-
const selectionGrow = async editor => {
|
|
6459
|
-
const {
|
|
6460
|
-
selections
|
|
6461
|
-
} = editor;
|
|
6462
|
-
const newSelections = await getNewSelections(editor, selections);
|
|
6463
|
-
return scheduleSelections(editor, newSelections);
|
|
6464
|
-
};
|
|
6465
|
-
|
|
6466
6427
|
const setDecorations = (editor, decorations, diagnostics) => {
|
|
6467
6428
|
if (editor.decorations.length === 0 && decorations.length === 0) {
|
|
6468
6429
|
return editor;
|
|
@@ -6474,6 +6435,19 @@ const setDecorations = (editor, decorations, diagnostics) => {
|
|
|
6474
6435
|
};
|
|
6475
6436
|
};
|
|
6476
6437
|
|
|
6438
|
+
let enabled$1 = false;
|
|
6439
|
+
const setEnabled$1 = value => {
|
|
6440
|
+
enabled$1 = value;
|
|
6441
|
+
};
|
|
6442
|
+
const getEnabled$1 = () => {
|
|
6443
|
+
return enabled$1;
|
|
6444
|
+
};
|
|
6445
|
+
|
|
6446
|
+
const {
|
|
6447
|
+
listen: listen$3,
|
|
6448
|
+
invoke: invoke$1
|
|
6449
|
+
} = createRpc(SyntaxHighlightingWorker);
|
|
6450
|
+
|
|
6477
6451
|
/**
|
|
6478
6452
|
* @enum number
|
|
6479
6453
|
*/
|
|
@@ -6513,14 +6487,7 @@ const TokenizePlainText = {
|
|
|
6513
6487
|
|
|
6514
6488
|
const state$1 = {
|
|
6515
6489
|
tokenizers: Object.create(null),
|
|
6516
|
-
|
|
6517
|
-
listeners: [],
|
|
6518
|
-
pending: Object.create(null),
|
|
6519
|
-
/**
|
|
6520
|
-
* @type {number[]}
|
|
6521
|
-
*/
|
|
6522
|
-
connectedEditors: []
|
|
6523
|
-
};
|
|
6490
|
+
pending: Object.create(null)};
|
|
6524
6491
|
const has = languageId => {
|
|
6525
6492
|
return languageId in state$1.tokenizers;
|
|
6526
6493
|
};
|
|
@@ -6534,19 +6501,6 @@ const isPending = languageId => {
|
|
|
6534
6501
|
return languageId in state$1.pending;
|
|
6535
6502
|
};
|
|
6536
6503
|
|
|
6537
|
-
let enabled$1 = false;
|
|
6538
|
-
const setEnabled$1 = value => {
|
|
6539
|
-
enabled$1 = value;
|
|
6540
|
-
};
|
|
6541
|
-
const getEnabled$1 = () => {
|
|
6542
|
-
return enabled$1;
|
|
6543
|
-
};
|
|
6544
|
-
|
|
6545
|
-
const {
|
|
6546
|
-
listen: listen$5,
|
|
6547
|
-
invoke: invoke$1
|
|
6548
|
-
} = createRpc(SyntaxHighlightingWorker);
|
|
6549
|
-
|
|
6550
6504
|
const tokenMaps = Object.create(null);
|
|
6551
6505
|
const set$1 = (languageId, tokenMap) => {
|
|
6552
6506
|
tokenMaps[languageId] = tokenMap;
|
|
@@ -6666,12 +6620,6 @@ const setSelections = (editor, selections) => {
|
|
|
6666
6620
|
};
|
|
6667
6621
|
};
|
|
6668
6622
|
|
|
6669
|
-
const EditorHover = 'EditorHover';
|
|
6670
|
-
const showHover = async state => {
|
|
6671
|
-
await invoke$3('Viewlet.openWidget', EditorHover);
|
|
6672
|
-
return state;
|
|
6673
|
-
};
|
|
6674
|
-
|
|
6675
6623
|
const create$2 = () => {
|
|
6676
6624
|
const uid = create$8();
|
|
6677
6625
|
const widget = {
|
|
@@ -6725,7 +6673,7 @@ const getHover = async (editor, offset) => {
|
|
|
6725
6673
|
};
|
|
6726
6674
|
|
|
6727
6675
|
let _ipc;
|
|
6728
|
-
const listen$
|
|
6676
|
+
const listen$2 = async () => {
|
|
6729
6677
|
const ipc = await create$a({
|
|
6730
6678
|
method: RendererProcess
|
|
6731
6679
|
});
|
|
@@ -6946,6 +6894,12 @@ const showHover2 = async editor => {
|
|
|
6946
6894
|
return addWidgetToEditor(Hover, FocusEditorHover, editor, create$2, newStateGenerator);
|
|
6947
6895
|
};
|
|
6948
6896
|
|
|
6897
|
+
const EditorHover = 'EditorHover';
|
|
6898
|
+
const showHover = async state => {
|
|
6899
|
+
await invoke$3('Viewlet.openWidget', EditorHover);
|
|
6900
|
+
return state;
|
|
6901
|
+
};
|
|
6902
|
+
|
|
6949
6903
|
// TODO ask extension host worker instead
|
|
6950
6904
|
const getEditorSourceActions = async () => {
|
|
6951
6905
|
const sourceActions = await invoke$3('GetEditorSourceActions.getEditorSourceActions');
|
|
@@ -6999,7 +6953,7 @@ const loadSourceActions = async (editor, state) => {
|
|
|
6999
6953
|
const create$1 = () => {
|
|
7000
6954
|
const completionUid = create$8();
|
|
7001
6955
|
const widget = {
|
|
7002
|
-
id: SourceAction,
|
|
6956
|
+
id: SourceAction$1,
|
|
7003
6957
|
oldState: {
|
|
7004
6958
|
uid: completionUid,
|
|
7005
6959
|
x: 0,
|
|
@@ -7028,7 +6982,7 @@ const showSourceActions = async editor => {
|
|
|
7028
6982
|
const newStateGenerator = async state => {
|
|
7029
6983
|
return loadSourceActions(editor, state);
|
|
7030
6984
|
};
|
|
7031
|
-
return addWidgetToEditor(SourceAction, SourceActions, editor, create$1, newStateGenerator);
|
|
6985
|
+
return addWidgetToEditor(SourceAction$1, SourceActions, editor, create$1, newStateGenerator);
|
|
7032
6986
|
};
|
|
7033
6987
|
|
|
7034
6988
|
const compareString = (a, b) => {
|
|
@@ -7090,9 +7044,6 @@ const sortLinesAscending = editor => {
|
|
|
7090
7044
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
7091
7045
|
};
|
|
7092
7046
|
|
|
7093
|
-
const combineResults$1 = results => {
|
|
7094
|
-
return results[0];
|
|
7095
|
-
};
|
|
7096
7047
|
const executeTabCompletionProvider = async (editor, offset) => {
|
|
7097
7048
|
return execute({
|
|
7098
7049
|
editor,
|
|
@@ -7100,7 +7051,6 @@ const executeTabCompletionProvider = async (editor, offset) => {
|
|
|
7100
7051
|
method: TabCompletionExecuteTabCompletionProvider,
|
|
7101
7052
|
args: [offset],
|
|
7102
7053
|
noProviderFoundMessage: 'No tab completion provider found',
|
|
7103
|
-
combineResults: combineResults$1,
|
|
7104
7054
|
noProviderFoundResult: undefined
|
|
7105
7055
|
});
|
|
7106
7056
|
};
|
|
@@ -7281,7 +7231,7 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
7281
7231
|
},
|
|
7282
7232
|
inserted: [],
|
|
7283
7233
|
deleted: [blockCommentStart],
|
|
7284
|
-
origin: ToggleBlockComment
|
|
7234
|
+
origin: ToggleBlockComment$1
|
|
7285
7235
|
};
|
|
7286
7236
|
const change2 = {
|
|
7287
7237
|
start: {
|
|
@@ -7294,7 +7244,7 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
7294
7244
|
},
|
|
7295
7245
|
inserted: [],
|
|
7296
7246
|
deleted: [blockCommentEnd],
|
|
7297
|
-
origin: ToggleBlockComment
|
|
7247
|
+
origin: ToggleBlockComment$1
|
|
7298
7248
|
};
|
|
7299
7249
|
changes.push(change1, change2);
|
|
7300
7250
|
} else {
|
|
@@ -7309,7 +7259,7 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
7309
7259
|
},
|
|
7310
7260
|
inserted: [],
|
|
7311
7261
|
deleted: [blockCommentStart],
|
|
7312
|
-
origin: ToggleBlockComment
|
|
7262
|
+
origin: ToggleBlockComment$1
|
|
7313
7263
|
};
|
|
7314
7264
|
const change2 = {
|
|
7315
7265
|
start: {
|
|
@@ -7322,7 +7272,7 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
7322
7272
|
},
|
|
7323
7273
|
inserted: [],
|
|
7324
7274
|
deleted: [blockCommentEnd],
|
|
7325
|
-
origin: ToggleBlockComment
|
|
7275
|
+
origin: ToggleBlockComment$1
|
|
7326
7276
|
};
|
|
7327
7277
|
changes.push(change1, change2);
|
|
7328
7278
|
|
|
@@ -7361,7 +7311,7 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
7361
7311
|
},
|
|
7362
7312
|
inserted: [blockCommentStart],
|
|
7363
7313
|
deleted: [],
|
|
7364
|
-
origin: ToggleBlockComment
|
|
7314
|
+
origin: ToggleBlockComment$1
|
|
7365
7315
|
};
|
|
7366
7316
|
const change2 = {
|
|
7367
7317
|
start: {
|
|
@@ -7374,7 +7324,7 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
7374
7324
|
},
|
|
7375
7325
|
inserted: [blockCommentEnd],
|
|
7376
7326
|
deleted: [],
|
|
7377
|
-
origin: ToggleBlockComment
|
|
7327
|
+
origin: ToggleBlockComment$1
|
|
7378
7328
|
};
|
|
7379
7329
|
changes.push(change1, change2);
|
|
7380
7330
|
// TextDocument.setLine(
|
|
@@ -7890,14 +7840,14 @@ const setDeltaY = (state, value) => {
|
|
|
7890
7840
|
};
|
|
7891
7841
|
};
|
|
7892
7842
|
|
|
7893
|
-
const handleWheel = (state, deltaMode, deltaY) => {
|
|
7843
|
+
const handleWheel$1 = (state, deltaMode, deltaY) => {
|
|
7894
7844
|
number(deltaMode);
|
|
7895
7845
|
number(deltaY);
|
|
7896
7846
|
return setDeltaY(state, state.deltaY + deltaY);
|
|
7897
7847
|
};
|
|
7898
7848
|
|
|
7899
|
-
const
|
|
7900
|
-
const newState = handleWheel(state, deltaMode, deltaY);
|
|
7849
|
+
const handleWheel = (state, deltaMode, deltaY) => {
|
|
7850
|
+
const newState = handleWheel$1(state, deltaMode, deltaY);
|
|
7901
7851
|
return newState;
|
|
7902
7852
|
};
|
|
7903
7853
|
|
|
@@ -7962,9 +7912,7 @@ const getEdits = async (editor, completionItem) => {
|
|
|
7962
7912
|
const child = getCompletionState(editor);
|
|
7963
7913
|
// @ts-ignore
|
|
7964
7914
|
const {
|
|
7965
|
-
leadingWord
|
|
7966
|
-
uid
|
|
7967
|
-
} = child;
|
|
7915
|
+
leadingWord} = child;
|
|
7968
7916
|
const word = completionItem.label;
|
|
7969
7917
|
const resolvedItem = await resolveCompletion(editor, word, completionItem);
|
|
7970
7918
|
const inserted = resolvedItem ? resolvedItem.snippet : word;
|
|
@@ -8070,9 +8018,7 @@ const handleSashPointerDown = (state, eventX, eventY) => {
|
|
|
8070
8018
|
const handleSashPointerMove = (state, eventX, eventY) => {
|
|
8071
8019
|
// @ts-ignore
|
|
8072
8020
|
const {
|
|
8073
|
-
x
|
|
8074
|
-
y
|
|
8075
|
-
} = state;
|
|
8021
|
+
x} = state;
|
|
8076
8022
|
const minWidth = 100;
|
|
8077
8023
|
const newWidth = Math.max(eventX - x, minWidth);
|
|
8078
8024
|
return {
|
|
@@ -8139,6 +8085,30 @@ const SourceActionItem = 'SourceActionItem';
|
|
|
8139
8085
|
const SourceActionItemFocused = 'SourceActionItemFocused';
|
|
8140
8086
|
const Viewlet = 'Viewlet';
|
|
8141
8087
|
|
|
8088
|
+
const HandleBeforeInput = 'handleBeforeInput';
|
|
8089
|
+
const HandleBlur = 'handleBlur';
|
|
8090
|
+
const HandleClick = 'handleClick';
|
|
8091
|
+
const HandleClickClose = 'handleClickClose';
|
|
8092
|
+
const HandleClickNextMatch = 'handleClickNextMatch';
|
|
8093
|
+
const HandleClickPreviousMatch = 'handleClickPreviousMatch';
|
|
8094
|
+
const HandleClickReplace = 'handleClickReplace';
|
|
8095
|
+
const HandleClickReplaceAll = 'handleClickReplaceAll';
|
|
8096
|
+
const HandleClose = 'handleClose';
|
|
8097
|
+
const HandleCompositionEnd = 'handleCompositionEnd';
|
|
8098
|
+
const HandleCompositionStart = 'handleCompositionStart';
|
|
8099
|
+
const HandleCompositionUpdate = 'handleCompositionUpdate';
|
|
8100
|
+
const HandleContextMenu = 'handleContextMenu';
|
|
8101
|
+
const HandleCut = 'handleCut';
|
|
8102
|
+
const HandleFocus = 'handleFocus';
|
|
8103
|
+
const HandleFocusIn = 'handleFocusIn';
|
|
8104
|
+
const HandleInput = 'handleInput';
|
|
8105
|
+
const HandleMouseMove = 'handleMouseMove';
|
|
8106
|
+
const HandlePointerDown = 'handlePointerDown';
|
|
8107
|
+
const HandleReplaceFocus = 'handleReplaceFocus';
|
|
8108
|
+
const HandleReplaceInput = 'handleReplaceInput';
|
|
8109
|
+
const HandleSashPointerDown = 'handleSashPointerDown';
|
|
8110
|
+
const HandleWheel = 'handleWheel';
|
|
8111
|
+
|
|
8142
8112
|
const Button = 1;
|
|
8143
8113
|
const Div = 4;
|
|
8144
8114
|
const Input = 6;
|
|
@@ -8177,21 +8147,6 @@ const getLineInfosVirtualDom = lineInfos => {
|
|
|
8177
8147
|
return dom;
|
|
8178
8148
|
};
|
|
8179
8149
|
|
|
8180
|
-
const HandlePointerDown = 'handlePointerDown';
|
|
8181
|
-
const HandleSashPointerDown = 'handleSashPointerDown';
|
|
8182
|
-
const HandleClose = 'handleClose';
|
|
8183
|
-
const HandleFocusIn = 'handleFocusIn';
|
|
8184
|
-
const HandleClick = 'handleClick';
|
|
8185
|
-
const HandleInput = 'handleInput';
|
|
8186
|
-
const HandleFocus = 'handleFocus';
|
|
8187
|
-
const HandleClickPreviousMatch = 'handleClickPreviousMatch';
|
|
8188
|
-
const HandleClickNextMatch = 'handleClickNextMatch';
|
|
8189
|
-
const HandleClickClose = 'handleClickClose';
|
|
8190
|
-
const HandleClickReplace = 'handleClickReplace';
|
|
8191
|
-
const HandleClickReplaceAll = 'handleClickReplaceAll';
|
|
8192
|
-
const HandleReplaceInput = 'handleReplaceInput';
|
|
8193
|
-
const HandleReplaceFocus = 'handleReplaceFocus';
|
|
8194
|
-
|
|
8195
8150
|
const hoverProblemMessage = {
|
|
8196
8151
|
type: Span,
|
|
8197
8152
|
className: HoverProblemMessage,
|
|
@@ -8290,9 +8245,6 @@ const renderHover = (oldState, newState) => {
|
|
|
8290
8245
|
return commands;
|
|
8291
8246
|
};
|
|
8292
8247
|
|
|
8293
|
-
const combineResults = results => {
|
|
8294
|
-
return results[0] ?? [];
|
|
8295
|
-
};
|
|
8296
8248
|
const executeRenameProvider = async (editor, offset, newName) => {
|
|
8297
8249
|
return execute({
|
|
8298
8250
|
editor,
|
|
@@ -8300,9 +8252,7 @@ const executeRenameProvider = async (editor, offset, newName) => {
|
|
|
8300
8252
|
method: RenameExecuteRename,
|
|
8301
8253
|
args: [offset, newName],
|
|
8302
8254
|
noProviderFoundMessage: 'no rename provider found',
|
|
8303
|
-
noProviderFoundResult: []
|
|
8304
|
-
combineResults
|
|
8305
|
-
});
|
|
8255
|
+
noProviderFoundResult: []});
|
|
8306
8256
|
};
|
|
8307
8257
|
|
|
8308
8258
|
const getRenameState = editor => {
|
|
@@ -8475,7 +8425,7 @@ const loadFont = async (fontName, fontUrl) => {
|
|
|
8475
8425
|
// @ts-ignore
|
|
8476
8426
|
fonts.add(fontFace);
|
|
8477
8427
|
} catch (error) {
|
|
8478
|
-
throw new VError
|
|
8428
|
+
throw new VError(error, `Failed to load font ${fontName}`);
|
|
8479
8429
|
}
|
|
8480
8430
|
};
|
|
8481
8431
|
|
|
@@ -8981,7 +8931,7 @@ const getText = editorUid => {
|
|
|
8981
8931
|
const {
|
|
8982
8932
|
lines
|
|
8983
8933
|
} = editor;
|
|
8984
|
-
return lines.join(NewLine$
|
|
8934
|
+
return lines.join(NewLine$3);
|
|
8985
8935
|
};
|
|
8986
8936
|
|
|
8987
8937
|
const InsertText = 'insertText';
|
|
@@ -9017,15 +8967,15 @@ const getEnabled = () => {
|
|
|
9017
8967
|
};
|
|
9018
8968
|
|
|
9019
8969
|
const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
|
|
9020
|
-
await listen$
|
|
8970
|
+
await listen$2();
|
|
9021
8971
|
if (syntaxHighlightingEnabled) {
|
|
9022
8972
|
setEnabled$1(true);
|
|
9023
|
-
await listen$
|
|
8973
|
+
await listen$3();
|
|
9024
8974
|
}
|
|
9025
8975
|
if (syncIncremental) {
|
|
9026
8976
|
setEnabled(true);
|
|
9027
8977
|
}
|
|
9028
|
-
await listen$
|
|
8978
|
+
await listen$4();
|
|
9029
8979
|
};
|
|
9030
8980
|
|
|
9031
8981
|
// TODO move cursor
|
|
@@ -9541,10 +9491,6 @@ const getVisible = async (editor, syncIncremental) => {
|
|
|
9541
9491
|
lines,
|
|
9542
9492
|
width,
|
|
9543
9493
|
deltaX,
|
|
9544
|
-
fontWeight,
|
|
9545
|
-
fontSize,
|
|
9546
|
-
fontFamily,
|
|
9547
|
-
letterSpacing,
|
|
9548
9494
|
charWidth
|
|
9549
9495
|
} = editor;
|
|
9550
9496
|
const maxLineY = Math.min(minLineY + numberOfVisibleLines, lines.length);
|
|
@@ -9900,6 +9846,43 @@ const renderEditor = async id => {
|
|
|
9900
9846
|
return commands;
|
|
9901
9847
|
};
|
|
9902
9848
|
|
|
9849
|
+
const renderEventListeners = () => {
|
|
9850
|
+
return [{
|
|
9851
|
+
name: HandleFocus,
|
|
9852
|
+
params: ['handleFocus']
|
|
9853
|
+
}, {
|
|
9854
|
+
name: HandleMouseMove,
|
|
9855
|
+
params: ['handleInput', 'event.clientX', 'event.clientY', 'event.altKey']
|
|
9856
|
+
}, {
|
|
9857
|
+
name: HandleBlur,
|
|
9858
|
+
params: ['handleBlur']
|
|
9859
|
+
}, {
|
|
9860
|
+
name: HandleBeforeInput,
|
|
9861
|
+
params: ['handleBeforeInput', 'event.inputType', 'event.data']
|
|
9862
|
+
}, {
|
|
9863
|
+
name: HandleCompositionStart,
|
|
9864
|
+
params: ['compositionStart', 'event.data']
|
|
9865
|
+
}, {
|
|
9866
|
+
name: HandleCompositionUpdate,
|
|
9867
|
+
params: ['compositionUpdate', 'event.data']
|
|
9868
|
+
}, {
|
|
9869
|
+
name: HandleCompositionEnd,
|
|
9870
|
+
params: ['compositionUpdate', 'event.data']
|
|
9871
|
+
}, {
|
|
9872
|
+
name: HandleCut,
|
|
9873
|
+
params: ['cut'],
|
|
9874
|
+
preventDefault: true
|
|
9875
|
+
}, {
|
|
9876
|
+
name: HandleWheel,
|
|
9877
|
+
params: ['setDelta', 'event.deltaMode', 'event.deltaY'],
|
|
9878
|
+
preventDefault: true
|
|
9879
|
+
}, {
|
|
9880
|
+
name: HandleContextMenu,
|
|
9881
|
+
params: ['handleContextMenu', 'event.button', 'event.clientX', 'event.clientY'],
|
|
9882
|
+
preventDefault: true
|
|
9883
|
+
}];
|
|
9884
|
+
};
|
|
9885
|
+
|
|
9903
9886
|
const editorDiagnosticEffect = {
|
|
9904
9887
|
isActive(oldEditor, newEditor) {
|
|
9905
9888
|
// TODO avoid slow comparison
|
|
@@ -10099,6 +10082,7 @@ const commandMap = {
|
|
|
10099
10082
|
'Editor.paste': paste,
|
|
10100
10083
|
'Editor.pasteText': pasteText,
|
|
10101
10084
|
'Editor.render': renderEditor,
|
|
10085
|
+
'Editor.renderEventListeners': renderEventListeners,
|
|
10102
10086
|
'Editor.replaceRange': replaceRange,
|
|
10103
10087
|
'Editor.rerender': rerender,
|
|
10104
10088
|
'Editor.save': save,
|
|
@@ -10147,7 +10131,7 @@ const commandMap = {
|
|
|
10147
10131
|
'EditorCompletion.handleEditorClick': handleEditorClick,
|
|
10148
10132
|
'EditorCompletion.handleEditorDeleteLeft': handleEditorDeleteLeft$2,
|
|
10149
10133
|
'EditorCompletion.handleEditorType': handleEditorType$2,
|
|
10150
|
-
'EditorCompletion.handleWheel':
|
|
10134
|
+
'EditorCompletion.handleWheel': handleWheel,
|
|
10151
10135
|
'EditorCompletion.loadContent': loadContent$2,
|
|
10152
10136
|
'EditorCompletion.openDetails': openDetails,
|
|
10153
10137
|
'EditorCompletion.selectCurrent': selectCurrent,
|
|
@@ -10191,67 +10175,6 @@ const commandMap = {
|
|
|
10191
10175
|
};
|
|
10192
10176
|
wrapCommands(commandMap);
|
|
10193
10177
|
|
|
10194
|
-
const MessagePort$1 = 1;
|
|
10195
|
-
const ModuleWorker = 2;
|
|
10196
|
-
const ReferencePort = 3;
|
|
10197
|
-
const ModuleWorkerAndMessagePort = 8;
|
|
10198
|
-
const Auto = () => {
|
|
10199
|
-
// @ts-ignore
|
|
10200
|
-
if (globalThis.acceptPort) {
|
|
10201
|
-
return MessagePort$1;
|
|
10202
|
-
}
|
|
10203
|
-
// @ts-ignore
|
|
10204
|
-
if (globalThis.acceptReferencePort) {
|
|
10205
|
-
return ReferencePort;
|
|
10206
|
-
}
|
|
10207
|
-
return ModuleWorkerAndMessagePort;
|
|
10208
|
-
};
|
|
10209
|
-
|
|
10210
|
-
const getData$1 = event => {
|
|
10211
|
-
return event.data;
|
|
10212
|
-
};
|
|
10213
|
-
const attachEvents = that => {
|
|
10214
|
-
const handleMessage = (...args) => {
|
|
10215
|
-
const data = that.getData(...args);
|
|
10216
|
-
that.dispatchEvent(new MessageEvent('message', {
|
|
10217
|
-
data
|
|
10218
|
-
}));
|
|
10219
|
-
};
|
|
10220
|
-
that.onMessage(handleMessage);
|
|
10221
|
-
const handleClose = event => {
|
|
10222
|
-
that.dispatchEvent(new Event('close'));
|
|
10223
|
-
};
|
|
10224
|
-
that.onClose(handleClose);
|
|
10225
|
-
};
|
|
10226
|
-
class Ipc extends EventTarget {
|
|
10227
|
-
constructor(rawIpc) {
|
|
10228
|
-
super();
|
|
10229
|
-
this._rawIpc = rawIpc;
|
|
10230
|
-
attachEvents(this);
|
|
10231
|
-
}
|
|
10232
|
-
}
|
|
10233
|
-
const readyMessage = 'ready';
|
|
10234
|
-
const walkValue = (value, transferrables, isTransferrable) => {
|
|
10235
|
-
if (!value) {
|
|
10236
|
-
return;
|
|
10237
|
-
}
|
|
10238
|
-
if (isTransferrable(value)) {
|
|
10239
|
-
transferrables.push(value);
|
|
10240
|
-
return;
|
|
10241
|
-
}
|
|
10242
|
-
if (Array.isArray(value)) {
|
|
10243
|
-
for (const item of value) {
|
|
10244
|
-
walkValue(item, transferrables, isTransferrable);
|
|
10245
|
-
}
|
|
10246
|
-
return;
|
|
10247
|
-
}
|
|
10248
|
-
if (typeof value === 'object') {
|
|
10249
|
-
for (const property of Object.values(value)) {
|
|
10250
|
-
walkValue(property, transferrables, isTransferrable);
|
|
10251
|
-
}
|
|
10252
|
-
return;
|
|
10253
|
-
}
|
|
10254
|
-
};
|
|
10255
10178
|
const isMessagePort = value => {
|
|
10256
10179
|
return value && value instanceof MessagePort;
|
|
10257
10180
|
};
|
|
@@ -10276,126 +10199,88 @@ const isTransferrable = value => {
|
|
|
10276
10199
|
}
|
|
10277
10200
|
return false;
|
|
10278
10201
|
};
|
|
10279
|
-
const
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
return transferrables;
|
|
10283
|
-
};
|
|
10284
|
-
const listen$3 = ({
|
|
10285
|
-
port
|
|
10286
|
-
}) => {
|
|
10287
|
-
return port;
|
|
10288
|
-
};
|
|
10289
|
-
const signal$3 = port => {
|
|
10290
|
-
port.postMessage(readyMessage);
|
|
10291
|
-
};
|
|
10292
|
-
class IpcChildWithMessagePort extends Ipc {
|
|
10293
|
-
constructor(port) {
|
|
10294
|
-
super(port);
|
|
10295
|
-
}
|
|
10296
|
-
getData(event) {
|
|
10297
|
-
return getData$1(event);
|
|
10298
|
-
}
|
|
10299
|
-
send(message) {
|
|
10300
|
-
this._rawIpc.postMessage(message);
|
|
10301
|
-
}
|
|
10302
|
-
sendAndTransfer(message) {
|
|
10303
|
-
const transfer = getTransferrables(message);
|
|
10304
|
-
this._rawIpc.postMessage(message, transfer);
|
|
10202
|
+
const walkValue = (value, transferrables, isTransferrable) => {
|
|
10203
|
+
if (!value) {
|
|
10204
|
+
return;
|
|
10305
10205
|
}
|
|
10306
|
-
|
|
10307
|
-
|
|
10206
|
+
if (isTransferrable(value)) {
|
|
10207
|
+
transferrables.push(value);
|
|
10208
|
+
return;
|
|
10308
10209
|
}
|
|
10309
|
-
|
|
10310
|
-
|
|
10210
|
+
if (Array.isArray(value)) {
|
|
10211
|
+
for (const item of value) {
|
|
10212
|
+
walkValue(item, transferrables, isTransferrable);
|
|
10213
|
+
}
|
|
10214
|
+
return;
|
|
10311
10215
|
}
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10216
|
+
if (typeof value === 'object') {
|
|
10217
|
+
for (const property of Object.values(value)) {
|
|
10218
|
+
walkValue(property, transferrables, isTransferrable);
|
|
10219
|
+
}
|
|
10220
|
+
return;
|
|
10315
10221
|
}
|
|
10316
|
-
}
|
|
10317
|
-
const wrap$6 = port => {
|
|
10318
|
-
return new IpcChildWithMessagePort(port);
|
|
10319
10222
|
};
|
|
10320
|
-
const
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
wrap: wrap$6
|
|
10325
|
-
};
|
|
10326
|
-
const listen$2 = () => {
|
|
10327
|
-
// @ts-ignore
|
|
10328
|
-
if (typeof WorkerGlobalScope === 'undefined') {
|
|
10329
|
-
throw new TypeError('module is not in web worker scope');
|
|
10330
|
-
}
|
|
10331
|
-
return globalThis;
|
|
10223
|
+
const getTransferrables = value => {
|
|
10224
|
+
const transferrables = [];
|
|
10225
|
+
walkValue(value, transferrables, isTransferrable);
|
|
10226
|
+
return transferrables;
|
|
10332
10227
|
};
|
|
10333
|
-
const
|
|
10334
|
-
|
|
10228
|
+
const attachEvents = that => {
|
|
10229
|
+
const handleMessage = (...args) => {
|
|
10230
|
+
const data = that.getData(...args);
|
|
10231
|
+
that.dispatchEvent(new MessageEvent('message', {
|
|
10232
|
+
data
|
|
10233
|
+
}));
|
|
10234
|
+
};
|
|
10235
|
+
that.onMessage(handleMessage);
|
|
10236
|
+
const handleClose = event => {
|
|
10237
|
+
that.dispatchEvent(new Event('close'));
|
|
10238
|
+
};
|
|
10239
|
+
that.onClose(handleClose);
|
|
10335
10240
|
};
|
|
10336
|
-
class
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
// @ts-ignore
|
|
10342
|
-
this._rawIpc.postMessage(message);
|
|
10343
|
-
}
|
|
10344
|
-
sendAndTransfer(message) {
|
|
10345
|
-
const transfer = getTransferrables(message);
|
|
10346
|
-
// @ts-ignore
|
|
10347
|
-
this._rawIpc.postMessage(message, transfer);
|
|
10348
|
-
}
|
|
10349
|
-
dispose() {
|
|
10350
|
-
// ignore
|
|
10351
|
-
}
|
|
10352
|
-
onClose(callback) {
|
|
10353
|
-
// ignore
|
|
10354
|
-
}
|
|
10355
|
-
onMessage(callback) {
|
|
10356
|
-
this._rawIpc.addEventListener('message', callback);
|
|
10241
|
+
class Ipc extends EventTarget {
|
|
10242
|
+
constructor(rawIpc) {
|
|
10243
|
+
super();
|
|
10244
|
+
this._rawIpc = rawIpc;
|
|
10245
|
+
attachEvents(this);
|
|
10357
10246
|
}
|
|
10358
10247
|
}
|
|
10359
|
-
const wrap$5 = global => {
|
|
10360
|
-
return new IpcChildWithModuleWorker(global);
|
|
10361
|
-
};
|
|
10362
|
-
const IpcChildWithModuleWorker$1 = {
|
|
10363
|
-
__proto__: null,
|
|
10364
|
-
listen: listen$2,
|
|
10365
|
-
signal: signal$2,
|
|
10366
|
-
wrap: wrap$5
|
|
10367
|
-
};
|
|
10368
10248
|
const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
|
|
10369
10249
|
const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
|
|
10370
10250
|
const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
|
|
10371
|
-
const NewLine
|
|
10251
|
+
const NewLine = '\n';
|
|
10372
10252
|
const joinLines = lines => {
|
|
10373
|
-
return lines.join(NewLine
|
|
10374
|
-
};
|
|
10375
|
-
const splitLines = lines => {
|
|
10376
|
-
return lines.split(NewLine$1);
|
|
10253
|
+
return lines.join(NewLine);
|
|
10377
10254
|
};
|
|
10378
|
-
const
|
|
10379
|
-
|
|
10255
|
+
const RE_AT = /^\s+at/;
|
|
10256
|
+
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
10257
|
+
const isNormalStackLine = line => {
|
|
10258
|
+
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
10380
10259
|
};
|
|
10381
|
-
const
|
|
10382
|
-
const
|
|
10383
|
-
|
|
10384
|
-
|
|
10260
|
+
const getDetails = lines => {
|
|
10261
|
+
const index = lines.findIndex(isNormalStackLine);
|
|
10262
|
+
if (index === -1) {
|
|
10263
|
+
return {
|
|
10264
|
+
actualMessage: joinLines(lines),
|
|
10265
|
+
rest: []
|
|
10266
|
+
};
|
|
10267
|
+
}
|
|
10268
|
+
let lastIndex = index - 1;
|
|
10269
|
+
while (++lastIndex < lines.length) {
|
|
10270
|
+
if (!isNormalStackLine(lines[lastIndex])) {
|
|
10271
|
+
break;
|
|
10272
|
+
}
|
|
10273
|
+
}
|
|
10385
10274
|
return {
|
|
10386
|
-
|
|
10387
|
-
|
|
10275
|
+
actualMessage: lines[index - 1],
|
|
10276
|
+
rest: lines.slice(index, lastIndex)
|
|
10388
10277
|
};
|
|
10389
10278
|
};
|
|
10390
|
-
const
|
|
10391
|
-
|
|
10279
|
+
const splitLines = lines => {
|
|
10280
|
+
return lines.split(NewLine);
|
|
10281
|
+
};
|
|
10392
10282
|
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
|
|
10393
10283
|
const RE_MESSAGE_CODE_BLOCK_END = /^\s* at/;
|
|
10394
|
-
const RE_AT = /^\s+at/;
|
|
10395
|
-
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
10396
|
-
const isUnhelpfulNativeModuleError = stderr => {
|
|
10397
|
-
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
10398
|
-
};
|
|
10399
10284
|
const isMessageCodeBlockStartIndex = line => {
|
|
10400
10285
|
return RE_MESSAGE_CODE_BLOCK_START.test(line);
|
|
10401
10286
|
};
|
|
@@ -10410,51 +10295,46 @@ const getMessageCodeBlock = stderr => {
|
|
|
10410
10295
|
const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
|
|
10411
10296
|
return relevantMessage;
|
|
10412
10297
|
};
|
|
10413
|
-
const
|
|
10414
|
-
|
|
10298
|
+
const isModuleNotFoundMessage = line => {
|
|
10299
|
+
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
10300
|
+
};
|
|
10301
|
+
const getModuleNotFoundError = stderr => {
|
|
10302
|
+
const lines = splitLines(stderr);
|
|
10303
|
+
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
10304
|
+
const message = lines[messageIndex];
|
|
10415
10305
|
return {
|
|
10416
|
-
message
|
|
10417
|
-
code:
|
|
10306
|
+
message,
|
|
10307
|
+
code: ERR_MODULE_NOT_FOUND
|
|
10418
10308
|
};
|
|
10419
10309
|
};
|
|
10420
|
-
const
|
|
10310
|
+
const isModuleNotFoundError = stderr => {
|
|
10421
10311
|
if (!stderr) {
|
|
10422
10312
|
return false;
|
|
10423
10313
|
}
|
|
10424
|
-
return stderr.includes('
|
|
10425
|
-
};
|
|
10426
|
-
const getModuleSyntaxError = () => {
|
|
10427
|
-
return {
|
|
10428
|
-
message: `ES Modules are not supported in electron`,
|
|
10429
|
-
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
10430
|
-
};
|
|
10314
|
+
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
10431
10315
|
};
|
|
10432
|
-
const
|
|
10316
|
+
const isModulesSyntaxError = stderr => {
|
|
10433
10317
|
if (!stderr) {
|
|
10434
10318
|
return false;
|
|
10435
10319
|
}
|
|
10436
|
-
return stderr.includes('
|
|
10320
|
+
return stderr.includes('SyntaxError: Cannot use import statement outside a module');
|
|
10437
10321
|
};
|
|
10438
|
-
const
|
|
10439
|
-
|
|
10322
|
+
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
10323
|
+
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
10324
|
+
const isUnhelpfulNativeModuleError = stderr => {
|
|
10325
|
+
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
10440
10326
|
};
|
|
10441
|
-
const
|
|
10442
|
-
const
|
|
10443
|
-
if (index === -1) {
|
|
10444
|
-
return {
|
|
10445
|
-
actualMessage: joinLines(lines),
|
|
10446
|
-
rest: []
|
|
10447
|
-
};
|
|
10448
|
-
}
|
|
10449
|
-
let lastIndex = index - 1;
|
|
10450
|
-
while (++lastIndex < lines.length) {
|
|
10451
|
-
if (!isNormalStackLine(lines[lastIndex])) {
|
|
10452
|
-
break;
|
|
10453
|
-
}
|
|
10454
|
-
}
|
|
10327
|
+
const getNativeModuleErrorMessage = stderr => {
|
|
10328
|
+
const message = getMessageCodeBlock(stderr);
|
|
10455
10329
|
return {
|
|
10456
|
-
|
|
10457
|
-
|
|
10330
|
+
message: `Incompatible native node module: ${message}`,
|
|
10331
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE
|
|
10332
|
+
};
|
|
10333
|
+
};
|
|
10334
|
+
const getModuleSyntaxError = () => {
|
|
10335
|
+
return {
|
|
10336
|
+
message: `ES Modules are not supported in electron`,
|
|
10337
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
10458
10338
|
};
|
|
10459
10339
|
};
|
|
10460
10340
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -10473,66 +10353,11 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
10473
10353
|
rest
|
|
10474
10354
|
} = getDetails(lines);
|
|
10475
10355
|
return {
|
|
10476
|
-
message:
|
|
10356
|
+
message: actualMessage,
|
|
10477
10357
|
code: '',
|
|
10478
10358
|
stack: rest
|
|
10479
10359
|
};
|
|
10480
10360
|
};
|
|
10481
|
-
const normalizeLine = line => {
|
|
10482
|
-
if (line.startsWith('Error: ')) {
|
|
10483
|
-
return line.slice('Error: '.length);
|
|
10484
|
-
}
|
|
10485
|
-
if (line.startsWith('VError: ')) {
|
|
10486
|
-
return line.slice('VError: '.length);
|
|
10487
|
-
}
|
|
10488
|
-
return line;
|
|
10489
|
-
};
|
|
10490
|
-
const getCombinedMessage = (error, message) => {
|
|
10491
|
-
const stringifiedError = normalizeLine(`${error}`);
|
|
10492
|
-
if (message) {
|
|
10493
|
-
return `${message}: ${stringifiedError}`;
|
|
10494
|
-
}
|
|
10495
|
-
return stringifiedError;
|
|
10496
|
-
};
|
|
10497
|
-
const NewLine = '\n';
|
|
10498
|
-
const getNewLineIndex = (string, startIndex = undefined) => {
|
|
10499
|
-
return string.indexOf(NewLine, startIndex);
|
|
10500
|
-
};
|
|
10501
|
-
const mergeStacks = (parent, child) => {
|
|
10502
|
-
if (!child) {
|
|
10503
|
-
return parent;
|
|
10504
|
-
}
|
|
10505
|
-
const parentNewLineIndex = getNewLineIndex(parent);
|
|
10506
|
-
const childNewLineIndex = getNewLineIndex(child);
|
|
10507
|
-
if (childNewLineIndex === -1) {
|
|
10508
|
-
return parent;
|
|
10509
|
-
}
|
|
10510
|
-
const parentFirstLine = parent.slice(0, parentNewLineIndex);
|
|
10511
|
-
const childRest = child.slice(childNewLineIndex);
|
|
10512
|
-
const childFirstLine = normalizeLine(child.slice(0, childNewLineIndex));
|
|
10513
|
-
if (parentFirstLine.includes(childFirstLine)) {
|
|
10514
|
-
return parentFirstLine + childRest;
|
|
10515
|
-
}
|
|
10516
|
-
return child;
|
|
10517
|
-
};
|
|
10518
|
-
class VError extends Error {
|
|
10519
|
-
constructor(error, message) {
|
|
10520
|
-
const combinedMessage = getCombinedMessage(error, message);
|
|
10521
|
-
super(combinedMessage);
|
|
10522
|
-
this.name = 'VError';
|
|
10523
|
-
if (error instanceof Error) {
|
|
10524
|
-
this.stack = mergeStacks(this.stack, error.stack);
|
|
10525
|
-
}
|
|
10526
|
-
if (error.codeFrame) {
|
|
10527
|
-
// @ts-ignore
|
|
10528
|
-
this.codeFrame = error.codeFrame;
|
|
10529
|
-
}
|
|
10530
|
-
if (error.code) {
|
|
10531
|
-
// @ts-ignore
|
|
10532
|
-
this.code = error.code;
|
|
10533
|
-
}
|
|
10534
|
-
}
|
|
10535
|
-
}
|
|
10536
10361
|
class IpcError extends VError {
|
|
10537
10362
|
// @ts-ignore
|
|
10538
10363
|
constructor(betterMessage, stdout = '', stderr = '') {
|
|
@@ -10559,12 +10384,98 @@ class IpcError extends VError {
|
|
|
10559
10384
|
this.stderr = stderr;
|
|
10560
10385
|
}
|
|
10561
10386
|
}
|
|
10387
|
+
const readyMessage = 'ready';
|
|
10388
|
+
const getData$2 = event => {
|
|
10389
|
+
return event.data;
|
|
10390
|
+
};
|
|
10391
|
+
const listen$8 = ({
|
|
10392
|
+
port
|
|
10393
|
+
}) => {
|
|
10394
|
+
return port;
|
|
10395
|
+
};
|
|
10396
|
+
const signal$9 = port => {
|
|
10397
|
+
port.postMessage(readyMessage);
|
|
10398
|
+
};
|
|
10399
|
+
class IpcChildWithMessagePort extends Ipc {
|
|
10400
|
+
getData(event) {
|
|
10401
|
+
return getData$2(event);
|
|
10402
|
+
}
|
|
10403
|
+
send(message) {
|
|
10404
|
+
this._rawIpc.postMessage(message);
|
|
10405
|
+
}
|
|
10406
|
+
sendAndTransfer(message) {
|
|
10407
|
+
const transfer = getTransferrables(message);
|
|
10408
|
+
this._rawIpc.postMessage(message, transfer);
|
|
10409
|
+
}
|
|
10410
|
+
dispose() {
|
|
10411
|
+
// ignore
|
|
10412
|
+
}
|
|
10413
|
+
onClose(callback) {
|
|
10414
|
+
// ignore
|
|
10415
|
+
}
|
|
10416
|
+
onMessage(callback) {
|
|
10417
|
+
this._rawIpc.addEventListener('message', callback);
|
|
10418
|
+
this._rawIpc.start();
|
|
10419
|
+
}
|
|
10420
|
+
}
|
|
10421
|
+
const wrap$g = port => {
|
|
10422
|
+
return new IpcChildWithMessagePort(port);
|
|
10423
|
+
};
|
|
10424
|
+
const IpcChildWithMessagePort$1 = {
|
|
10425
|
+
__proto__: null,
|
|
10426
|
+
listen: listen$8,
|
|
10427
|
+
signal: signal$9,
|
|
10428
|
+
wrap: wrap$g
|
|
10429
|
+
};
|
|
10430
|
+
const listen$7 = () => {
|
|
10431
|
+
// @ts-ignore
|
|
10432
|
+
if (typeof WorkerGlobalScope === 'undefined') {
|
|
10433
|
+
throw new TypeError('module is not in web worker scope');
|
|
10434
|
+
}
|
|
10435
|
+
return globalThis;
|
|
10436
|
+
};
|
|
10437
|
+
const signal$8 = global => {
|
|
10438
|
+
global.postMessage(readyMessage);
|
|
10439
|
+
};
|
|
10440
|
+
class IpcChildWithModuleWorker extends Ipc {
|
|
10441
|
+
getData(event) {
|
|
10442
|
+
return getData$2(event);
|
|
10443
|
+
}
|
|
10444
|
+
send(message) {
|
|
10445
|
+
// @ts-ignore
|
|
10446
|
+
this._rawIpc.postMessage(message);
|
|
10447
|
+
}
|
|
10448
|
+
sendAndTransfer(message) {
|
|
10449
|
+
const transfer = getTransferrables(message);
|
|
10450
|
+
// @ts-ignore
|
|
10451
|
+
this._rawIpc.postMessage(message, transfer);
|
|
10452
|
+
}
|
|
10453
|
+
dispose() {
|
|
10454
|
+
// ignore
|
|
10455
|
+
}
|
|
10456
|
+
onClose(callback) {
|
|
10457
|
+
// ignore
|
|
10458
|
+
}
|
|
10459
|
+
onMessage(callback) {
|
|
10460
|
+
this._rawIpc.addEventListener('message', callback);
|
|
10461
|
+
}
|
|
10462
|
+
}
|
|
10463
|
+
const wrap$f = global => {
|
|
10464
|
+
return new IpcChildWithModuleWorker(global);
|
|
10465
|
+
};
|
|
10466
|
+
const IpcChildWithModuleWorker$1 = {
|
|
10467
|
+
__proto__: null,
|
|
10468
|
+
listen: listen$7,
|
|
10469
|
+
signal: signal$8,
|
|
10470
|
+
wrap: wrap$f
|
|
10471
|
+
};
|
|
10562
10472
|
const withResolvers = () => {
|
|
10563
10473
|
let _resolve;
|
|
10564
10474
|
const promise = new Promise(resolve => {
|
|
10565
10475
|
_resolve = resolve;
|
|
10566
10476
|
});
|
|
10567
10477
|
return {
|
|
10478
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10568
10479
|
resolve: _resolve,
|
|
10569
10480
|
promise
|
|
10570
10481
|
};
|
|
@@ -10581,10 +10492,10 @@ const waitForFirstMessage = async port => {
|
|
|
10581
10492
|
// @ts-ignore
|
|
10582
10493
|
return event.data;
|
|
10583
10494
|
};
|
|
10584
|
-
const listen$
|
|
10585
|
-
const parentIpcRaw = listen$
|
|
10586
|
-
signal$
|
|
10587
|
-
const parentIpc = wrap$
|
|
10495
|
+
const listen$6 = async () => {
|
|
10496
|
+
const parentIpcRaw = listen$7();
|
|
10497
|
+
signal$8(parentIpcRaw);
|
|
10498
|
+
const parentIpc = wrap$f(parentIpcRaw);
|
|
10588
10499
|
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
10589
10500
|
if (firstMessage.method !== 'initialize') {
|
|
10590
10501
|
throw new IpcError('unexpected first message');
|
|
@@ -10603,11 +10514,8 @@ const listen$1$1 = async () => {
|
|
|
10603
10514
|
return globalThis;
|
|
10604
10515
|
};
|
|
10605
10516
|
class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
10606
|
-
constructor(port) {
|
|
10607
|
-
super(port);
|
|
10608
|
-
}
|
|
10609
10517
|
getData(event) {
|
|
10610
|
-
return getData$
|
|
10518
|
+
return getData$2(event);
|
|
10611
10519
|
}
|
|
10612
10520
|
send(message) {
|
|
10613
10521
|
this._rawIpc.postMessage(message);
|
|
@@ -10629,13 +10537,29 @@ class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
|
10629
10537
|
this._rawIpc.start();
|
|
10630
10538
|
}
|
|
10631
10539
|
}
|
|
10632
|
-
const wrap$
|
|
10540
|
+
const wrap$e = port => {
|
|
10633
10541
|
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
10634
10542
|
};
|
|
10635
10543
|
const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
10636
10544
|
__proto__: null,
|
|
10637
|
-
listen: listen$
|
|
10638
|
-
wrap: wrap$
|
|
10545
|
+
listen: listen$6,
|
|
10546
|
+
wrap: wrap$e
|
|
10547
|
+
};
|
|
10548
|
+
|
|
10549
|
+
const MessagePort$1 = 1;
|
|
10550
|
+
const ModuleWorker = 2;
|
|
10551
|
+
const ReferencePort = 3;
|
|
10552
|
+
const ModuleWorkerAndMessagePort = 8;
|
|
10553
|
+
const Auto = () => {
|
|
10554
|
+
// @ts-ignore
|
|
10555
|
+
if (globalThis.acceptPort) {
|
|
10556
|
+
return MessagePort$1;
|
|
10557
|
+
}
|
|
10558
|
+
// @ts-ignore
|
|
10559
|
+
if (globalThis.acceptReferencePort) {
|
|
10560
|
+
return ReferencePort;
|
|
10561
|
+
}
|
|
10562
|
+
return ModuleWorkerAndMessagePort;
|
|
10639
10563
|
};
|
|
10640
10564
|
|
|
10641
10565
|
const getModule = method => {
|
|
@@ -10656,12 +10580,14 @@ const listen$1 = async ({
|
|
|
10656
10580
|
method
|
|
10657
10581
|
}) => {
|
|
10658
10582
|
const module = await getModule(method);
|
|
10583
|
+
// @ts-ignore
|
|
10659
10584
|
const rawIpc = await module.listen();
|
|
10660
10585
|
// @ts-ignore
|
|
10661
10586
|
if (module.signal) {
|
|
10662
10587
|
// @ts-ignore
|
|
10663
10588
|
module.signal(rawIpc);
|
|
10664
10589
|
}
|
|
10590
|
+
// @ts-ignore
|
|
10665
10591
|
const ipc = module.wrap(rawIpc);
|
|
10666
10592
|
return ipc;
|
|
10667
10593
|
};
|
|
@@ -10672,7 +10598,7 @@ const listen = async () => {
|
|
|
10672
10598
|
method: Auto()
|
|
10673
10599
|
});
|
|
10674
10600
|
handleIpc(ipc);
|
|
10675
|
-
listen$
|
|
10601
|
+
listen$5(ipc);
|
|
10676
10602
|
};
|
|
10677
10603
|
|
|
10678
10604
|
const addWidget = (widget, id, render) => {
|
|
@@ -11378,7 +11304,6 @@ const EditorCompletionWidget = {
|
|
|
11378
11304
|
* @enum {string}
|
|
11379
11305
|
*/
|
|
11380
11306
|
const UiStrings = {
|
|
11381
|
-
MatchesFoundFor: '{PH1} of {PH2} found for {PH3}',
|
|
11382
11307
|
MatchOf: '{PH1} of {PH2}',
|
|
11383
11308
|
NoResults: 'No Results',
|
|
11384
11309
|
Close: 'Close',
|
|
@@ -12043,11 +11968,27 @@ const registerWidgets = () => {
|
|
|
12043
11968
|
set$7(Find, EditorFindWidget);
|
|
12044
11969
|
set$7(Hover, EditorHoverWidget);
|
|
12045
11970
|
set$7(Rename, EditorRenameWidget);
|
|
12046
|
-
set$7(SourceAction, EditorSourceActionWidget);
|
|
11971
|
+
set$7(SourceAction$1, EditorSourceActionWidget);
|
|
12047
11972
|
set$7(CodeGenerator, EditorCodeGeneratorWidget);
|
|
12048
11973
|
};
|
|
12049
11974
|
|
|
11975
|
+
const handleUnhandledRejection = event => {
|
|
11976
|
+
event.preventDefault();
|
|
11977
|
+
console.error(`[editor-worker] Unhandled Rejection: ${event.reason}`);
|
|
11978
|
+
};
|
|
11979
|
+
const handleUnhandledError = (message, filename, lineno, colno, error) => {
|
|
11980
|
+
console.error(`[editor-worker] Unhandled Error: ${error}`);
|
|
11981
|
+
return true;
|
|
11982
|
+
};
|
|
11983
|
+
|
|
11984
|
+
const setupUnhandledErrorHandling = global => {
|
|
11985
|
+
// @ts-ignore
|
|
11986
|
+
global.addEventListener('error', handleUnhandledError);
|
|
11987
|
+
global.addEventListener('unhandledrejection', handleUnhandledRejection);
|
|
11988
|
+
};
|
|
11989
|
+
|
|
12050
11990
|
const main = async () => {
|
|
11991
|
+
setupUnhandledErrorHandling(globalThis);
|
|
12051
11992
|
await listen();
|
|
12052
11993
|
registerWidgets();
|
|
12053
11994
|
};
|