@lvce-editor/editor-worker 19.17.4 → 19.18.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 +287 -306
- package/dist/editorWorkerMain.min.js +1 -1
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1225,7 +1225,7 @@ const createMockRpc = ({
|
|
|
1225
1225
|
};
|
|
1226
1226
|
|
|
1227
1227
|
const rpcs = Object.create(null);
|
|
1228
|
-
const set$
|
|
1228
|
+
const set$h = (id, rpc) => {
|
|
1229
1229
|
rpcs[id] = rpc;
|
|
1230
1230
|
};
|
|
1231
1231
|
const get$8 = id => {
|
|
@@ -1258,7 +1258,7 @@ const create$9 = rpcId => {
|
|
|
1258
1258
|
const mockRpc = createMockRpc({
|
|
1259
1259
|
commandMap
|
|
1260
1260
|
});
|
|
1261
|
-
set$
|
|
1261
|
+
set$h(rpcId, mockRpc);
|
|
1262
1262
|
// @ts-ignore
|
|
1263
1263
|
mockRpc[Symbol.dispose] = () => {
|
|
1264
1264
|
remove$8(rpcId);
|
|
@@ -1267,7 +1267,7 @@ const create$9 = rpcId => {
|
|
|
1267
1267
|
return mockRpc;
|
|
1268
1268
|
},
|
|
1269
1269
|
set(rpc) {
|
|
1270
|
-
set$
|
|
1270
|
+
set$h(rpcId, rpc);
|
|
1271
1271
|
}
|
|
1272
1272
|
};
|
|
1273
1273
|
};
|
|
@@ -1281,6 +1281,7 @@ const ClientX = 'event.clientX';
|
|
|
1281
1281
|
const ClientY = 'event.clientY';
|
|
1282
1282
|
const DeltaMode = 'event.deltaMode';
|
|
1283
1283
|
const DeltaY = 'event.deltaY';
|
|
1284
|
+
const Key = 'event.key';
|
|
1284
1285
|
|
|
1285
1286
|
const Backspace = 1;
|
|
1286
1287
|
const Tab$1 = 2;
|
|
@@ -1339,6 +1340,7 @@ const Electron = 2;
|
|
|
1339
1340
|
const CompletionWorker = 301;
|
|
1340
1341
|
const DebugWorker = 55;
|
|
1341
1342
|
const EditorWorker = 99;
|
|
1343
|
+
const ErrorWorker = 3308;
|
|
1342
1344
|
const ExtensionHostWorker = 44;
|
|
1343
1345
|
const ExtensionManagementWorker = 9006;
|
|
1344
1346
|
const IconThemeWorker = 7009;
|
|
@@ -1346,27 +1348,32 @@ const MarkdownWorker = 300;
|
|
|
1346
1348
|
const OpenerWorker = 4561;
|
|
1347
1349
|
const RendererWorker$1 = 1;
|
|
1348
1350
|
|
|
1349
|
-
const FocusSelector = 'Viewlet.focusSelector';
|
|
1351
|
+
const FocusSelector$1 = 'Viewlet.focusSelector';
|
|
1350
1352
|
const SetCss$1 = 'Viewlet.setCss';
|
|
1351
1353
|
const SetFocusContext$1 = 'Viewlet.setFocusContext';
|
|
1352
1354
|
const SetPatches = 'Viewlet.setPatches';
|
|
1353
1355
|
|
|
1354
1356
|
const FocusEditorText$1 = 12;
|
|
1355
1357
|
|
|
1358
|
+
const {
|
|
1359
|
+
invoke: invoke$g,
|
|
1360
|
+
set: set$g
|
|
1361
|
+
} = create$9(ErrorWorker);
|
|
1362
|
+
|
|
1356
1363
|
const {
|
|
1357
1364
|
invoke: invoke$f,
|
|
1358
|
-
set: set$
|
|
1365
|
+
set: set$f
|
|
1359
1366
|
} = create$9(ExtensionHostWorker);
|
|
1360
1367
|
|
|
1361
1368
|
const ExtensionHost = {
|
|
1362
1369
|
__proto__: null,
|
|
1363
1370
|
invoke: invoke$f,
|
|
1364
|
-
set: set$
|
|
1371
|
+
set: set$f
|
|
1365
1372
|
};
|
|
1366
1373
|
|
|
1367
1374
|
const {
|
|
1368
1375
|
invoke: invoke$e,
|
|
1369
|
-
set: set$
|
|
1376
|
+
set: set$e
|
|
1370
1377
|
} = create$9(ExtensionManagementWorker);
|
|
1371
1378
|
const getLanguages$1 = (platform, assetDir) => {
|
|
1372
1379
|
return invoke$e('Extensions.getLanguages', platform, assetDir);
|
|
@@ -1374,7 +1381,7 @@ const getLanguages$1 = (platform, assetDir) => {
|
|
|
1374
1381
|
|
|
1375
1382
|
const {
|
|
1376
1383
|
invoke: invoke$d,
|
|
1377
|
-
set: set$
|
|
1384
|
+
set: set$d
|
|
1378
1385
|
} = create$9(OpenerWorker);
|
|
1379
1386
|
const openUrl = async (url, platform) => {
|
|
1380
1387
|
return invoke$d('Open.openUrl', url, platform);
|
|
@@ -1382,13 +1389,13 @@ const openUrl = async (url, platform) => {
|
|
|
1382
1389
|
|
|
1383
1390
|
const {
|
|
1384
1391
|
invoke: invoke$c,
|
|
1385
|
-
set: set$
|
|
1392
|
+
set: set$c
|
|
1386
1393
|
} = create$9(IconThemeWorker);
|
|
1387
1394
|
|
|
1388
1395
|
const {
|
|
1389
1396
|
invoke: invoke$b,
|
|
1390
1397
|
invokeAndTransfer,
|
|
1391
|
-
set: set$
|
|
1398
|
+
set: set$b
|
|
1392
1399
|
} = create$9(RendererWorker$1);
|
|
1393
1400
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1394
1401
|
number(uid);
|
|
@@ -1401,6 +1408,10 @@ const sendMessagePortToOpenerWorker = async (port, rpcId) => {
|
|
|
1401
1408
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1402
1409
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker', port, command, rpcId);
|
|
1403
1410
|
};
|
|
1411
|
+
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1412
|
+
const command = 'Errors.handleMessagePort';
|
|
1413
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1414
|
+
};
|
|
1404
1415
|
const readFile = async uri => {
|
|
1405
1416
|
return invoke$b('FileSystem.readFile', uri);
|
|
1406
1417
|
};
|
|
@@ -1448,25 +1459,26 @@ const RendererWorker = {
|
|
|
1448
1459
|
openUri,
|
|
1449
1460
|
readClipBoardText,
|
|
1450
1461
|
readFile,
|
|
1462
|
+
sendMessagePortToErrorWorker,
|
|
1451
1463
|
sendMessagePortToExtensionHostWorker,
|
|
1452
1464
|
sendMessagePortToExtensionManagementWorker: sendMessagePortToExtensionManagementWorker$1,
|
|
1453
1465
|
sendMessagePortToOpenerWorker,
|
|
1454
1466
|
sendMessagePortToSyntaxHighlightingWorker: sendMessagePortToSyntaxHighlightingWorker$1,
|
|
1455
1467
|
sendMessagePortToTextMeasurementWorker,
|
|
1456
|
-
set: set$
|
|
1468
|
+
set: set$b,
|
|
1457
1469
|
showContextMenu2,
|
|
1458
1470
|
writeClipBoardText
|
|
1459
1471
|
};
|
|
1460
1472
|
|
|
1461
1473
|
const {
|
|
1462
1474
|
invoke: invoke$a,
|
|
1463
|
-
set: set$
|
|
1475
|
+
set: set$a
|
|
1464
1476
|
} = create$9(MarkdownWorker);
|
|
1465
1477
|
|
|
1466
1478
|
const SyntaxHighlightingWorker = {
|
|
1467
1479
|
__proto__: null,
|
|
1468
1480
|
invoke: invoke$a,
|
|
1469
|
-
set: set$
|
|
1481
|
+
set: set$a
|
|
1470
1482
|
};
|
|
1471
1483
|
|
|
1472
1484
|
const createLazyRpc = rpcId => {
|
|
@@ -1474,7 +1486,7 @@ const createLazyRpc = rpcId => {
|
|
|
1474
1486
|
let factory;
|
|
1475
1487
|
const createRpc = async () => {
|
|
1476
1488
|
const rpc = await factory();
|
|
1477
|
-
set$
|
|
1489
|
+
set$h(rpcId, rpc);
|
|
1478
1490
|
};
|
|
1479
1491
|
const ensureRpc = async () => {
|
|
1480
1492
|
if (!rpcPromise) {
|
|
@@ -1584,7 +1596,7 @@ const getKeys$2 = () => {
|
|
|
1584
1596
|
const keys = editorStates.getKeys();
|
|
1585
1597
|
return keys.map(String);
|
|
1586
1598
|
};
|
|
1587
|
-
const set$
|
|
1599
|
+
const set$9 = (id, oldEditor, newEditor) => {
|
|
1588
1600
|
editorStates.set(id, oldEditor, newEditor);
|
|
1589
1601
|
};
|
|
1590
1602
|
|
|
@@ -1685,7 +1697,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1685
1697
|
x,
|
|
1686
1698
|
y
|
|
1687
1699
|
};
|
|
1688
|
-
set$
|
|
1700
|
+
set$9(id, editor, editor);
|
|
1689
1701
|
};
|
|
1690
1702
|
|
|
1691
1703
|
// TODO use numeric enum
|
|
@@ -1708,7 +1720,7 @@ const Rename = 'rename';
|
|
|
1708
1720
|
const ToggleBlockComment$1 = 'toggleBlockComment';
|
|
1709
1721
|
|
|
1710
1722
|
const map$1 = Object.create(null);
|
|
1711
|
-
const set$
|
|
1723
|
+
const set$8 = (id, widget) => {
|
|
1712
1724
|
map$1[id] = widget;
|
|
1713
1725
|
};
|
|
1714
1726
|
const get$6 = id => {
|
|
@@ -1756,6 +1768,7 @@ const clamp = (num, min, max) => {
|
|
|
1756
1768
|
};
|
|
1757
1769
|
|
|
1758
1770
|
const Link$1 = 'Link';
|
|
1771
|
+
const EditorGoToDefinitionLink = 'EditorGoToDefinitionLink';
|
|
1759
1772
|
const Function = 'Function';
|
|
1760
1773
|
const Parameter = 'Parameter';
|
|
1761
1774
|
const Type = 'Type';
|
|
@@ -1763,6 +1776,7 @@ const VariableName = 'VariableName';
|
|
|
1763
1776
|
const Class = 'Class';
|
|
1764
1777
|
|
|
1765
1778
|
const Link = 1;
|
|
1779
|
+
const DefinitionLink = 2;
|
|
1766
1780
|
const Ts2816 = 2816;
|
|
1767
1781
|
const Ts2817 = 2817;
|
|
1768
1782
|
const Ts2824 = 2824;
|
|
@@ -1803,6 +1817,8 @@ const Ts272 = 272;
|
|
|
1803
1817
|
|
|
1804
1818
|
const getDecorationClassName = type => {
|
|
1805
1819
|
switch (type) {
|
|
1820
|
+
case DefinitionLink:
|
|
1821
|
+
return EditorGoToDefinitionLink;
|
|
1806
1822
|
case Link:
|
|
1807
1823
|
return Link$1;
|
|
1808
1824
|
case Ts1024:
|
|
@@ -1948,7 +1964,7 @@ const getEnabled$1 = () => {
|
|
|
1948
1964
|
|
|
1949
1965
|
const {
|
|
1950
1966
|
invoke: invoke$8,
|
|
1951
|
-
set: set$
|
|
1967
|
+
set: set$7
|
|
1952
1968
|
} = SyntaxHighlightingWorker;
|
|
1953
1969
|
|
|
1954
1970
|
const state$9 = {
|
|
@@ -1959,7 +1975,7 @@ const state$9 = {
|
|
|
1959
1975
|
const has = languageId => {
|
|
1960
1976
|
return Object.hasOwn(state$9.tokenizers, languageId);
|
|
1961
1977
|
};
|
|
1962
|
-
const set$
|
|
1978
|
+
const set$6 = (languageId, tokenizer) => {
|
|
1963
1979
|
state$9.tokenizers[languageId] = tokenizer;
|
|
1964
1980
|
};
|
|
1965
1981
|
const get$5 = languageId => {
|
|
@@ -1983,7 +1999,7 @@ const isPending = languageId => {
|
|
|
1983
1999
|
};
|
|
1984
2000
|
|
|
1985
2001
|
const tokenMaps = Object.create(null);
|
|
1986
|
-
const set$
|
|
2002
|
+
const set$5 = (languageId, tokenMap) => {
|
|
1987
2003
|
tokenMaps[languageId] = tokenMap;
|
|
1988
2004
|
};
|
|
1989
2005
|
const get$4 = languageId => {
|
|
@@ -1999,7 +2015,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
1999
2015
|
if (getEnabled$1()) {
|
|
2000
2016
|
// @ts-ignore
|
|
2001
2017
|
const tokenMap = await invoke$8('Tokenizer.load', languageId, tokenizePath);
|
|
2002
|
-
set$
|
|
2018
|
+
set$5(languageId, tokenMap);
|
|
2003
2019
|
return;
|
|
2004
2020
|
}
|
|
2005
2021
|
try {
|
|
@@ -2015,8 +2031,8 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
2015
2031
|
console.warn(`tokenizer.TokenMap should be an object in "${tokenizePath}"`);
|
|
2016
2032
|
return;
|
|
2017
2033
|
}
|
|
2018
|
-
set$
|
|
2019
|
-
set$
|
|
2034
|
+
set$5(languageId, tokenizer.TokenMap);
|
|
2035
|
+
set$6(languageId, tokenizer);
|
|
2020
2036
|
} catch (error) {
|
|
2021
2037
|
// TODO better error handling
|
|
2022
2038
|
console.error(error);
|
|
@@ -2033,7 +2049,7 @@ const getTokenizer = languageId => {
|
|
|
2033
2049
|
};
|
|
2034
2050
|
|
|
2035
2051
|
const tokenizers = Object.create(null);
|
|
2036
|
-
const set$
|
|
2052
|
+
const set$4 = (id, value) => {
|
|
2037
2053
|
tokenizers[id] = value;
|
|
2038
2054
|
};
|
|
2039
2055
|
const get$3 = id => {
|
|
@@ -3557,7 +3573,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
3557
3573
|
...newEditor,
|
|
3558
3574
|
decorations: linkDecorations
|
|
3559
3575
|
};
|
|
3560
|
-
set$
|
|
3576
|
+
set$9(editor.uid, editor, newEditorWithDecorations);
|
|
3561
3577
|
|
|
3562
3578
|
// Notify main-area-worker about modified status change
|
|
3563
3579
|
if (!editor.modified) {
|
|
@@ -3773,7 +3789,7 @@ const TextDocumentSyncFull = 'ExtensionHostTextDocument.syncFull';
|
|
|
3773
3789
|
|
|
3774
3790
|
const {
|
|
3775
3791
|
invoke: invoke$6,
|
|
3776
|
-
set: set$
|
|
3792
|
+
set: set$3
|
|
3777
3793
|
} = ExtensionHost;
|
|
3778
3794
|
|
|
3779
3795
|
const getFileExtensionIndex = file => {
|
|
@@ -3844,6 +3860,26 @@ const get$2 = async key => {
|
|
|
3844
3860
|
return value;
|
|
3845
3861
|
};
|
|
3846
3862
|
|
|
3863
|
+
const logError = async (error, prefix) => {
|
|
3864
|
+
const prettyError = await invoke$g('Errors.prepare', error);
|
|
3865
|
+
await invoke$g('Errors.print', prettyError, prefix);
|
|
3866
|
+
};
|
|
3867
|
+
const logFallback = (error, prefix) => {
|
|
3868
|
+
if (prefix) {
|
|
3869
|
+
console.error(prefix, error);
|
|
3870
|
+
return;
|
|
3871
|
+
}
|
|
3872
|
+
console.error(error);
|
|
3873
|
+
};
|
|
3874
|
+
const handleError$1 = async (error, prefix = '') => {
|
|
3875
|
+
try {
|
|
3876
|
+
await logError(error, prefix);
|
|
3877
|
+
} catch (otherError) {
|
|
3878
|
+
console.warn('ErrorHandling error', otherError);
|
|
3879
|
+
logFallback(error, prefix);
|
|
3880
|
+
}
|
|
3881
|
+
};
|
|
3882
|
+
|
|
3847
3883
|
const OnDiagnostic = 'onDiagnostic';
|
|
3848
3884
|
const OnHover = 'onHover';
|
|
3849
3885
|
const OnTabCompletion = 'onTabCompletion';
|
|
@@ -3986,11 +4022,11 @@ const addDiagnostics = async (editor, diagnostics) => {
|
|
|
3986
4022
|
visualDecorations
|
|
3987
4023
|
};
|
|
3988
4024
|
};
|
|
3989
|
-
const handleError
|
|
4025
|
+
const handleError = async (error, editor) => {
|
|
3990
4026
|
if (error instanceof Error && error.message.includes('No diagnostic provider found')) {
|
|
3991
4027
|
return editor;
|
|
3992
4028
|
}
|
|
3993
|
-
|
|
4029
|
+
await handleError$1(error, 'Failed to update diagnostics: ');
|
|
3994
4030
|
return editor;
|
|
3995
4031
|
};
|
|
3996
4032
|
const getEditorWithDiagnostics = async editor => {
|
|
@@ -4001,7 +4037,7 @@ const getEditorWithDiagnostics = async editor => {
|
|
|
4001
4037
|
}
|
|
4002
4038
|
return addDiagnostics(editor, diagnostics);
|
|
4003
4039
|
} catch (error) {
|
|
4004
|
-
return handleError
|
|
4040
|
+
return handleError(error, editor);
|
|
4005
4041
|
}
|
|
4006
4042
|
};
|
|
4007
4043
|
const updateDiagnostics = async editor => {
|
|
@@ -4012,12 +4048,12 @@ const updateDiagnostics = async editor => {
|
|
|
4012
4048
|
return editor;
|
|
4013
4049
|
}
|
|
4014
4050
|
const newEditor = await addDiagnostics(latest.newState, diagnostics);
|
|
4015
|
-
set$
|
|
4051
|
+
set$9(editor.id, latest.oldState, newEditor);
|
|
4016
4052
|
// @ts-ignore
|
|
4017
4053
|
await invoke$b('Editor.rerender', editor.id);
|
|
4018
4054
|
return newEditor;
|
|
4019
4055
|
} catch (error) {
|
|
4020
|
-
return handleError
|
|
4056
|
+
return handleError(error, editor);
|
|
4021
4057
|
}
|
|
4022
4058
|
};
|
|
4023
4059
|
|
|
@@ -4170,7 +4206,7 @@ const createEditor = async ({
|
|
|
4170
4206
|
focused: true,
|
|
4171
4207
|
textInfos
|
|
4172
4208
|
};
|
|
4173
|
-
set$
|
|
4209
|
+
set$9(id, emptyEditor, newEditor4);
|
|
4174
4210
|
|
|
4175
4211
|
// TODO only sync when needed
|
|
4176
4212
|
// e.g. it might not always be necessary to send text to extension host worker
|
|
@@ -4179,7 +4215,7 @@ const createEditor = async ({
|
|
|
4179
4215
|
const editorWithDiagnostics = diagnosticsEnabled ? await updateDiagnostics(newEditor4) : newEditor4;
|
|
4180
4216
|
const completionsOnTypeRaw = await get$2('editor.completionsOnType');
|
|
4181
4217
|
const completionsOnType = Boolean(completionsOnTypeRaw);
|
|
4182
|
-
set$
|
|
4218
|
+
set$9(id, emptyEditor, {
|
|
4183
4219
|
...editorWithDiagnostics,
|
|
4184
4220
|
completionsOnType
|
|
4185
4221
|
});
|
|
@@ -4190,13 +4226,16 @@ const isEqual$3 = (oldState, newState) => {
|
|
|
4190
4226
|
};
|
|
4191
4227
|
|
|
4192
4228
|
const isEqual$2 = (oldState, newState) => {
|
|
4229
|
+
if (oldState.focus !== newState.focus) {
|
|
4230
|
+
return false;
|
|
4231
|
+
}
|
|
4193
4232
|
if (!newState.focused) {
|
|
4194
4233
|
return true;
|
|
4195
4234
|
}
|
|
4196
4235
|
if (!oldState.isSelecting && newState.isSelecting) {
|
|
4197
4236
|
return false;
|
|
4198
4237
|
}
|
|
4199
|
-
return oldState.focused === newState.focused
|
|
4238
|
+
return oldState.focused === newState.focused;
|
|
4200
4239
|
};
|
|
4201
4240
|
|
|
4202
4241
|
const isEqual$1 = (oldState, newState) => {
|
|
@@ -4738,7 +4777,7 @@ const showErrorMessage = (editor, rowIndex, columnIndex, message) => {
|
|
|
4738
4777
|
};
|
|
4739
4778
|
|
|
4740
4779
|
// @ts-ignore
|
|
4741
|
-
const getErrorMessage$
|
|
4780
|
+
const getErrorMessage$4 = String;
|
|
4742
4781
|
|
|
4743
4782
|
// @ts-ignore
|
|
4744
4783
|
const getMatchingClosingBrace$1 = brace => {
|
|
@@ -4771,7 +4810,7 @@ const braceCompletion = async (editor, text) => {
|
|
|
4771
4810
|
// TODO cursor should always be of type object
|
|
4772
4811
|
const position = Array.isArray(editor.cursor) ? editor.cursor[0] : editor.cursor;
|
|
4773
4812
|
// @ts-ignore
|
|
4774
|
-
return showErrorMessage(editor, position, getErrorMessage$
|
|
4813
|
+
return showErrorMessage(editor, position, getErrorMessage$4(error));
|
|
4775
4814
|
}
|
|
4776
4815
|
};
|
|
4777
4816
|
const getCursorOffset = editor => {
|
|
@@ -4968,7 +5007,23 @@ const newStateGenerator$6 = (state, parentUid) => {
|
|
|
4968
5007
|
return loadContent$3(state, parentUid);
|
|
4969
5008
|
};
|
|
4970
5009
|
const openColorPicker = async editor => {
|
|
4971
|
-
|
|
5010
|
+
const fullFocus = true;
|
|
5011
|
+
return addWidgetToEditor(ColorPicker$1, ColorPicker, editor, create$6, newStateGenerator$6, fullFocus);
|
|
5012
|
+
};
|
|
5013
|
+
const closeColorPicker = editor => {
|
|
5014
|
+
const {
|
|
5015
|
+
widgets
|
|
5016
|
+
} = editor;
|
|
5017
|
+
if (widgets.every(widget => widget.id !== ColorPicker$1)) {
|
|
5018
|
+
return editor;
|
|
5019
|
+
}
|
|
5020
|
+
return {
|
|
5021
|
+
...editor,
|
|
5022
|
+
additionalFocus: 0,
|
|
5023
|
+
focus: FocusEditorText$1,
|
|
5024
|
+
focused: true,
|
|
5025
|
+
widgets: removeEditorWidget(widgets, ColorPicker$1)
|
|
5026
|
+
};
|
|
4972
5027
|
};
|
|
4973
5028
|
|
|
4974
5029
|
const state$5 = {
|
|
@@ -6064,7 +6119,7 @@ const getNoLocationFoundMessage$1 = info => {
|
|
|
6064
6119
|
}
|
|
6065
6120
|
return noDefinitionFound();
|
|
6066
6121
|
};
|
|
6067
|
-
const getErrorMessage$
|
|
6122
|
+
const getErrorMessage$3 = String;
|
|
6068
6123
|
|
|
6069
6124
|
// @ts-ignore
|
|
6070
6125
|
const isNoProviderFoundError$1 = error => {
|
|
@@ -6073,7 +6128,7 @@ const isNoProviderFoundError$1 = error => {
|
|
|
6073
6128
|
const goToDefinition = async editor => {
|
|
6074
6129
|
return goTo({
|
|
6075
6130
|
editor,
|
|
6076
|
-
getErrorMessage: getErrorMessage$
|
|
6131
|
+
getErrorMessage: getErrorMessage$3,
|
|
6077
6132
|
getLocation: getLocation$1,
|
|
6078
6133
|
getNoLocationFoundMessage: getNoLocationFoundMessage$1,
|
|
6079
6134
|
isNoProviderFoundError: isNoProviderFoundError$1
|
|
@@ -6098,14 +6153,14 @@ const getLocation = async (editor, rowIndex, columnIndex) => {
|
|
|
6098
6153
|
const definition = await getTypeDefinition(editor, offset);
|
|
6099
6154
|
return definition;
|
|
6100
6155
|
};
|
|
6101
|
-
const getErrorMessage$
|
|
6156
|
+
const getErrorMessage$2 = String;
|
|
6102
6157
|
const isNoProviderFoundError = error => {
|
|
6103
6158
|
return error?.message?.startsWith('Failed to execute type definition provider: No type definition provider found');
|
|
6104
6159
|
};
|
|
6105
6160
|
const goToTypeDefinition = async (editor, explicit = true) => {
|
|
6106
6161
|
return goTo({
|
|
6107
6162
|
editor,
|
|
6108
|
-
getErrorMessage: getErrorMessage$
|
|
6163
|
+
getErrorMessage: getErrorMessage$2,
|
|
6109
6164
|
getLocation,
|
|
6110
6165
|
getNoLocationFoundMessage: getNoLocationFoundMessage,
|
|
6111
6166
|
isNoProviderFoundError
|
|
@@ -6283,6 +6338,58 @@ const handleFocus$1 = editor => {
|
|
|
6283
6338
|
};
|
|
6284
6339
|
};
|
|
6285
6340
|
|
|
6341
|
+
const stride = 4;
|
|
6342
|
+
const isDefinitionLink = (decorations, index) => {
|
|
6343
|
+
return decorations[index + 2] === DefinitionLink;
|
|
6344
|
+
};
|
|
6345
|
+
const matches = (editor, offset, length) => {
|
|
6346
|
+
const {
|
|
6347
|
+
decorations
|
|
6348
|
+
} = editor;
|
|
6349
|
+
for (let i = 0; i < decorations.length; i += stride) {
|
|
6350
|
+
if (isDefinitionLink(decorations, i)) {
|
|
6351
|
+
return decorations[i] === offset && decorations[i + 1] === length;
|
|
6352
|
+
}
|
|
6353
|
+
}
|
|
6354
|
+
return false;
|
|
6355
|
+
};
|
|
6356
|
+
const clear = editor => {
|
|
6357
|
+
const {
|
|
6358
|
+
decorations
|
|
6359
|
+
} = editor;
|
|
6360
|
+
const filtered = [];
|
|
6361
|
+
for (let i = 0; i < decorations.length; i += stride) {
|
|
6362
|
+
if (!isDefinitionLink(decorations, i)) {
|
|
6363
|
+
filtered.push(decorations[i], decorations[i + 1], decorations[i + 2], decorations[i + 3]);
|
|
6364
|
+
}
|
|
6365
|
+
}
|
|
6366
|
+
if (filtered.length === decorations.length) {
|
|
6367
|
+
return editor;
|
|
6368
|
+
}
|
|
6369
|
+
return {
|
|
6370
|
+
...editor,
|
|
6371
|
+
decorations: filtered
|
|
6372
|
+
};
|
|
6373
|
+
};
|
|
6374
|
+
const set$2 = (editor, offset, length) => {
|
|
6375
|
+
if (matches(editor, offset, length)) {
|
|
6376
|
+
return editor;
|
|
6377
|
+
}
|
|
6378
|
+
const editorWithoutDefinitionLink = clear(editor);
|
|
6379
|
+
return {
|
|
6380
|
+
...editorWithoutDefinitionLink,
|
|
6381
|
+
decorations: [...editorWithoutDefinitionLink.decorations, offset, length, DefinitionLink, 0]
|
|
6382
|
+
};
|
|
6383
|
+
};
|
|
6384
|
+
|
|
6385
|
+
const altKey = 'Alt';
|
|
6386
|
+
const handleKeyUp = (editor, key) => {
|
|
6387
|
+
if (key !== altKey) {
|
|
6388
|
+
return editor;
|
|
6389
|
+
}
|
|
6390
|
+
return clear(editor);
|
|
6391
|
+
};
|
|
6392
|
+
|
|
6286
6393
|
const Single = 1;
|
|
6287
6394
|
const Double = 2;
|
|
6288
6395
|
const Triple = 3;
|
|
@@ -6376,6 +6483,76 @@ const set$1 = (editor, timeout, x, y) => {
|
|
|
6376
6483
|
state$4.y = y;
|
|
6377
6484
|
};
|
|
6378
6485
|
|
|
6486
|
+
const RE_ALPHA_NUMERIC = /[a-zA-Z\d]/;
|
|
6487
|
+
const isAlphaNumeric = char => {
|
|
6488
|
+
return RE_ALPHA_NUMERIC.test(char);
|
|
6489
|
+
};
|
|
6490
|
+
|
|
6491
|
+
const isWordChar = char => {
|
|
6492
|
+
return isAlphaNumeric(char) || char === '_';
|
|
6493
|
+
};
|
|
6494
|
+
const getWordStartIndex = (line, index) => {
|
|
6495
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
6496
|
+
if (!isWordChar(line[i])) {
|
|
6497
|
+
return i + 1;
|
|
6498
|
+
}
|
|
6499
|
+
}
|
|
6500
|
+
return 0;
|
|
6501
|
+
};
|
|
6502
|
+
const getWordEndIndex = (line, index) => {
|
|
6503
|
+
for (let i = index; i < line.length; i++) {
|
|
6504
|
+
if (!isWordChar(line[i])) {
|
|
6505
|
+
return i;
|
|
6506
|
+
}
|
|
6507
|
+
}
|
|
6508
|
+
return line.length;
|
|
6509
|
+
};
|
|
6510
|
+
const getWordMatchAtPosition = (lines, rowIndex, columnIndex) => {
|
|
6511
|
+
const line = lines[rowIndex];
|
|
6512
|
+
const start = getWordStartIndex(line, columnIndex);
|
|
6513
|
+
const end = getWordEndIndex(line, columnIndex);
|
|
6514
|
+
const word = line.slice(start, end);
|
|
6515
|
+
return {
|
|
6516
|
+
end,
|
|
6517
|
+
start,
|
|
6518
|
+
word
|
|
6519
|
+
};
|
|
6520
|
+
};
|
|
6521
|
+
|
|
6522
|
+
const isNoDefinitionProviderFoundError = error => {
|
|
6523
|
+
return error instanceof Error && error.message.startsWith('Failed to execute definition provider: No definition provider found');
|
|
6524
|
+
};
|
|
6525
|
+
|
|
6526
|
+
// @ts-ignore
|
|
6527
|
+
const handleMouseMoveWithAltKey = async (editor, x, y) => {
|
|
6528
|
+
object(editor);
|
|
6529
|
+
number(x);
|
|
6530
|
+
number(y);
|
|
6531
|
+
const position = await at(editor, x, y);
|
|
6532
|
+
const wordMatch = getWordMatchAtPosition(editor.lines, position.rowIndex, position.columnIndex);
|
|
6533
|
+
if (!wordMatch.word) {
|
|
6534
|
+
return clear(editor);
|
|
6535
|
+
}
|
|
6536
|
+
const wordOffset = offsetAt(editor, position.rowIndex, wordMatch.start);
|
|
6537
|
+
const wordLength = wordMatch.end - wordMatch.start;
|
|
6538
|
+
if (matches(editor, wordOffset, wordLength)) {
|
|
6539
|
+
return editor;
|
|
6540
|
+
}
|
|
6541
|
+
const documentOffset = offsetAt(editor, position.rowIndex, position.columnIndex);
|
|
6542
|
+
try {
|
|
6543
|
+
const definition = await getDefinition(editor, documentOffset);
|
|
6544
|
+
if (!definition) {
|
|
6545
|
+
return clear(editor);
|
|
6546
|
+
}
|
|
6547
|
+
return set$2(editor, wordOffset, wordLength);
|
|
6548
|
+
} catch (error) {
|
|
6549
|
+
if (isNoDefinitionProviderFoundError(error)) {
|
|
6550
|
+
return clear(editor);
|
|
6551
|
+
}
|
|
6552
|
+
throw error;
|
|
6553
|
+
}
|
|
6554
|
+
};
|
|
6555
|
+
|
|
6379
6556
|
const showHover$1 = async (editor, position) => {
|
|
6380
6557
|
// TODO race condition
|
|
6381
6558
|
// await Viewlet.closeWidget(ViewletModuleId.EditorHover)
|
|
@@ -6400,77 +6577,21 @@ const onHoverIdle = async () => {
|
|
|
6400
6577
|
await showHover$1();
|
|
6401
6578
|
};
|
|
6402
6579
|
const hoverDelay = 300;
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6580
|
+
const handleMouseMove = async (editor, x, y, altKey) => {
|
|
6581
|
+
if (altKey) {
|
|
6582
|
+
return handleMouseMoveWithAltKey(editor, x, y);
|
|
6583
|
+
}
|
|
6584
|
+
const editorWithoutDefinitionLink = clear(editor);
|
|
6585
|
+
if (!editorWithoutDefinitionLink.hoverEnabled) {
|
|
6586
|
+
return editorWithoutDefinitionLink;
|
|
6408
6587
|
}
|
|
6409
6588
|
const oldState = get$1();
|
|
6410
6589
|
if (oldState.timeout !== -1) {
|
|
6411
6590
|
clearTimeout(oldState.timeout);
|
|
6412
6591
|
}
|
|
6413
6592
|
const timeout = setTimeout(onHoverIdle, hoverDelay);
|
|
6414
|
-
set$1(
|
|
6415
|
-
return
|
|
6416
|
-
};
|
|
6417
|
-
|
|
6418
|
-
// @ts-ignore
|
|
6419
|
-
const getTokenIndex = (tokens, offset) => {
|
|
6420
|
-
let currentOffset = 0;
|
|
6421
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
6422
|
-
const token = tokens[i];
|
|
6423
|
-
currentOffset += token.length;
|
|
6424
|
-
if (currentOffset >= offset) {
|
|
6425
|
-
return i;
|
|
6426
|
-
}
|
|
6427
|
-
}
|
|
6428
|
-
return -1;
|
|
6429
|
-
};
|
|
6430
|
-
|
|
6431
|
-
// @ts-ignore
|
|
6432
|
-
const handleMouseMoveWithAltKey = async (editor, x, y) => {
|
|
6433
|
-
object(editor);
|
|
6434
|
-
number(x);
|
|
6435
|
-
number(y);
|
|
6436
|
-
const position = await at(editor, x, y);
|
|
6437
|
-
const documentOffset = offsetAt(editor, position.rowIndex, position.columnIndex);
|
|
6438
|
-
try {
|
|
6439
|
-
const definition = await getDefinition(editor, documentOffset);
|
|
6440
|
-
if (!definition) {
|
|
6441
|
-
return editor;
|
|
6442
|
-
}
|
|
6443
|
-
|
|
6444
|
-
// TODO make sure that editor is not disposed
|
|
6445
|
-
|
|
6446
|
-
const definitionStartPosition = positionAt(editor, definition.startOffset);
|
|
6447
|
-
positionAt(editor, definition.endOffset);
|
|
6448
|
-
// const definitionRelativeY = definitionStartPosition.rowIndex - editor.minLineY
|
|
6449
|
-
|
|
6450
|
-
const lineTokenMap = editor.lineCache[definitionStartPosition.rowIndex + 1];
|
|
6451
|
-
if (!lineTokenMap) {
|
|
6452
|
-
return editor;
|
|
6453
|
-
}
|
|
6454
|
-
const tokenIndex = getTokenIndex(lineTokenMap.tokens, definitionStartPosition.columnIndex);
|
|
6455
|
-
if (tokenIndex === -1) {
|
|
6456
|
-
return editor;
|
|
6457
|
-
}
|
|
6458
|
-
// .tokens
|
|
6459
|
-
// await RendererProcess.invoke(
|
|
6460
|
-
// /* Viewlet.invoke */ 'Viewlet.send',
|
|
6461
|
-
// /* id */ ViewletModuleId.EditorText,
|
|
6462
|
-
// /* method */ 'highlightAsLink',
|
|
6463
|
-
// /* relativeY */ definitionRelativeY,
|
|
6464
|
-
// /* tokenIndex */ tokenIndex,
|
|
6465
|
-
// )
|
|
6466
|
-
return editor;
|
|
6467
|
-
} catch (error) {
|
|
6468
|
-
// @ts-ignore
|
|
6469
|
-
if (error && error.message.startsWith('Failed to execute definition provider: No definition provider found')) {
|
|
6470
|
-
return editor;
|
|
6471
|
-
}
|
|
6472
|
-
throw error;
|
|
6473
|
-
}
|
|
6593
|
+
set$1(editorWithoutDefinitionLink, timeout, x, y);
|
|
6594
|
+
return editorWithoutDefinitionLink;
|
|
6474
6595
|
};
|
|
6475
6596
|
|
|
6476
6597
|
// TODO adjust relative position
|
|
@@ -6727,7 +6848,7 @@ const continueScrollingAndMovingSelection = async editorUid => {
|
|
|
6727
6848
|
}
|
|
6728
6849
|
};
|
|
6729
6850
|
const newEditorWithDerivedState = await updateDerivedState(editor, nextEditor);
|
|
6730
|
-
set$
|
|
6851
|
+
set$9(editor.uid, editor, newEditorWithDerivedState);
|
|
6731
6852
|
requestAnimationFrame(() => continueScrollingAndMovingSelection(editorUid));
|
|
6732
6853
|
};
|
|
6733
6854
|
|
|
@@ -7315,7 +7436,7 @@ const launch = async () => {
|
|
|
7315
7436
|
return;
|
|
7316
7437
|
}
|
|
7317
7438
|
const rpc = await launchFindWidgetWorker();
|
|
7318
|
-
set$
|
|
7439
|
+
set$h(rpcId, rpc);
|
|
7319
7440
|
};
|
|
7320
7441
|
const invoke$3 = async (method, ...params) => {
|
|
7321
7442
|
const rpc = get$8(rpcId);
|
|
@@ -7502,133 +7623,6 @@ const redo = state => {
|
|
|
7502
7623
|
return scheduleDocumentAndCursorsSelectionIsUndo(newState, last);
|
|
7503
7624
|
};
|
|
7504
7625
|
|
|
7505
|
-
const getErrorMessage$2 = error => {
|
|
7506
|
-
if (!error) {
|
|
7507
|
-
return `Error: ${error}`;
|
|
7508
|
-
}
|
|
7509
|
-
let {
|
|
7510
|
-
message
|
|
7511
|
-
} = error;
|
|
7512
|
-
while (error.cause) {
|
|
7513
|
-
error = error.cause;
|
|
7514
|
-
message += `: ${error}`;
|
|
7515
|
-
}
|
|
7516
|
-
return message;
|
|
7517
|
-
};
|
|
7518
|
-
const prepareErrorMessageWithCodeFrame = error => {
|
|
7519
|
-
if (!error) {
|
|
7520
|
-
return {
|
|
7521
|
-
codeFrame: undefined,
|
|
7522
|
-
message: error,
|
|
7523
|
-
stack: undefined,
|
|
7524
|
-
type: 'Error'
|
|
7525
|
-
};
|
|
7526
|
-
}
|
|
7527
|
-
const message = getErrorMessage$2(error);
|
|
7528
|
-
if (error.codeFrame) {
|
|
7529
|
-
return {
|
|
7530
|
-
codeFrame: error.codeFrame,
|
|
7531
|
-
message,
|
|
7532
|
-
stack: error.stack,
|
|
7533
|
-
type: error.constructor.name
|
|
7534
|
-
};
|
|
7535
|
-
}
|
|
7536
|
-
return {
|
|
7537
|
-
category: error.category,
|
|
7538
|
-
codeFrame: error.originalCodeFrame,
|
|
7539
|
-
message,
|
|
7540
|
-
stack: error.originalStack,
|
|
7541
|
-
stderr: error.stderr
|
|
7542
|
-
};
|
|
7543
|
-
};
|
|
7544
|
-
|
|
7545
|
-
/* eslint-disable sonarjs/super-linear-regex */
|
|
7546
|
-
|
|
7547
|
-
const RE_PATH_1 = /\((.*):(\d+):(\d+)\)$/;
|
|
7548
|
-
const RE_PATH_2 = /at (.*):(\d+):(\d+)$/;
|
|
7549
|
-
|
|
7550
|
-
/**
|
|
7551
|
-
*
|
|
7552
|
-
* @param {readonly string[]} lines
|
|
7553
|
-
* @returns
|
|
7554
|
-
*/
|
|
7555
|
-
const getFile = lines => {
|
|
7556
|
-
for (const line of lines) {
|
|
7557
|
-
if (RE_PATH_1.test(line) || RE_PATH_2.test(line)) {
|
|
7558
|
-
return line;
|
|
7559
|
-
}
|
|
7560
|
-
}
|
|
7561
|
-
return '';
|
|
7562
|
-
};
|
|
7563
|
-
const prepareErrorMessageWithoutCodeFrame = async error => {
|
|
7564
|
-
try {
|
|
7565
|
-
const lines = splitLines(error.stack);
|
|
7566
|
-
const file = getFile(lines);
|
|
7567
|
-
let match = file.match(RE_PATH_1);
|
|
7568
|
-
if (!match) {
|
|
7569
|
-
match = file.match(RE_PATH_2);
|
|
7570
|
-
}
|
|
7571
|
-
if (!match) {
|
|
7572
|
-
return error;
|
|
7573
|
-
}
|
|
7574
|
-
const relevantStack = joinLines(lines.slice(1));
|
|
7575
|
-
const message = getErrorMessage$2(error);
|
|
7576
|
-
return {
|
|
7577
|
-
message,
|
|
7578
|
-
stack: relevantStack,
|
|
7579
|
-
type: error.constructor.name
|
|
7580
|
-
};
|
|
7581
|
-
} catch (otherError) {
|
|
7582
|
-
console.warn('ErrorHandling Error');
|
|
7583
|
-
console.warn(otherError);
|
|
7584
|
-
return error;
|
|
7585
|
-
}
|
|
7586
|
-
};
|
|
7587
|
-
const prepare = async error => {
|
|
7588
|
-
if (error && error.message && error.codeFrame) {
|
|
7589
|
-
return prepareErrorMessageWithCodeFrame(error);
|
|
7590
|
-
}
|
|
7591
|
-
if (error && error.stack) {
|
|
7592
|
-
return prepareErrorMessageWithoutCodeFrame(error);
|
|
7593
|
-
}
|
|
7594
|
-
return error;
|
|
7595
|
-
};
|
|
7596
|
-
const print = error => {
|
|
7597
|
-
if (error && error.type && error.message && error.codeFrame) {
|
|
7598
|
-
return `${error.type}: ${error.message}\n\n${error.codeFrame}\n\n${error.stack}`;
|
|
7599
|
-
}
|
|
7600
|
-
if (error && error.message && error.codeFrame) {
|
|
7601
|
-
return `${error.message}\n\n${error.codeFrame}\n\n${error.stack}`;
|
|
7602
|
-
}
|
|
7603
|
-
if (error && error.type && error.message) {
|
|
7604
|
-
return `${error.type}: ${error.message}\n${error.stack}`;
|
|
7605
|
-
}
|
|
7606
|
-
if (error && error.stack) {
|
|
7607
|
-
return error.stack;
|
|
7608
|
-
}
|
|
7609
|
-
if (error === null) {
|
|
7610
|
-
return null;
|
|
7611
|
-
}
|
|
7612
|
-
return String(error);
|
|
7613
|
-
};
|
|
7614
|
-
|
|
7615
|
-
// @ts-nocheck
|
|
7616
|
-
const logError = async error => {
|
|
7617
|
-
const prettyError = await prepare(error);
|
|
7618
|
-
const prettyErrorString = print(prettyError);
|
|
7619
|
-
console.error(prettyErrorString);
|
|
7620
|
-
return prettyError;
|
|
7621
|
-
};
|
|
7622
|
-
const handleError = async error => {
|
|
7623
|
-
try {
|
|
7624
|
-
await logError(error);
|
|
7625
|
-
} catch (otherError) {
|
|
7626
|
-
console.warn('ErrorHandling error');
|
|
7627
|
-
console.warn(otherError);
|
|
7628
|
-
console.error(error);
|
|
7629
|
-
}
|
|
7630
|
-
};
|
|
7631
|
-
|
|
7632
7626
|
// @ts-ignore
|
|
7633
7627
|
const getNewEditor = async editor => {
|
|
7634
7628
|
return editor;
|
|
@@ -7717,12 +7711,12 @@ const save = async editor => {
|
|
|
7717
7711
|
} catch (error) {
|
|
7718
7712
|
// @ts-ignore
|
|
7719
7713
|
const betterError = new VError(error, `Failed to save file "${editor.uri}"`);
|
|
7720
|
-
await handleError(betterError);
|
|
7714
|
+
await handleError$1(betterError);
|
|
7721
7715
|
if (editor.platform === Electron) {
|
|
7722
7716
|
try {
|
|
7723
7717
|
await showSaveErrorDialog(betterError);
|
|
7724
7718
|
} catch (dialogError) {
|
|
7725
|
-
await handleError(dialogError);
|
|
7719
|
+
await handleError$1(dialogError);
|
|
7726
7720
|
}
|
|
7727
7721
|
}
|
|
7728
7722
|
return editor;
|
|
@@ -7780,42 +7774,6 @@ const editorSelectAllLeft = editor => {
|
|
|
7780
7774
|
editorSelectHorizontalLeft(editor, lineCharacterStart);
|
|
7781
7775
|
};
|
|
7782
7776
|
|
|
7783
|
-
const RE_ALPHA_NUMERIC = /[a-zA-Z\d]/;
|
|
7784
|
-
const isAlphaNumeric = char => {
|
|
7785
|
-
return RE_ALPHA_NUMERIC.test(char);
|
|
7786
|
-
};
|
|
7787
|
-
|
|
7788
|
-
const isWordChar = char => {
|
|
7789
|
-
return isAlphaNumeric(char) || char === '_';
|
|
7790
|
-
};
|
|
7791
|
-
const getWordStartIndex = (line, index) => {
|
|
7792
|
-
for (let i = index - 1; i >= 0; i--) {
|
|
7793
|
-
if (!isWordChar(line[i])) {
|
|
7794
|
-
return i + 1;
|
|
7795
|
-
}
|
|
7796
|
-
}
|
|
7797
|
-
return 0;
|
|
7798
|
-
};
|
|
7799
|
-
const getWordEndIndex = (line, index) => {
|
|
7800
|
-
for (let i = index; i < line.length; i++) {
|
|
7801
|
-
if (!isWordChar(line[i])) {
|
|
7802
|
-
return i;
|
|
7803
|
-
}
|
|
7804
|
-
}
|
|
7805
|
-
return line.length;
|
|
7806
|
-
};
|
|
7807
|
-
const getWordMatchAtPosition = (lines, rowIndex, columnIndex) => {
|
|
7808
|
-
const line = lines[rowIndex];
|
|
7809
|
-
const start = getWordStartIndex(line, columnIndex);
|
|
7810
|
-
const end = getWordEndIndex(line, columnIndex);
|
|
7811
|
-
const word = line.slice(start, end);
|
|
7812
|
-
return {
|
|
7813
|
-
end,
|
|
7814
|
-
start,
|
|
7815
|
-
word
|
|
7816
|
-
};
|
|
7817
|
-
};
|
|
7818
|
-
|
|
7819
7777
|
const isMultiLineMatch = (lines, rowIndex, wordParts) => {
|
|
7820
7778
|
let j = 0;
|
|
7821
7779
|
if (!lines[rowIndex + j].endsWith(wordParts[j])) {
|
|
@@ -8283,7 +8241,7 @@ const setLanguageId = async (editor, languageId, tokenizePath) => {
|
|
|
8283
8241
|
await loadTokenizer(languageId, tokenizePath);
|
|
8284
8242
|
const tokenizer = getTokenizer(languageId);
|
|
8285
8243
|
const newTokenizerId = tokenizerId + 1;
|
|
8286
|
-
set$
|
|
8244
|
+
set$4(newTokenizerId, tokenizer);
|
|
8287
8245
|
const latest = getEditor$1(editor.uid);
|
|
8288
8246
|
if (!latest) {
|
|
8289
8247
|
return editor;
|
|
@@ -8732,7 +8690,7 @@ const tabCompletion = async editor => {
|
|
|
8732
8690
|
}
|
|
8733
8691
|
return editorSnippet(editor, tabCompletion);
|
|
8734
8692
|
} catch (error) {
|
|
8735
|
-
await handleError(error);
|
|
8693
|
+
await handleError$1(error);
|
|
8736
8694
|
// TODO cursor should always be of type object
|
|
8737
8695
|
const rowIndex = editor.selections[0];
|
|
8738
8696
|
const columnIndex = editor.selections[1];
|
|
@@ -9469,7 +9427,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
9469
9427
|
focused: true,
|
|
9470
9428
|
widgets: removeEditorWidget(latest.widgets, widgetId)
|
|
9471
9429
|
};
|
|
9472
|
-
set$
|
|
9430
|
+
set$9(editor.uid, latest, newEditor);
|
|
9473
9431
|
return newEditor;
|
|
9474
9432
|
}
|
|
9475
9433
|
const newState = {
|
|
@@ -9477,7 +9435,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
9477
9435
|
commands
|
|
9478
9436
|
};
|
|
9479
9437
|
const newEditor = updateWidget(latest, widgetId, newState);
|
|
9480
|
-
set$
|
|
9438
|
+
set$9(editor.uid, latest, newEditor);
|
|
9481
9439
|
return newEditor;
|
|
9482
9440
|
};
|
|
9483
9441
|
return fn;
|
|
@@ -9492,6 +9450,7 @@ const createFns = (keys, name, widgetId) => {
|
|
|
9492
9450
|
|
|
9493
9451
|
const AppendToBody = 'Viewlet.appendToBody';
|
|
9494
9452
|
const Focus = 'focus';
|
|
9453
|
+
const FocusSelector = 'Viewlet.focusSelector';
|
|
9495
9454
|
const RegisterEventListeners = 'Viewlet.registerEventListeners';
|
|
9496
9455
|
const SetSelectionByName = 'Viewlet.setSelectionByName';
|
|
9497
9456
|
const SetValueByName = 'Viewlet.setValueByName';
|
|
@@ -9916,6 +9875,7 @@ const HandleScrollBarVerticalPointerDown = 30;
|
|
|
9916
9875
|
const HandleScrollBarVerticalPointerMove = 31;
|
|
9917
9876
|
const HandleScrollBarVerticalPointerUp = 32;
|
|
9918
9877
|
const HandleWheel = 33;
|
|
9878
|
+
const HandleKeyUp = 34;
|
|
9919
9879
|
|
|
9920
9880
|
const Div = 4;
|
|
9921
9881
|
const Input = 6;
|
|
@@ -10247,6 +10207,7 @@ const FocusFindWidgetCloseButton = 48;
|
|
|
10247
10207
|
const FocusFindWidgetNextMatchButton = 49;
|
|
10248
10208
|
const FocusFindWidgetPreviousMatchButton = 50;
|
|
10249
10209
|
const FocusEditorCodeGenerator = 52;
|
|
10210
|
+
const FocusColorPicker = 41;
|
|
10250
10211
|
|
|
10251
10212
|
const getPositionAtCursor = editorUid => {
|
|
10252
10213
|
const editor = getEditor$1(editorUid);
|
|
@@ -10302,7 +10263,7 @@ const setSelections2 = async (editorUid, selections) => {
|
|
|
10302
10263
|
selections
|
|
10303
10264
|
};
|
|
10304
10265
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
10305
|
-
set$
|
|
10266
|
+
set$9(editorUid, editor, newEditorWithDerivedState);
|
|
10306
10267
|
};
|
|
10307
10268
|
const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocus$1) => {
|
|
10308
10269
|
const editor = getEditor$1(editorUid);
|
|
@@ -10322,7 +10283,7 @@ const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocu
|
|
|
10322
10283
|
widgets: newWidgets
|
|
10323
10284
|
};
|
|
10324
10285
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
10325
|
-
set$
|
|
10286
|
+
set$9(editorUid, editor, newEditorWithDerivedState);
|
|
10326
10287
|
await setFocus(FocusEditorText);
|
|
10327
10288
|
if (unsetAdditionalFocus$1) {
|
|
10328
10289
|
await unsetAdditionalFocus(unsetAdditionalFocus$1);
|
|
@@ -10335,7 +10296,7 @@ const applyEdits2 = async (editorUid, edits) => {
|
|
|
10335
10296
|
const editor = getEditor$1(editorUid);
|
|
10336
10297
|
const newEditor = await applyEdit(editor, edits);
|
|
10337
10298
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
10338
|
-
set$
|
|
10299
|
+
set$9(editorUid, editor, newEditorWithDerivedState);
|
|
10339
10300
|
};
|
|
10340
10301
|
const getSourceActions = async editorUid => {
|
|
10341
10302
|
const actions = await getEditorSourceActions(editorUid);
|
|
@@ -10355,6 +10316,10 @@ const ensure = async (fontName, fontUrl) => {
|
|
|
10355
10316
|
|
|
10356
10317
|
const getKeyBindings = () => {
|
|
10357
10318
|
return [{
|
|
10319
|
+
command: 'Editor.closeColorPicker',
|
|
10320
|
+
key: Escape,
|
|
10321
|
+
when: FocusColorPicker
|
|
10322
|
+
}, {
|
|
10358
10323
|
command: 'Editor.closeSourceAction',
|
|
10359
10324
|
key: Escape,
|
|
10360
10325
|
when: FocusSourceActions
|
|
@@ -10913,7 +10878,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
10913
10878
|
messagePort: port
|
|
10914
10879
|
});
|
|
10915
10880
|
if (rpcId) {
|
|
10916
|
-
set$
|
|
10881
|
+
set$h(rpcId, rpc);
|
|
10917
10882
|
}
|
|
10918
10883
|
};
|
|
10919
10884
|
|
|
@@ -11064,7 +11029,7 @@ const hotReload = async () => {
|
|
|
11064
11029
|
await relaunchWorkers();
|
|
11065
11030
|
const newEditors = await restoreWidgetState(keys, savedStates);
|
|
11066
11031
|
for (const editor of newEditors) {
|
|
11067
|
-
set$
|
|
11032
|
+
set$9(editor.newState.uid, editor.oldState, editor.newState);
|
|
11068
11033
|
}
|
|
11069
11034
|
|
|
11070
11035
|
// TODO ask renderer worker to rerender all editors
|
|
@@ -11102,7 +11067,7 @@ const initializeSyntaxHighlighting = async (syntaxHighlightingEnabled, syncIncre
|
|
|
11102
11067
|
if (syntaxHighlightingEnabled) {
|
|
11103
11068
|
setEnabled$1(true);
|
|
11104
11069
|
const syntaxRpc = await createSyntaxHighlightingWorkerRpc();
|
|
11105
|
-
set$
|
|
11070
|
+
set$7(syntaxRpc);
|
|
11106
11071
|
}
|
|
11107
11072
|
if (syncIncremental) {
|
|
11108
11073
|
setEnabled(true);
|
|
@@ -11244,7 +11209,7 @@ const loadContent = async (state, savedState) => {
|
|
|
11244
11209
|
await loadTokenizer(computedLanguageId, tokenizePath);
|
|
11245
11210
|
const tokenizer = getTokenizer(computedLanguageId);
|
|
11246
11211
|
const newTokenizerId = state.tokenizerId + 1;
|
|
11247
|
-
set$
|
|
11212
|
+
set$4(newTokenizerId, tokenizer);
|
|
11248
11213
|
const newEditor0 = {
|
|
11249
11214
|
...state,
|
|
11250
11215
|
charWidth,
|
|
@@ -11439,11 +11404,11 @@ const renderCss$1 = (oldState, newState) => {
|
|
|
11439
11404
|
|
|
11440
11405
|
const renderFocus$2 = (oldState, newState) => {
|
|
11441
11406
|
const selector = '.EditorInput textarea';
|
|
11442
|
-
return [FocusSelector, newState.uid, selector];
|
|
11407
|
+
return [FocusSelector$1, newState.uid, selector];
|
|
11443
11408
|
};
|
|
11444
11409
|
|
|
11445
11410
|
const renderFocusContext$1 = (oldState, newState) => {
|
|
11446
|
-
return [SetFocusContext$1, newState.uid,
|
|
11411
|
+
return [SetFocusContext$1, newState.uid, newState.focus];
|
|
11447
11412
|
};
|
|
11448
11413
|
|
|
11449
11414
|
const SetText = 1;
|
|
@@ -11929,6 +11894,7 @@ const getEditorContentVirtualDom = ({
|
|
|
11929
11894
|
return [{
|
|
11930
11895
|
childCount: 5,
|
|
11931
11896
|
className: 'EditorContent',
|
|
11897
|
+
onKeyUp: HandleKeyUp,
|
|
11932
11898
|
onMouseMove: HandleMouseMove,
|
|
11933
11899
|
type: Div
|
|
11934
11900
|
}, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom()];
|
|
@@ -12072,7 +12038,7 @@ const render2 = (uid, diffResult) => {
|
|
|
12072
12038
|
newState,
|
|
12073
12039
|
oldState
|
|
12074
12040
|
} = get$7(uid);
|
|
12075
|
-
set$
|
|
12041
|
+
set$9(uid, newState, newState);
|
|
12076
12042
|
const commands = applyRender(oldState, newState, diffResult);
|
|
12077
12043
|
return commands;
|
|
12078
12044
|
};
|
|
@@ -12175,7 +12141,7 @@ const renderEditor = async id => {
|
|
|
12175
12141
|
oldState
|
|
12176
12142
|
} = instance;
|
|
12177
12143
|
const commands = [];
|
|
12178
|
-
set$
|
|
12144
|
+
set$9(id, newState, newState);
|
|
12179
12145
|
for (const item of render$7) {
|
|
12180
12146
|
if (item.isEqual(oldState, newState)) {
|
|
12181
12147
|
continue;
|
|
@@ -12198,6 +12164,9 @@ const renderEventListeners = () => {
|
|
|
12198
12164
|
}, {
|
|
12199
12165
|
name: HandleMouseMove,
|
|
12200
12166
|
params: ['handleMouseMove', ClientX, ClientY, AltKey]
|
|
12167
|
+
}, {
|
|
12168
|
+
name: HandleKeyUp,
|
|
12169
|
+
params: ['handleKeyUp', Key]
|
|
12201
12170
|
}, {
|
|
12202
12171
|
name: HandleBlur,
|
|
12203
12172
|
params: ['handleBlur']
|
|
@@ -12328,7 +12297,7 @@ const updateDebugInfo = async debugId => {
|
|
|
12328
12297
|
...newState,
|
|
12329
12298
|
highlightedLine: newInfo.rowIndex
|
|
12330
12299
|
};
|
|
12331
|
-
set$
|
|
12300
|
+
set$9(key, oldState, newEditor);
|
|
12332
12301
|
// @ts-ignore
|
|
12333
12302
|
await invoke$b('Editor.rerender', key);
|
|
12334
12303
|
};
|
|
@@ -12349,7 +12318,7 @@ const wrapCommand = fn => async (editorUid, ...args) => {
|
|
|
12349
12318
|
|
|
12350
12319
|
// TODO combine neweditor with latest editor?
|
|
12351
12320
|
|
|
12352
|
-
set$
|
|
12321
|
+
set$9(editorUid, state, newEditorWithDerivedState);
|
|
12353
12322
|
return newEditorWithDerivedState;
|
|
12354
12323
|
};
|
|
12355
12324
|
|
|
@@ -12366,6 +12335,7 @@ const commandMap = {
|
|
|
12366
12335
|
'Editor.braceCompletion': wrapCommand(braceCompletion),
|
|
12367
12336
|
'Editor.cancelSelection': wrapCommand(cancelSelection),
|
|
12368
12337
|
'Editor.closeCodeGenerator': wrapCommand(closeCodeGenerator),
|
|
12338
|
+
'Editor.closeColorPicker': wrapCommand(closeColorPicker),
|
|
12369
12339
|
'Editor.closeFind': wrapCommand(closeFind),
|
|
12370
12340
|
'Editor.closeFind2': closeFind2,
|
|
12371
12341
|
'Editor.closeRename': wrapCommand(closeRename),
|
|
@@ -12443,6 +12413,7 @@ const commandMap = {
|
|
|
12443
12413
|
'Editor.handleContextMenu': wrapCommand(handleContextMenu),
|
|
12444
12414
|
'Editor.handleDoubleClick': wrapCommand(handleDoubleClick),
|
|
12445
12415
|
'Editor.handleFocus': wrapCommand(handleFocus$1),
|
|
12416
|
+
'Editor.handleKeyUp': wrapCommand(handleKeyUp),
|
|
12446
12417
|
'Editor.handleMouseDown': wrapCommand(handleMouseDown),
|
|
12447
12418
|
'Editor.handleMouseMove': wrapCommand(handleMouseMove),
|
|
12448
12419
|
'Editor.handleMouseMoveWithAltKey': wrapCommand(handleMouseMoveWithAltKey),
|
|
@@ -12619,6 +12590,16 @@ for (const [key, value] of Object.entries(commandMap)) {
|
|
|
12619
12590
|
}
|
|
12620
12591
|
}
|
|
12621
12592
|
|
|
12593
|
+
const initializeErrorWorker = async () => {
|
|
12594
|
+
const rpc = await create$c({
|
|
12595
|
+
commandMap: {},
|
|
12596
|
+
send(port) {
|
|
12597
|
+
return sendMessagePortToErrorWorker(port, EditorWorker);
|
|
12598
|
+
}
|
|
12599
|
+
});
|
|
12600
|
+
set$g(rpc);
|
|
12601
|
+
};
|
|
12602
|
+
|
|
12622
12603
|
const createExtensionHostRpc = async () => {
|
|
12623
12604
|
const initialCommand = 'HandleMessagePort.handleMessagePort2';
|
|
12624
12605
|
const rpc = await create$c({
|
|
@@ -12632,7 +12613,7 @@ const createExtensionHostRpc = async () => {
|
|
|
12632
12613
|
|
|
12633
12614
|
const initializeExtensionHost = async () => {
|
|
12634
12615
|
const extensionHostRpc = await createExtensionHostRpc();
|
|
12635
|
-
set$
|
|
12616
|
+
set$3(extensionHostRpc);
|
|
12636
12617
|
};
|
|
12637
12618
|
|
|
12638
12619
|
const createExtensionManagementWorkerRpc = async () => {
|
|
@@ -12648,7 +12629,7 @@ const createExtensionManagementWorkerRpc = async () => {
|
|
|
12648
12629
|
const initializeExtensionManagementWorker = async () => {
|
|
12649
12630
|
try {
|
|
12650
12631
|
const rpc = await createExtensionManagementWorkerRpc();
|
|
12651
|
-
set$
|
|
12632
|
+
set$e(rpc);
|
|
12652
12633
|
} catch {
|
|
12653
12634
|
// ignore
|
|
12654
12635
|
}
|
|
@@ -12663,14 +12644,14 @@ const initializeOpenerWorker = async () => {
|
|
|
12663
12644
|
commandMap: {},
|
|
12664
12645
|
send: send$1
|
|
12665
12646
|
});
|
|
12666
|
-
set$
|
|
12647
|
+
set$d(rpc);
|
|
12667
12648
|
};
|
|
12668
12649
|
|
|
12669
12650
|
const initializeRendererWorker = async () => {
|
|
12670
12651
|
const rpc = await create$a({
|
|
12671
12652
|
commandMap: commandMap
|
|
12672
12653
|
});
|
|
12673
|
-
set$
|
|
12654
|
+
set$b(rpc);
|
|
12674
12655
|
};
|
|
12675
12656
|
|
|
12676
12657
|
const send = port => {
|
|
@@ -12681,12 +12662,12 @@ const initializeTextMeasurementWorker = async () => {
|
|
|
12681
12662
|
commandMap: {},
|
|
12682
12663
|
send
|
|
12683
12664
|
});
|
|
12684
|
-
set$
|
|
12665
|
+
set$c(rpc);
|
|
12685
12666
|
};
|
|
12686
12667
|
|
|
12687
12668
|
const listen = async () => {
|
|
12688
12669
|
registerCommands(commandMap);
|
|
12689
|
-
await Promise.all([initializeRendererWorker(), initializeExtensionHost(), initializeExtensionManagementWorker(), initializeTextMeasurementWorker(), initializeOpenerWorker()]);
|
|
12670
|
+
await Promise.all([initializeRendererWorker(), initializeErrorWorker(), initializeExtensionHost(), initializeExtensionManagementWorker(), initializeTextMeasurementWorker(), initializeOpenerWorker()]);
|
|
12690
12671
|
};
|
|
12691
12672
|
|
|
12692
12673
|
const CodeGeneratorInput = 'CodeGeneratorInput';
|
|
@@ -12780,7 +12761,7 @@ const renderFull$1 = (oldState, newState) => {
|
|
|
12780
12761
|
return commands;
|
|
12781
12762
|
};
|
|
12782
12763
|
|
|
12783
|
-
const commandsToForward$1 = [SetDom2, SetCss, AppendToBody, SetBounds2, RegisterEventListeners, SetUid];
|
|
12764
|
+
const commandsToForward$1 = [SetDom2, SetCss, AppendToBody, FocusSelector, SetBounds2, RegisterEventListeners, SetUid];
|
|
12784
12765
|
const render$4 = widget => {
|
|
12785
12766
|
const commands = renderFull$1(widget.oldState, widget.newState);
|
|
12786
12767
|
const wrappedCommands = [];
|
|
@@ -12992,15 +12973,15 @@ const EditorMessageWidget = {
|
|
|
12992
12973
|
};
|
|
12993
12974
|
|
|
12994
12975
|
const registerWidgets = () => {
|
|
12995
|
-
set$
|
|
12996
|
-
set$
|
|
12997
|
-
set$
|
|
12998
|
-
set$
|
|
12999
|
-
set$
|
|
13000
|
-
set$
|
|
13001
|
-
set$
|
|
13002
|
-
set$
|
|
13003
|
-
set$
|
|
12976
|
+
set$8(ColorPicker$1, EditorColorPickerWidget);
|
|
12977
|
+
set$8(Completion, EditorCompletionWidget);
|
|
12978
|
+
set$8(CompletionDetail, EditorCompletionDetailWidget);
|
|
12979
|
+
set$8(Find, EditorFindWidget);
|
|
12980
|
+
set$8(Hover, EditorHoverWidget);
|
|
12981
|
+
set$8(Message, EditorMessageWidget);
|
|
12982
|
+
set$8(Rename$1, EditorRenameWidget);
|
|
12983
|
+
set$8(SourceAction$1, EditorSourceActionWidget);
|
|
12984
|
+
set$8(CodeGenerator, EditorCodeGeneratorWidget);
|
|
13004
12985
|
};
|
|
13005
12986
|
|
|
13006
12987
|
const handleUnhandledRejection = event => {
|