@lvce-editor/editor-worker 13.4.0 → 14.0.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 +202 -126
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -903,7 +903,7 @@ const send$1 = (transport, method, ...params) => {
|
|
|
903
903
|
const message = create$4$2(method, params);
|
|
904
904
|
transport.send(message);
|
|
905
905
|
};
|
|
906
|
-
const invoke$
|
|
906
|
+
const invoke$d = (ipc, method, ...params) => {
|
|
907
907
|
return invokeHelper(ipc, method, params, false);
|
|
908
908
|
};
|
|
909
909
|
const invokeAndTransfer$3 = (ipc, method, ...params) => {
|
|
@@ -942,7 +942,7 @@ const createRpc = ipc => {
|
|
|
942
942
|
send$1(ipc, method, ...params);
|
|
943
943
|
},
|
|
944
944
|
invoke(method, ...params) {
|
|
945
|
-
return invoke$
|
|
945
|
+
return invoke$d(ipc, method, ...params);
|
|
946
946
|
},
|
|
947
947
|
invokeAndTransfer(method, ...params) {
|
|
948
948
|
return invokeAndTransfer$3(ipc, method, ...params);
|
|
@@ -1130,6 +1130,12 @@ const CtrlCmd = 1 << 11 >>> 0;
|
|
|
1130
1130
|
const Shift = 1 << 10 >>> 0;
|
|
1131
1131
|
const Alt$1 = 1 << 9 >>> 0;
|
|
1132
1132
|
|
|
1133
|
+
const Editor$1 = 3;
|
|
1134
|
+
const SourceControl = 22;
|
|
1135
|
+
|
|
1136
|
+
const Separator = 1;
|
|
1137
|
+
const None = 0;
|
|
1138
|
+
|
|
1133
1139
|
const CompletionWorker = 301;
|
|
1134
1140
|
const DebugWorker = 55;
|
|
1135
1141
|
const EditorWorker = 99;
|
|
@@ -1176,22 +1182,22 @@ const create$9 = rpcId => {
|
|
|
1176
1182
|
};
|
|
1177
1183
|
|
|
1178
1184
|
const {
|
|
1179
|
-
invoke: invoke$
|
|
1185
|
+
invoke: invoke$c,
|
|
1180
1186
|
invokeAndTransfer: invokeAndTransfer$2,
|
|
1181
1187
|
set: set$a,
|
|
1182
1188
|
dispose: dispose$2
|
|
1183
1189
|
} = create$9(ExtensionHostWorker);
|
|
1184
1190
|
const executeReferenceProvider = async (id, offset) => {
|
|
1185
1191
|
// @ts-ignore
|
|
1186
|
-
return invoke$
|
|
1192
|
+
return invoke$c('ExtensionHostReference.executeReferenceProvider', id, offset);
|
|
1187
1193
|
};
|
|
1188
1194
|
const executeFileReferenceProvider = async id => {
|
|
1189
1195
|
// @ts-ignore
|
|
1190
|
-
return invoke$
|
|
1196
|
+
return invoke$c('ExtensionHostReference.executeFileReferenceProvider', id);
|
|
1191
1197
|
};
|
|
1192
1198
|
const getRuntimeStatus = async extensionId => {
|
|
1193
1199
|
// @ts-ignore
|
|
1194
|
-
return invoke$
|
|
1200
|
+
return invoke$c('ExtensionHost.getRuntimeStatus', extensionId);
|
|
1195
1201
|
};
|
|
1196
1202
|
const registerMockRpc = commandMap => {
|
|
1197
1203
|
const mockRpc = createMockRpc({
|
|
@@ -1207,16 +1213,24 @@ const ExtensionHost = {
|
|
|
1207
1213
|
executeFileReferenceProvider,
|
|
1208
1214
|
executeReferenceProvider,
|
|
1209
1215
|
getRuntimeStatus,
|
|
1210
|
-
invoke: invoke$
|
|
1216
|
+
invoke: invoke$c,
|
|
1211
1217
|
invokeAndTransfer: invokeAndTransfer$2,
|
|
1212
1218
|
registerMockRpc,
|
|
1213
1219
|
set: set$a
|
|
1214
1220
|
};
|
|
1215
1221
|
|
|
1216
1222
|
const {
|
|
1217
|
-
invoke: invoke$
|
|
1223
|
+
invoke: invoke$b,
|
|
1218
1224
|
invokeAndTransfer: invokeAndTransfer$1,
|
|
1219
1225
|
set: set$9} = create$9(RendererWorker);
|
|
1226
|
+
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1227
|
+
number(uid);
|
|
1228
|
+
number(menuId);
|
|
1229
|
+
number(x);
|
|
1230
|
+
number(y);
|
|
1231
|
+
// @ts-ignore
|
|
1232
|
+
await invoke$b('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1233
|
+
};
|
|
1220
1234
|
const sendMessagePortToTextMeasurementWorker = async port => {
|
|
1221
1235
|
const command = 'TextMeasurement.handleMessagePort';
|
|
1222
1236
|
// @ts-ignore
|
|
@@ -1224,7 +1238,7 @@ const sendMessagePortToTextMeasurementWorker = async port => {
|
|
|
1224
1238
|
};
|
|
1225
1239
|
|
|
1226
1240
|
const {
|
|
1227
|
-
invoke: invoke$
|
|
1241
|
+
invoke: invoke$a,
|
|
1228
1242
|
invokeAndTransfer,
|
|
1229
1243
|
set: set$8,
|
|
1230
1244
|
dispose: dispose$1
|
|
@@ -1233,7 +1247,7 @@ const {
|
|
|
1233
1247
|
const SyntaxHighlightingWorker = {
|
|
1234
1248
|
__proto__: null,
|
|
1235
1249
|
dispose: dispose$1,
|
|
1236
|
-
invoke: invoke$
|
|
1250
|
+
invoke: invoke$a,
|
|
1237
1251
|
invokeAndTransfer,
|
|
1238
1252
|
set: set$8
|
|
1239
1253
|
};
|
|
@@ -1265,7 +1279,7 @@ const createLazyRpc = rpcId => {
|
|
|
1265
1279
|
|
|
1266
1280
|
// TODO add tests for this
|
|
1267
1281
|
const activateByEvent = async event => {
|
|
1268
|
-
await invoke$
|
|
1282
|
+
await invoke$b('ExtensionHostManagement.activateByEvent', event);
|
|
1269
1283
|
};
|
|
1270
1284
|
|
|
1271
1285
|
const codeGeneratorAccept = state => {
|
|
@@ -1319,14 +1333,14 @@ const launchColorPickerWorker = async () => {
|
|
|
1319
1333
|
};
|
|
1320
1334
|
|
|
1321
1335
|
let workerPromise$3;
|
|
1322
|
-
const getOrCreate$
|
|
1336
|
+
const getOrCreate$3 = () => {
|
|
1323
1337
|
if (!workerPromise$3) {
|
|
1324
1338
|
workerPromise$3 = launchColorPickerWorker();
|
|
1325
1339
|
}
|
|
1326
1340
|
return workerPromise$3;
|
|
1327
1341
|
};
|
|
1328
|
-
const invoke$
|
|
1329
|
-
const worker = await getOrCreate$
|
|
1342
|
+
const invoke$9 = async (method, ...params) => {
|
|
1343
|
+
const worker = await getOrCreate$3();
|
|
1330
1344
|
return await worker.invoke(method, ...params);
|
|
1331
1345
|
};
|
|
1332
1346
|
|
|
@@ -1338,10 +1352,10 @@ const loadContent$2 = async (state, parentUid) => {
|
|
|
1338
1352
|
width,
|
|
1339
1353
|
height
|
|
1340
1354
|
} = state;
|
|
1341
|
-
await invoke$
|
|
1342
|
-
await invoke$
|
|
1343
|
-
const diff = await invoke$
|
|
1344
|
-
const commands = await invoke$
|
|
1355
|
+
await invoke$9('ColorPicker.create', uid, x, y, width, height, parentUid);
|
|
1356
|
+
await invoke$9('ColorPicker.loadContent', uid);
|
|
1357
|
+
const diff = await invoke$9('ColorPicker.diff2', uid);
|
|
1358
|
+
const commands = await invoke$9('ColorPicker.render2', uid, diff);
|
|
1345
1359
|
return {
|
|
1346
1360
|
...state,
|
|
1347
1361
|
commands
|
|
@@ -1536,7 +1550,7 @@ const getInitialLineState = initialLineState => {
|
|
|
1536
1550
|
return deepCopy(initialLineState);
|
|
1537
1551
|
};
|
|
1538
1552
|
|
|
1539
|
-
const state$
|
|
1553
|
+
const state$7 = {
|
|
1540
1554
|
warned: []
|
|
1541
1555
|
};
|
|
1542
1556
|
const flattenTokensArray = tokens => {
|
|
@@ -1548,10 +1562,10 @@ const flattenTokensArray = tokens => {
|
|
|
1548
1562
|
return flattened;
|
|
1549
1563
|
};
|
|
1550
1564
|
const warnDeprecatedArrayReturn = (languageId, fn) => {
|
|
1551
|
-
if (state$
|
|
1565
|
+
if (state$7.warned.includes(fn)) {
|
|
1552
1566
|
return;
|
|
1553
1567
|
}
|
|
1554
|
-
state$
|
|
1568
|
+
state$7.warned.push(fn);
|
|
1555
1569
|
console.warn(`tokenizers without hasArrayReturn=false are deprecated (language ${languageId})`);
|
|
1556
1570
|
};
|
|
1557
1571
|
const safeTokenizeLine = (languageId, tokenizeLine, line, lineStateAtStart, hasArrayReturn) => {
|
|
@@ -1622,22 +1636,22 @@ const getEnabled$1 = () => {
|
|
|
1622
1636
|
|
|
1623
1637
|
const {
|
|
1624
1638
|
set: set$5,
|
|
1625
|
-
invoke: invoke$
|
|
1639
|
+
invoke: invoke$8} = SyntaxHighlightingWorker;
|
|
1626
1640
|
|
|
1627
|
-
const state$
|
|
1641
|
+
const state$6 = {
|
|
1628
1642
|
tokenizers: Object.create(null),
|
|
1629
1643
|
pending: Object.create(null)};
|
|
1630
1644
|
const has = languageId => {
|
|
1631
|
-
return languageId in state$
|
|
1645
|
+
return languageId in state$6.tokenizers;
|
|
1632
1646
|
};
|
|
1633
1647
|
const set$4 = (languageId, tokenizer) => {
|
|
1634
|
-
state$
|
|
1648
|
+
state$6.tokenizers[languageId] = tokenizer;
|
|
1635
1649
|
};
|
|
1636
1650
|
const get$4 = languageId => {
|
|
1637
|
-
return state$
|
|
1651
|
+
return state$6.tokenizers[languageId];
|
|
1638
1652
|
};
|
|
1639
1653
|
const isPending = languageId => {
|
|
1640
|
-
return languageId in state$
|
|
1654
|
+
return languageId in state$6.pending;
|
|
1641
1655
|
};
|
|
1642
1656
|
|
|
1643
1657
|
const tokenMaps = Object.create(null);
|
|
@@ -1655,7 +1669,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
1655
1669
|
}
|
|
1656
1670
|
if (getEnabled$1()) {
|
|
1657
1671
|
// @ts-ignore
|
|
1658
|
-
const tokenMap = await invoke$
|
|
1672
|
+
const tokenMap = await invoke$8('Tokenizer.load', languageId, tokenizePath);
|
|
1659
1673
|
set$3(languageId, tokenMap);
|
|
1660
1674
|
return;
|
|
1661
1675
|
}
|
|
@@ -1831,13 +1845,13 @@ const getTokensViewport2 = async (editor, startLineIndex, endLineIndex, syncIncr
|
|
|
1831
1845
|
languageId,
|
|
1832
1846
|
invalidStartIndex
|
|
1833
1847
|
};
|
|
1834
|
-
return invoke$
|
|
1848
|
+
return invoke$8('GetTokensViewport.getTokensViewport', slimEditor,
|
|
1835
1849
|
// @ts-ignore
|
|
1836
1850
|
startLineIndex, endLineIndex, hasLinesToSend, id, linesToSend);
|
|
1837
1851
|
}
|
|
1838
1852
|
// TODO only send needed lines of text
|
|
1839
1853
|
// @ts-ignore
|
|
1840
|
-
return invoke$
|
|
1854
|
+
return invoke$8('GetTokensViewport.getTokensViewport', editor, startLineIndex, endLineIndex, true, editor.id, editor.lines);
|
|
1841
1855
|
}
|
|
1842
1856
|
return getTokensViewport(editor, startLineIndex, endLineIndex);
|
|
1843
1857
|
};
|
|
@@ -2400,7 +2414,7 @@ const getIncrementalEdits = async (oldState, newState) => {
|
|
|
2400
2414
|
const oldLine = oldState.lines[rowIndex];
|
|
2401
2415
|
const newLine = lines[rowIndex];
|
|
2402
2416
|
// @ts-ignore
|
|
2403
|
-
const incrementalEdits = await invoke$
|
|
2417
|
+
const incrementalEdits = await invoke$8(
|
|
2404
2418
|
// @ts-ignore
|
|
2405
2419
|
'TokenizeIncremental.tokenizeIncremental', newState.uid,
|
|
2406
2420
|
// @ts-ignore
|
|
@@ -2450,60 +2464,13 @@ const measureTextWidthFast = async (text, charWidth) => {
|
|
|
2450
2464
|
return text.length * charWidth;
|
|
2451
2465
|
};
|
|
2452
2466
|
|
|
2453
|
-
const
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
const getLetterSpacingString = letterSpacing => {
|
|
2458
|
-
return `${letterSpacing}px`;
|
|
2459
|
-
};
|
|
2460
|
-
|
|
2461
|
-
const createMeasureContext = () => {
|
|
2462
|
-
const canvas = new OffscreenCanvas(0, 0);
|
|
2463
|
-
const ctx = /** @type {OffscreenCanvasRenderingContext2D} */canvas.getContext('2d');
|
|
2464
|
-
if (!ctx) {
|
|
2465
|
-
throw new Error('Failed to get canvas context 2d');
|
|
2466
|
-
}
|
|
2467
|
-
return ctx;
|
|
2468
|
-
};
|
|
2469
|
-
|
|
2470
|
-
const state$6 = {
|
|
2471
|
-
ctx: undefined
|
|
2472
|
-
};
|
|
2473
|
-
const getOrCreate$3 = createCtx => {
|
|
2474
|
-
if (state$6.ctx) {
|
|
2475
|
-
return state$6.ctx;
|
|
2476
|
-
}
|
|
2477
|
-
state$6.ctx = createCtx();
|
|
2478
|
-
return state$6.ctx;
|
|
2479
|
-
};
|
|
2480
|
-
|
|
2481
|
-
const getContext = () => {
|
|
2482
|
-
const ctx = getOrCreate$3(createMeasureContext);
|
|
2483
|
-
return ctx;
|
|
2484
|
-
};
|
|
2485
|
-
|
|
2486
|
-
// TODO for text editor, could dispose measuring canvas after editor has been initialized to free up offscreencanvas space
|
|
2467
|
+
const {
|
|
2468
|
+
invoke: invoke$7,
|
|
2469
|
+
setFactory: setFactory$1
|
|
2470
|
+
} = createLazyRpc(TextMeasurementWorker);
|
|
2487
2471
|
|
|
2488
2472
|
const measureTextWidthSlow = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
2489
|
-
|
|
2490
|
-
number(fontWeight);
|
|
2491
|
-
number(fontSize);
|
|
2492
|
-
string(fontFamily);
|
|
2493
|
-
boolean(isMonoSpaceFont);
|
|
2494
|
-
number(charWidth);
|
|
2495
|
-
if (typeof letterSpacing !== 'number') {
|
|
2496
|
-
throw new TypeError('letterSpacing must be of type number');
|
|
2497
|
-
}
|
|
2498
|
-
const letterSpacingString = getLetterSpacingString(letterSpacing);
|
|
2499
|
-
const fontString = getFontString(fontWeight, fontSize, fontFamily);
|
|
2500
|
-
const ctx = getContext();
|
|
2501
|
-
ctx.letterSpacing = letterSpacingString;
|
|
2502
|
-
ctx.font = fontString;
|
|
2503
|
-
const metrics = ctx.measureText(text);
|
|
2504
|
-
const {
|
|
2505
|
-
width
|
|
2506
|
-
} = metrics;
|
|
2473
|
+
const width = await invoke$7('TextMeasurement.measureTextWidth', text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
|
|
2507
2474
|
return width;
|
|
2508
2475
|
};
|
|
2509
2476
|
|
|
@@ -3152,7 +3119,7 @@ const measureCharacterWidth = async (fontWeight, fontSize, fontFamily, letterSpa
|
|
|
3152
3119
|
};
|
|
3153
3120
|
|
|
3154
3121
|
const get$1 = async key => {
|
|
3155
|
-
const value = await invoke$
|
|
3122
|
+
const value = await invoke$b('Preferences.get', key);
|
|
3156
3123
|
return value;
|
|
3157
3124
|
};
|
|
3158
3125
|
|
|
@@ -3252,7 +3219,7 @@ const updateDiagnostics = async newState => {
|
|
|
3252
3219
|
};
|
|
3253
3220
|
set$6(newState.id, latest.oldState, newEditor);
|
|
3254
3221
|
// @ts-ignore
|
|
3255
|
-
await invoke$
|
|
3222
|
+
await invoke$b('Editor.rerender', newState.id);
|
|
3256
3223
|
return newEditor;
|
|
3257
3224
|
} catch (error) {
|
|
3258
3225
|
// @ts-ignore
|
|
@@ -3405,7 +3372,7 @@ const createEditor = async ({
|
|
|
3405
3372
|
};
|
|
3406
3373
|
|
|
3407
3374
|
// @ts-ignore
|
|
3408
|
-
const getNewSelections$
|
|
3375
|
+
const getNewSelections$c = selections => {
|
|
3409
3376
|
const newSelections = [];
|
|
3410
3377
|
for (let i = 0; i < selections.length; i += 4) {
|
|
3411
3378
|
const startRowIndex = selections[i];
|
|
@@ -3425,7 +3392,7 @@ const addCursorAbove = editor => {
|
|
|
3425
3392
|
const {
|
|
3426
3393
|
selections
|
|
3427
3394
|
} = editor;
|
|
3428
|
-
const newSelections = getNewSelections$
|
|
3395
|
+
const newSelections = getNewSelections$c(selections);
|
|
3429
3396
|
return {
|
|
3430
3397
|
...editor,
|
|
3431
3398
|
selections: newSelections
|
|
@@ -3433,7 +3400,7 @@ const addCursorAbove = editor => {
|
|
|
3433
3400
|
};
|
|
3434
3401
|
|
|
3435
3402
|
// @ts-ignore
|
|
3436
|
-
const getNewSelections$
|
|
3403
|
+
const getNewSelections$b = (selections, linesLength) => {
|
|
3437
3404
|
const newSelections = [];
|
|
3438
3405
|
for (let i = 0; i < selections.length; i += 4) {
|
|
3439
3406
|
const startRowIndex = selections[i];
|
|
@@ -3454,7 +3421,7 @@ const addCursorBelow = editor => {
|
|
|
3454
3421
|
selections,
|
|
3455
3422
|
lines
|
|
3456
3423
|
} = editor;
|
|
3457
|
-
const newSelections = getNewSelections$
|
|
3424
|
+
const newSelections = getNewSelections$b(selections, lines.length);
|
|
3458
3425
|
return {
|
|
3459
3426
|
...editor,
|
|
3460
3427
|
selections: newSelections
|
|
@@ -3783,7 +3750,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, isError
|
|
|
3783
3750
|
const y$1 = y(editor, rowIndex);
|
|
3784
3751
|
const displayErrorMessage = message;
|
|
3785
3752
|
// @ts-ignore
|
|
3786
|
-
await invoke$
|
|
3753
|
+
await invoke$b('Editor.showOverlayMessage', editor, 'Viewlet.send', editor.uid, 'showOverlayMessage', x$1, y$1, displayErrorMessage);
|
|
3787
3754
|
if (!isError) {
|
|
3788
3755
|
const handleTimeout = () => {
|
|
3789
3756
|
editorHideMessage(editor);
|
|
@@ -3840,7 +3807,7 @@ const braceCompletion = async (editor, text) => {
|
|
|
3840
3807
|
// @ts-ignore
|
|
3841
3808
|
const offset = offsetAt(editor, editor.cursor);
|
|
3842
3809
|
// @ts-ignore
|
|
3843
|
-
const result = await invoke$
|
|
3810
|
+
const result = await invoke$b('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
|
|
3844
3811
|
if (result) {
|
|
3845
3812
|
const closingBrace = getMatchingClosingBrace$1(text);
|
|
3846
3813
|
const insertText = text + closingBrace;
|
|
@@ -4108,7 +4075,7 @@ const compositionEnd = (editor, data) => {
|
|
|
4108
4075
|
const writeText = async text => {
|
|
4109
4076
|
try {
|
|
4110
4077
|
string(text);
|
|
4111
|
-
await invoke$
|
|
4078
|
+
await invoke$b('ClipBoard.writeText', /* text */text);
|
|
4112
4079
|
} catch (error) {
|
|
4113
4080
|
throw new VError(error, 'Failed to write text to clipboard');
|
|
4114
4081
|
}
|
|
@@ -4147,7 +4114,7 @@ const shouldCopyFullLine = (startRowIndex, startColumnIndex, endRowIndex, endCol
|
|
|
4147
4114
|
};
|
|
4148
4115
|
|
|
4149
4116
|
// @ts-ignore
|
|
4150
|
-
const copy = async editor => {
|
|
4117
|
+
const copy$1 = async editor => {
|
|
4151
4118
|
if (!hasSelection(editor)) {
|
|
4152
4119
|
// TODO copy line where cursor is
|
|
4153
4120
|
return editor;
|
|
@@ -4262,7 +4229,7 @@ const moveToPositionLeft = (selections, i, rowIndex, columnIndex, lines, getDelt
|
|
|
4262
4229
|
// @ts-ignore
|
|
4263
4230
|
|
|
4264
4231
|
// @ts-ignore
|
|
4265
|
-
const getNewSelections$
|
|
4232
|
+
const getNewSelections$a = (selections, lines, getDelta) => {
|
|
4266
4233
|
const newSelections = new Uint32Array(selections.length);
|
|
4267
4234
|
for (let i = 0; i < selections.length; i += 4) {
|
|
4268
4235
|
const [selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn] = getSelectionPairs(selections, i);
|
|
@@ -4289,7 +4256,7 @@ const editorCursorHorizontalLeft = (editor, getDelta) => {
|
|
|
4289
4256
|
lines,
|
|
4290
4257
|
selections
|
|
4291
4258
|
} = editor;
|
|
4292
|
-
const newSelections = getNewSelections$
|
|
4259
|
+
const newSelections = getNewSelections$a(selections, lines, getDelta);
|
|
4293
4260
|
return scheduleSelections(editor, newSelections);
|
|
4294
4261
|
};
|
|
4295
4262
|
|
|
@@ -4437,7 +4404,7 @@ const moveToPositionRight = (selections, i, rowIndex, columnIndex, lines, getDel
|
|
|
4437
4404
|
}
|
|
4438
4405
|
};
|
|
4439
4406
|
|
|
4440
|
-
const
|
|
4407
|
+
const getNewSelectionsWordRight = (selections, lines, getDelta) => {
|
|
4441
4408
|
const newSelections = new Uint32Array(selections.length);
|
|
4442
4409
|
for (let i = 0; i < selections.length; i += 4) {
|
|
4443
4410
|
const [selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn] = getSelectionPairs(selections, i);
|
|
@@ -4450,12 +4417,13 @@ const getNewSelections$a = (selections, lines, getDelta) => {
|
|
|
4450
4417
|
}
|
|
4451
4418
|
return newSelections;
|
|
4452
4419
|
};
|
|
4420
|
+
|
|
4453
4421
|
const editorCursorHorizontalRight = (editor, getDelta) => {
|
|
4454
4422
|
const {
|
|
4455
4423
|
lines,
|
|
4456
4424
|
selections
|
|
4457
4425
|
} = editor;
|
|
4458
|
-
const newSelections =
|
|
4426
|
+
const newSelections = getNewSelectionsWordRight(selections, lines, getDelta);
|
|
4459
4427
|
return scheduleSelections(editor, newSelections);
|
|
4460
4428
|
};
|
|
4461
4429
|
|
|
@@ -4568,7 +4536,7 @@ const cutSelectedText = async editor => {
|
|
|
4568
4536
|
return scheduleDocumentAndCursorsSelections(editor, changes, selectionChanges);
|
|
4569
4537
|
};
|
|
4570
4538
|
|
|
4571
|
-
const cut = async editor => {
|
|
4539
|
+
const cut$1 = async editor => {
|
|
4572
4540
|
const {
|
|
4573
4541
|
selections
|
|
4574
4542
|
} = editor;
|
|
@@ -4743,9 +4711,9 @@ const deleteWordRight = editor => {
|
|
|
4743
4711
|
return editorDeleteHorizontalRight(editor, wordRight);
|
|
4744
4712
|
};
|
|
4745
4713
|
|
|
4746
|
-
const findAllReferences = async editor => {
|
|
4714
|
+
const findAllReferences$1 = async editor => {
|
|
4747
4715
|
// @ts-ignore
|
|
4748
|
-
await invoke$
|
|
4716
|
+
await invoke$b('SideBar.show', 'References', /* focus */true);
|
|
4749
4717
|
return editor;
|
|
4750
4718
|
};
|
|
4751
4719
|
|
|
@@ -4833,7 +4801,7 @@ const getWordBefore = (editor, rowIndex, columnIndex) => {
|
|
|
4833
4801
|
// @ts-ignore
|
|
4834
4802
|
const getDefinition = async (editor, offset) => {
|
|
4835
4803
|
// @ts-ignore
|
|
4836
|
-
const definition = await invoke$
|
|
4804
|
+
const definition = await invoke$b('ExtensionHostDefinition.executeDefinitionProvider', editor, offset);
|
|
4837
4805
|
return definition;
|
|
4838
4806
|
};
|
|
4839
4807
|
|
|
@@ -4849,6 +4817,8 @@ const i18nString = (key, placeholders = emptyObject) => {
|
|
|
4849
4817
|
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
4850
4818
|
};
|
|
4851
4819
|
|
|
4820
|
+
const Copy = 'Copy';
|
|
4821
|
+
const Cut = 'Cut';
|
|
4852
4822
|
const EditorCloseColorPicker = 'Editor: Close Color Picker';
|
|
4853
4823
|
const EditorCopyLineDown = 'Editor: Copy Line Down';
|
|
4854
4824
|
const EditorCopyLineUp = 'Editor: Copy Line Up';
|
|
@@ -4868,16 +4838,24 @@ const EditorToggleComment = 'Editor: Toggle Comment';
|
|
|
4868
4838
|
const EditorUnindent = 'Editor: Unindent';
|
|
4869
4839
|
const EnterCode = 'Enter Code';
|
|
4870
4840
|
const EscapeToClose = 'Escape to close';
|
|
4841
|
+
const FindAllImplementations = 'Find All Implementations';
|
|
4842
|
+
const FindAllReferences = 'Find All References';
|
|
4871
4843
|
const FormatDocument = 'Format Document';
|
|
4844
|
+
const GoToDefinition = 'Go to Definition';
|
|
4845
|
+
const GoToTypeDefinition = 'Go to Type Definition';
|
|
4872
4846
|
const MoveLineDown = 'Move Line Down';
|
|
4873
4847
|
const MoveLineUp = 'Move Line Up';
|
|
4874
4848
|
const NoDefinitionFound = 'No definition found';
|
|
4875
4849
|
const NoDefinitionFoundFor = "No definition found for '{PH1}'";
|
|
4876
4850
|
const NoTypeDefinitionFound = 'No type definition found';
|
|
4877
4851
|
const NoTypeDefinitionFoundFor = "No type definition found for '{PH1}'";
|
|
4852
|
+
const Paste = 'Paste';
|
|
4878
4853
|
const SourceAction = 'Source Action';
|
|
4879
4854
|
const ToggleBlockComment = 'Toggle Block Comment';
|
|
4880
4855
|
|
|
4856
|
+
const goToDefinition$1 = () => {
|
|
4857
|
+
return i18nString(GoToDefinition);
|
|
4858
|
+
};
|
|
4881
4859
|
const noDefinitionFound = () => {
|
|
4882
4860
|
return i18nString(NoDefinitionFound);
|
|
4883
4861
|
};
|
|
@@ -4903,6 +4881,24 @@ const escapeToClose = () => {
|
|
|
4903
4881
|
const enterCode = () => {
|
|
4904
4882
|
return i18nString(EnterCode);
|
|
4905
4883
|
};
|
|
4884
|
+
const goToTypeDefinition$1 = () => {
|
|
4885
|
+
return i18nString(GoToTypeDefinition);
|
|
4886
|
+
};
|
|
4887
|
+
const findAllReferences = () => {
|
|
4888
|
+
return i18nString(FindAllReferences);
|
|
4889
|
+
};
|
|
4890
|
+
const findAllImplementations = () => {
|
|
4891
|
+
return i18nString(FindAllImplementations);
|
|
4892
|
+
};
|
|
4893
|
+
const cut = () => {
|
|
4894
|
+
return i18nString(Cut);
|
|
4895
|
+
};
|
|
4896
|
+
const copy = () => {
|
|
4897
|
+
return i18nString(Copy);
|
|
4898
|
+
};
|
|
4899
|
+
const paste$1 = () => {
|
|
4900
|
+
return i18nString(Paste);
|
|
4901
|
+
};
|
|
4906
4902
|
const toggleBlockComment$1 = () => {
|
|
4907
4903
|
return i18nString(ToggleBlockComment);
|
|
4908
4904
|
};
|
|
@@ -5012,7 +5008,7 @@ const goTo = async ({
|
|
|
5012
5008
|
endRowIndex: definition.endRowIndex,
|
|
5013
5009
|
endColumnIndex: definition.endColumnIndex
|
|
5014
5010
|
};
|
|
5015
|
-
await invoke$
|
|
5011
|
+
await invoke$b(/* Main.openUri */'Main.openUri', /* uri */uri, /* focus */true, context);
|
|
5016
5012
|
return editor;
|
|
5017
5013
|
} catch (error) {
|
|
5018
5014
|
// TODO if editor is already disposed at this point, do nothing
|
|
@@ -5090,7 +5086,7 @@ const getNoLocationFoundMessage = info => {
|
|
|
5090
5086
|
|
|
5091
5087
|
const getTypeDefinition = async (editor, offset) => {
|
|
5092
5088
|
// @ts-ignore
|
|
5093
|
-
const definition = await invoke$
|
|
5089
|
+
const definition = await invoke$b('ExtensionHostTypeDefinition.executeTypeDefinitionProvider', editor, offset);
|
|
5094
5090
|
return definition;
|
|
5095
5091
|
};
|
|
5096
5092
|
|
|
@@ -5245,7 +5241,12 @@ const handleClickAtPosition = async (editor, modifier, rowIndex, columnIndex) =>
|
|
|
5245
5241
|
const Editor = 3;
|
|
5246
5242
|
|
|
5247
5243
|
const handleContextMenu = async (editor, button, x, y) => {
|
|
5248
|
-
|
|
5244
|
+
const {
|
|
5245
|
+
uid
|
|
5246
|
+
} = editor;
|
|
5247
|
+
await showContextMenu2(uid, Editor, /* x */x, /* y */y, {
|
|
5248
|
+
menuId: Editor
|
|
5249
|
+
});
|
|
5249
5250
|
return editor;
|
|
5250
5251
|
};
|
|
5251
5252
|
|
|
@@ -5853,7 +5854,7 @@ const indentMore = editor => {
|
|
|
5853
5854
|
|
|
5854
5855
|
const getLanguageConfiguration = async editor => {
|
|
5855
5856
|
// @ts-ignore
|
|
5856
|
-
return invoke$
|
|
5857
|
+
return invoke$b('Languages.getLanguageConfiguration', {
|
|
5857
5858
|
uri: editor.uri,
|
|
5858
5859
|
languageId: editor.languageId
|
|
5859
5860
|
});
|
|
@@ -6196,7 +6197,7 @@ const create$4 = () => {
|
|
|
6196
6197
|
};
|
|
6197
6198
|
|
|
6198
6199
|
const {
|
|
6199
|
-
setFactory
|
|
6200
|
+
setFactory,
|
|
6200
6201
|
invoke: invoke$4
|
|
6201
6202
|
} = createLazyRpc(CompletionWorker);
|
|
6202
6203
|
|
|
@@ -6434,7 +6435,7 @@ const pasteText = (editor, text) => {
|
|
|
6434
6435
|
|
|
6435
6436
|
const paste = async editor => {
|
|
6436
6437
|
// @ts-ignore
|
|
6437
|
-
const text = await invoke$
|
|
6438
|
+
const text = await invoke$b('ClipBoard.readText');
|
|
6438
6439
|
string(text);
|
|
6439
6440
|
return pasteText(editor, text);
|
|
6440
6441
|
};
|
|
@@ -6580,7 +6581,7 @@ const save = async editor => {
|
|
|
6580
6581
|
} = editor;
|
|
6581
6582
|
const newEditor = await getNewEditor(editor);
|
|
6582
6583
|
const content = getText$1(newEditor);
|
|
6583
|
-
await invoke$
|
|
6584
|
+
await invoke$b('FileSystem.writeFile', uri, content);
|
|
6584
6585
|
return newEditor;
|
|
6585
6586
|
} catch (error) {
|
|
6586
6587
|
// @ts-ignore
|
|
@@ -6887,7 +6888,7 @@ const selectInsideString = editor => {
|
|
|
6887
6888
|
|
|
6888
6889
|
const getNewSelections = async (editor, selections) => {
|
|
6889
6890
|
// @ts-ignore
|
|
6890
|
-
const newSelections = await invoke$
|
|
6891
|
+
const newSelections = await invoke$b('ExtensionHostSelection.executeGrowSelection', editor, selections);
|
|
6891
6892
|
if (newSelections.length === 0) {
|
|
6892
6893
|
return selections;
|
|
6893
6894
|
}
|
|
@@ -7294,7 +7295,7 @@ const showHover3 = async editor => {
|
|
|
7294
7295
|
|
|
7295
7296
|
const EditorHover = 'EditorHover';
|
|
7296
7297
|
const showHover = async state => {
|
|
7297
|
-
await invoke$
|
|
7298
|
+
await invoke$b('Viewlet.openWidget', EditorHover);
|
|
7298
7299
|
return state;
|
|
7299
7300
|
};
|
|
7300
7301
|
|
|
@@ -7971,7 +7972,7 @@ const typeWithAutoClosingQuote = (editor, text) => {
|
|
|
7971
7972
|
const typeWithAutoClosingTag = async (editor, text) => {
|
|
7972
7973
|
const offset = offsetAt(editor, editor.selections[0], editor.selections[1]);
|
|
7973
7974
|
// @ts-ignore
|
|
7974
|
-
const result = await invoke$
|
|
7975
|
+
const result = await invoke$b('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
|
|
7975
7976
|
if (!result) {
|
|
7976
7977
|
const changes = editorReplaceSelections(editor, [text], EditorType);
|
|
7977
7978
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
@@ -8235,7 +8236,7 @@ const addWidget$1 = (widget, id, render) => {
|
|
|
8235
8236
|
const getWidgetInvoke = widgetId => {
|
|
8236
8237
|
switch (widgetId) {
|
|
8237
8238
|
case ColorPicker$1:
|
|
8238
|
-
return invoke$
|
|
8239
|
+
return invoke$9;
|
|
8239
8240
|
case Completion:
|
|
8240
8241
|
return invoke$4;
|
|
8241
8242
|
case Find:
|
|
@@ -8992,7 +8993,7 @@ const getEditorSourceActions = async editorId => {
|
|
|
8992
8993
|
languageId
|
|
8993
8994
|
} = newState;
|
|
8994
8995
|
// @ts-ignore
|
|
8995
|
-
const allActions = await invoke$
|
|
8996
|
+
const allActions = await invoke$b('GetEditorSourceActions.getEditorSourceActions');
|
|
8996
8997
|
const filtered = filterActions(allActions, languageId);
|
|
8997
8998
|
return filtered;
|
|
8998
8999
|
};
|
|
@@ -9015,14 +9016,14 @@ const getWordAtOffset = editor => {
|
|
|
9015
9016
|
};
|
|
9016
9017
|
|
|
9017
9018
|
const setFocus = async focusKey => {
|
|
9018
|
-
await invoke$
|
|
9019
|
+
await invoke$b('Focus.setFocus', focusKey);
|
|
9019
9020
|
};
|
|
9020
9021
|
const unsetAdditionalFocus = async focusKey => {
|
|
9021
9022
|
if (!focusKey) {
|
|
9022
9023
|
return;
|
|
9023
9024
|
}
|
|
9024
9025
|
// @ts-ignore
|
|
9025
|
-
await invoke$
|
|
9026
|
+
await invoke$b('Focus.removeAdditionalFocus', focusKey);
|
|
9026
9027
|
};
|
|
9027
9028
|
|
|
9028
9029
|
const FocusEditor = 12;
|
|
@@ -9554,6 +9555,82 @@ const getKeys = () => {
|
|
|
9554
9555
|
return getKeys$1();
|
|
9555
9556
|
};
|
|
9556
9557
|
|
|
9558
|
+
/**
|
|
9559
|
+
* @enum {string}
|
|
9560
|
+
*/
|
|
9561
|
+
const UiStrings = {
|
|
9562
|
+
CommandPalette: 'Command Palette'};
|
|
9563
|
+
const commandPalette = () => {
|
|
9564
|
+
return i18nString(UiStrings.CommandPalette);
|
|
9565
|
+
};
|
|
9566
|
+
|
|
9567
|
+
const menuEntrySeparator = {
|
|
9568
|
+
id: 'separator',
|
|
9569
|
+
label: '',
|
|
9570
|
+
flags: Separator,
|
|
9571
|
+
command: ''
|
|
9572
|
+
};
|
|
9573
|
+
|
|
9574
|
+
const getMenuEntries = () => {
|
|
9575
|
+
return [{
|
|
9576
|
+
id: 'go-to-definition',
|
|
9577
|
+
label: goToDefinition$1(),
|
|
9578
|
+
flags: None,
|
|
9579
|
+
command: 'Editor.goToDefinition'
|
|
9580
|
+
}, {
|
|
9581
|
+
id: 'go-to-type-definition',
|
|
9582
|
+
label: goToTypeDefinition$1(),
|
|
9583
|
+
flags: None,
|
|
9584
|
+
command: /* Editor.goToTypeDefinition */'Editor.goToTypeDefinition'
|
|
9585
|
+
}, menuEntrySeparator, {
|
|
9586
|
+
id: 'find-all-references',
|
|
9587
|
+
label: findAllReferences(),
|
|
9588
|
+
flags: None,
|
|
9589
|
+
command: /* ViewletSideBar.show */'SideBar.show',
|
|
9590
|
+
args: [/* id */'References', /* focus */true]
|
|
9591
|
+
}, {
|
|
9592
|
+
id: 'find-all-implementations',
|
|
9593
|
+
label: findAllImplementations(),
|
|
9594
|
+
flags: None,
|
|
9595
|
+
command: /* ViewletSideBar.show */'SideBar.show',
|
|
9596
|
+
args: [/* id */'Implementations', /* focus */true]
|
|
9597
|
+
}, menuEntrySeparator, {
|
|
9598
|
+
id: 'format',
|
|
9599
|
+
label: formatDocument(),
|
|
9600
|
+
flags: None,
|
|
9601
|
+
command: 'Editor.format'
|
|
9602
|
+
}, {
|
|
9603
|
+
id: SourceControl,
|
|
9604
|
+
label: sourceAction(),
|
|
9605
|
+
flags: None,
|
|
9606
|
+
command: 'Editor.showSourceActions2'
|
|
9607
|
+
}, menuEntrySeparator, {
|
|
9608
|
+
id: 'cut',
|
|
9609
|
+
label: cut(),
|
|
9610
|
+
flags: None,
|
|
9611
|
+
command: /* Editor.cut */'Editor.cut'
|
|
9612
|
+
}, {
|
|
9613
|
+
id: 'copy',
|
|
9614
|
+
label: copy(),
|
|
9615
|
+
flags: None,
|
|
9616
|
+
command: /* Editor.copy */'Editor.copy'
|
|
9617
|
+
}, {
|
|
9618
|
+
id: 'paste',
|
|
9619
|
+
label: paste$1(),
|
|
9620
|
+
flags: None,
|
|
9621
|
+
command: /* Editor.paste */'Editor.paste'
|
|
9622
|
+
}, menuEntrySeparator, {
|
|
9623
|
+
id: 'commandPalette',
|
|
9624
|
+
label: commandPalette(),
|
|
9625
|
+
flags: None,
|
|
9626
|
+
command: 'QuickPick.showEverything'
|
|
9627
|
+
}];
|
|
9628
|
+
};
|
|
9629
|
+
|
|
9630
|
+
const getMenuIds = () => {
|
|
9631
|
+
return [Editor$1];
|
|
9632
|
+
};
|
|
9633
|
+
|
|
9557
9634
|
const getDiagnostics = editor => {
|
|
9558
9635
|
return executeDiagnosticProvider(editor);
|
|
9559
9636
|
};
|
|
@@ -9782,7 +9859,7 @@ const hotReload = async () => {
|
|
|
9782
9859
|
|
|
9783
9860
|
// TODO ask renderer worker to rerender all editors
|
|
9784
9861
|
// @ts-ignore
|
|
9785
|
-
await invoke$
|
|
9862
|
+
await invoke$b(`Editor.rerender`);
|
|
9786
9863
|
isReloading = false;
|
|
9787
9864
|
};
|
|
9788
9865
|
|
|
@@ -9854,7 +9931,7 @@ const launchCompletionWorker = async () => {
|
|
|
9854
9931
|
};
|
|
9855
9932
|
|
|
9856
9933
|
const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
|
|
9857
|
-
setFactory
|
|
9934
|
+
setFactory(launchCompletionWorker);
|
|
9858
9935
|
await Promise.all([initializeSyntaxHighlighting(syntaxHighlightingEnabled, syncIncremental), initializeExtensionHost()]);
|
|
9859
9936
|
};
|
|
9860
9937
|
|
|
@@ -10321,7 +10398,7 @@ const updateDebugInfo = async debugId => {
|
|
|
10321
10398
|
};
|
|
10322
10399
|
set$6(key, oldState, newEditor);
|
|
10323
10400
|
// @ts-ignore
|
|
10324
|
-
await invoke$
|
|
10401
|
+
await invoke$b('Editor.rerender', key);
|
|
10325
10402
|
};
|
|
10326
10403
|
|
|
10327
10404
|
const keep = ['ActivateByEvent.activateByEvent', 'ExtensionHostManagement.activateByEvent', 'Editor.applyEdit2', 'Editor.applyEdits2', 'Editor.closeFind2', 'Editor.closeWidget2', 'Editor.create', 'Editor.getKeyBindings', 'Editor.getSourceActions', 'Editor.getLines2', 'Editor.getPositionAtCursor', 'Editor.getOffsetAtCursor', 'Editor.getQuickPickMenuEntries', 'Editor.getSelections', 'Editor.hotReload', 'Editor.getSelections2', 'Editor.getDiagnostics', 'Editor.getText', 'Editor.getWordAt', 'Editor.getWordAt2', 'Editor.getWordAtOffset2', 'Editor.getUri', 'Editor.getWordBefore', 'Editor.getWordBefore2', 'Editor.offsetAt', 'Editor.render', 'Editor.setSelections2', 'Editor.updateDebugInfo', 'Editor.getLanguageId', 'Editor.getProblems', 'Editor.getKeys', 'Font.ensure', 'HandleMessagePort.handleMessagePort', 'Hover.getHoverInfo', 'Hover.handleSashPointerDown', 'Hover.handleSashPointerMove', 'Hover.handleSashPointerUp', 'Hover.loadContent', 'Hover.render', 'Initialize.initialize', 'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker'
|
|
@@ -10408,9 +10485,10 @@ const commandMap = {
|
|
|
10408
10485
|
'Editor.handleClickAtPosition': handleClickAtPosition,
|
|
10409
10486
|
'Editor.applyDocumentEdits': applyDocumentEdits,
|
|
10410
10487
|
'Editor.contextMenu': handleContextMenu,
|
|
10411
|
-
'Editor.copy': copy,
|
|
10488
|
+
'Editor.copy': copy$1,
|
|
10412
10489
|
'Editor.copyLineDown': copyLineDown,
|
|
10413
10490
|
'Editor.copyLineUp': copyLineUp,
|
|
10491
|
+
'Editor.getMenuIds': getMenuIds,
|
|
10414
10492
|
'Editor.create': createEditor,
|
|
10415
10493
|
'Editor.cursorCharacterLeft': cursorCharacterLeft,
|
|
10416
10494
|
'Editor.cursorCharacterRight': cursorCharacterRight,
|
|
@@ -10425,7 +10503,7 @@ const commandMap = {
|
|
|
10425
10503
|
'Editor.cursorWordPartLeft': cursorWordPartLeft,
|
|
10426
10504
|
'Editor.cursorWordPartRight': cursorWordPartRight,
|
|
10427
10505
|
'Editor.cursorWordRight': cursorWordRight,
|
|
10428
|
-
'Editor.cut': cut,
|
|
10506
|
+
'Editor.cut': cut$1,
|
|
10429
10507
|
'Editor.deleteAllLeft': deleteAllLeft,
|
|
10430
10508
|
'Editor.deleteAllRight': deleteAllRight,
|
|
10431
10509
|
'Editor.deleteCharacterLeft': deleteCharacterLeft,
|
|
@@ -10438,12 +10516,14 @@ const commandMap = {
|
|
|
10438
10516
|
'Editor.deleteWordPartRight': deleteWordPartRight,
|
|
10439
10517
|
'Editor.deleteWordRight': deleteWordRight,
|
|
10440
10518
|
'Editor.executeWidgetCommand': executeWidgetCommand,
|
|
10441
|
-
'Editor.findAllReferences': findAllReferences,
|
|
10519
|
+
'Editor.findAllReferences': findAllReferences$1,
|
|
10442
10520
|
'Editor.format': format,
|
|
10443
10521
|
'Editor.getKeyBindings': getKeyBindings,
|
|
10444
10522
|
'Editor.getKeys': getKeys,
|
|
10445
10523
|
'Editor.getLanguageId': getLanguageId,
|
|
10446
10524
|
'Editor.getLines2': getLines2,
|
|
10525
|
+
'Editor.getMenuEntries': getMenuEntries,
|
|
10526
|
+
'Editor.getMenuEntries2': getMenuEntries,
|
|
10447
10527
|
'Editor.getOffsetAtCursor': getOffsetAtCursor,
|
|
10448
10528
|
'Editor.getPositionAtCursor': getPositionAtCursor,
|
|
10449
10529
|
'Editor.getSourceActions': getSourceActions,
|
|
@@ -10638,12 +10718,8 @@ const createTextMeasurementWorkerRpc = async () => {
|
|
|
10638
10718
|
}
|
|
10639
10719
|
};
|
|
10640
10720
|
|
|
10641
|
-
const {
|
|
10642
|
-
setFactory
|
|
10643
|
-
} = createLazyRpc(TextMeasurementWorker);
|
|
10644
|
-
|
|
10645
10721
|
const listen = async () => {
|
|
10646
|
-
setFactory(createTextMeasurementWorkerRpc);
|
|
10722
|
+
setFactory$1(createTextMeasurementWorkerRpc);
|
|
10647
10723
|
const rpc = await WebWorkerRpcClient.create({
|
|
10648
10724
|
commandMap: commandMap
|
|
10649
10725
|
});
|