@lvce-editor/editor-worker 13.4.0 → 14.1.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.
@@ -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$c = (ipc, method, ...params) => {
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$c(ipc, method, ...params);
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$b,
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$b('ExtensionHostReference.executeReferenceProvider', id, offset);
1192
+ return invoke$c('ExtensionHostReference.executeReferenceProvider', id, offset);
1187
1193
  };
1188
1194
  const executeFileReferenceProvider = async id => {
1189
1195
  // @ts-ignore
1190
- return invoke$b('ExtensionHostReference.executeFileReferenceProvider', id);
1196
+ return invoke$c('ExtensionHostReference.executeFileReferenceProvider', id);
1191
1197
  };
1192
1198
  const getRuntimeStatus = async extensionId => {
1193
1199
  // @ts-ignore
1194
- return invoke$b('ExtensionHost.getRuntimeStatus', extensionId);
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$b,
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$a,
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$9,
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$9,
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$a('ExtensionHostManagement.activateByEvent', event);
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$4 = () => {
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$8 = async (method, ...params) => {
1329
- const worker = await getOrCreate$4();
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$8('ColorPicker.create', uid, x, y, width, height, parentUid);
1342
- await invoke$8('ColorPicker.loadContent', uid);
1343
- const diff = await invoke$8('ColorPicker.diff2', uid);
1344
- const commands = await invoke$8('ColorPicker.render2', uid, diff);
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$8 = {
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$8.warned.includes(fn)) {
1565
+ if (state$7.warned.includes(fn)) {
1552
1566
  return;
1553
1567
  }
1554
- state$8.warned.push(fn);
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$7} = SyntaxHighlightingWorker;
1639
+ invoke: invoke$8} = SyntaxHighlightingWorker;
1626
1640
 
1627
- const state$7 = {
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$7.tokenizers;
1645
+ return languageId in state$6.tokenizers;
1632
1646
  };
1633
1647
  const set$4 = (languageId, tokenizer) => {
1634
- state$7.tokenizers[languageId] = tokenizer;
1648
+ state$6.tokenizers[languageId] = tokenizer;
1635
1649
  };
1636
1650
  const get$4 = languageId => {
1637
- return state$7.tokenizers[languageId];
1651
+ return state$6.tokenizers[languageId];
1638
1652
  };
1639
1653
  const isPending = languageId => {
1640
- return languageId in state$7.pending;
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$7('Tokenizer.load', languageId, tokenizePath);
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$7('GetTokensViewport.getTokensViewport', slimEditor,
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$7('GetTokensViewport.getTokensViewport', editor, startLineIndex, endLineIndex, true, editor.id, editor.lines);
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$7(
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 getFontString = (fontWeight, fontSize, fontFamily) => {
2454
- return `${fontWeight} ${fontSize}px ${fontFamily}`;
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
- string(text);
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$a('Preferences.get', key);
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$a('Editor.rerender', newState.id);
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$d = selections => {
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$d(selections);
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$c = (selections, linesLength) => {
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$c(selections, lines.length);
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$a('Editor.showOverlayMessage', editor, 'Viewlet.send', editor.uid, 'showOverlayMessage', x$1, y$1, displayErrorMessage);
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$a('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
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$a('ClipBoard.writeText', /* text */text);
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$b = (selections, lines, getDelta) => {
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$b(selections, lines, getDelta);
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 getNewSelections$a = (selections, lines, getDelta) => {
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 = getNewSelections$a(selections, lines, getDelta);
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$a('SideBar.show', 'References', /* focus */true);
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$a('ExtensionHostDefinition.executeDefinitionProvider', editor, offset);
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$a(/* Main.openUri */'Main.openUri', /* uri */uri, /* focus */true, context);
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$a('ExtensionHostTypeDefinition.executeTypeDefinitionProvider', editor, offset);
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
- await invoke$a(/* ContextMenu.show */'ContextMenu.show', /* x */x, /* y */y, /* id */Editor);
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
 
@@ -5329,10 +5330,7 @@ const handleTripleClick = (editor, modifier, x, y) => {
5329
5330
  object(editor);
5330
5331
  number(x);
5331
5332
  number(y);
5332
- return {
5333
- newState: selectLine(editor),
5334
- commands: []
5335
- };
5333
+ return selectLine(editor);
5336
5334
  };
5337
5335
 
5338
5336
  const handleMouseDown = (state, modifier, x, y, detail) => {
@@ -5853,7 +5851,7 @@ const indentMore = editor => {
5853
5851
 
5854
5852
  const getLanguageConfiguration = async editor => {
5855
5853
  // @ts-ignore
5856
- return invoke$a('Languages.getLanguageConfiguration', {
5854
+ return invoke$b('Languages.getLanguageConfiguration', {
5857
5855
  uri: editor.uri,
5858
5856
  languageId: editor.languageId
5859
5857
  });
@@ -6196,7 +6194,7 @@ const create$4 = () => {
6196
6194
  };
6197
6195
 
6198
6196
  const {
6199
- setFactory: setFactory$1,
6197
+ setFactory,
6200
6198
  invoke: invoke$4
6201
6199
  } = createLazyRpc(CompletionWorker);
6202
6200
 
@@ -6434,7 +6432,7 @@ const pasteText = (editor, text) => {
6434
6432
 
6435
6433
  const paste = async editor => {
6436
6434
  // @ts-ignore
6437
- const text = await invoke$a('ClipBoard.readText');
6435
+ const text = await invoke$b('ClipBoard.readText');
6438
6436
  string(text);
6439
6437
  return pasteText(editor, text);
6440
6438
  };
@@ -6580,7 +6578,7 @@ const save = async editor => {
6580
6578
  } = editor;
6581
6579
  const newEditor = await getNewEditor(editor);
6582
6580
  const content = getText$1(newEditor);
6583
- await invoke$a('FileSystem.writeFile', uri, content);
6581
+ await invoke$b('FileSystem.writeFile', uri, content);
6584
6582
  return newEditor;
6585
6583
  } catch (error) {
6586
6584
  // @ts-ignore
@@ -6887,7 +6885,7 @@ const selectInsideString = editor => {
6887
6885
 
6888
6886
  const getNewSelections = async (editor, selections) => {
6889
6887
  // @ts-ignore
6890
- const newSelections = await invoke$a('ExtensionHostSelection.executeGrowSelection', editor, selections);
6888
+ const newSelections = await invoke$b('ExtensionHostSelection.executeGrowSelection', editor, selections);
6891
6889
  if (newSelections.length === 0) {
6892
6890
  return selections;
6893
6891
  }
@@ -7294,7 +7292,7 @@ const showHover3 = async editor => {
7294
7292
 
7295
7293
  const EditorHover = 'EditorHover';
7296
7294
  const showHover = async state => {
7297
- await invoke$a('Viewlet.openWidget', EditorHover);
7295
+ await invoke$b('Viewlet.openWidget', EditorHover);
7298
7296
  return state;
7299
7297
  };
7300
7298
 
@@ -7971,7 +7969,7 @@ const typeWithAutoClosingQuote = (editor, text) => {
7971
7969
  const typeWithAutoClosingTag = async (editor, text) => {
7972
7970
  const offset = offsetAt(editor, editor.selections[0], editor.selections[1]);
7973
7971
  // @ts-ignore
7974
- const result = await invoke$a('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
7972
+ const result = await invoke$b('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
7975
7973
  if (!result) {
7976
7974
  const changes = editorReplaceSelections(editor, [text], EditorType);
7977
7975
  return scheduleDocumentAndCursorsSelections(editor, changes);
@@ -8235,7 +8233,7 @@ const addWidget$1 = (widget, id, render) => {
8235
8233
  const getWidgetInvoke = widgetId => {
8236
8234
  switch (widgetId) {
8237
8235
  case ColorPicker$1:
8238
- return invoke$8;
8236
+ return invoke$9;
8239
8237
  case Completion:
8240
8238
  return invoke$4;
8241
8239
  case Find:
@@ -8992,7 +8990,7 @@ const getEditorSourceActions = async editorId => {
8992
8990
  languageId
8993
8991
  } = newState;
8994
8992
  // @ts-ignore
8995
- const allActions = await invoke$a('GetEditorSourceActions.getEditorSourceActions');
8993
+ const allActions = await invoke$b('GetEditorSourceActions.getEditorSourceActions');
8996
8994
  const filtered = filterActions(allActions, languageId);
8997
8995
  return filtered;
8998
8996
  };
@@ -9015,14 +9013,14 @@ const getWordAtOffset = editor => {
9015
9013
  };
9016
9014
 
9017
9015
  const setFocus = async focusKey => {
9018
- await invoke$a('Focus.setFocus', focusKey);
9016
+ await invoke$b('Focus.setFocus', focusKey);
9019
9017
  };
9020
9018
  const unsetAdditionalFocus = async focusKey => {
9021
9019
  if (!focusKey) {
9022
9020
  return;
9023
9021
  }
9024
9022
  // @ts-ignore
9025
- await invoke$a('Focus.removeAdditionalFocus', focusKey);
9023
+ await invoke$b('Focus.removeAdditionalFocus', focusKey);
9026
9024
  };
9027
9025
 
9028
9026
  const FocusEditor = 12;
@@ -9554,6 +9552,82 @@ const getKeys = () => {
9554
9552
  return getKeys$1();
9555
9553
  };
9556
9554
 
9555
+ /**
9556
+ * @enum {string}
9557
+ */
9558
+ const UiStrings = {
9559
+ CommandPalette: 'Command Palette'};
9560
+ const commandPalette = () => {
9561
+ return i18nString(UiStrings.CommandPalette);
9562
+ };
9563
+
9564
+ const menuEntrySeparator = {
9565
+ id: 'separator',
9566
+ label: '',
9567
+ flags: Separator,
9568
+ command: ''
9569
+ };
9570
+
9571
+ const getMenuEntries = () => {
9572
+ return [{
9573
+ id: 'go-to-definition',
9574
+ label: goToDefinition$1(),
9575
+ flags: None,
9576
+ command: 'Editor.goToDefinition'
9577
+ }, {
9578
+ id: 'go-to-type-definition',
9579
+ label: goToTypeDefinition$1(),
9580
+ flags: None,
9581
+ command: /* Editor.goToTypeDefinition */'Editor.goToTypeDefinition'
9582
+ }, menuEntrySeparator, {
9583
+ id: 'find-all-references',
9584
+ label: findAllReferences(),
9585
+ flags: None,
9586
+ command: /* ViewletSideBar.show */'SideBar.show',
9587
+ args: [/* id */'References', /* focus */true]
9588
+ }, {
9589
+ id: 'find-all-implementations',
9590
+ label: findAllImplementations(),
9591
+ flags: None,
9592
+ command: /* ViewletSideBar.show */'SideBar.show',
9593
+ args: [/* id */'Implementations', /* focus */true]
9594
+ }, menuEntrySeparator, {
9595
+ id: 'format',
9596
+ label: formatDocument(),
9597
+ flags: None,
9598
+ command: 'Editor.format'
9599
+ }, {
9600
+ id: SourceControl,
9601
+ label: sourceAction(),
9602
+ flags: None,
9603
+ command: 'Editor.showSourceActions2'
9604
+ }, menuEntrySeparator, {
9605
+ id: 'cut',
9606
+ label: cut(),
9607
+ flags: None,
9608
+ command: /* Editor.cut */'Editor.cut'
9609
+ }, {
9610
+ id: 'copy',
9611
+ label: copy(),
9612
+ flags: None,
9613
+ command: /* Editor.copy */'Editor.copy'
9614
+ }, {
9615
+ id: 'paste',
9616
+ label: paste$1(),
9617
+ flags: None,
9618
+ command: /* Editor.paste */'Editor.paste'
9619
+ }, menuEntrySeparator, {
9620
+ id: 'commandPalette',
9621
+ label: commandPalette(),
9622
+ flags: None,
9623
+ command: 'QuickPick.showEverything'
9624
+ }];
9625
+ };
9626
+
9627
+ const getMenuIds = () => {
9628
+ return [Editor$1];
9629
+ };
9630
+
9557
9631
  const getDiagnostics = editor => {
9558
9632
  return executeDiagnosticProvider(editor);
9559
9633
  };
@@ -9782,7 +9856,7 @@ const hotReload = async () => {
9782
9856
 
9783
9857
  // TODO ask renderer worker to rerender all editors
9784
9858
  // @ts-ignore
9785
- await invoke$a(`Editor.rerender`);
9859
+ await invoke$b(`Editor.rerender`);
9786
9860
  isReloading = false;
9787
9861
  };
9788
9862
 
@@ -9854,7 +9928,7 @@ const launchCompletionWorker = async () => {
9854
9928
  };
9855
9929
 
9856
9930
  const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
9857
- setFactory$1(launchCompletionWorker);
9931
+ setFactory(launchCompletionWorker);
9858
9932
  await Promise.all([initializeSyntaxHighlighting(syntaxHighlightingEnabled, syncIncremental), initializeExtensionHost()]);
9859
9933
  };
9860
9934
 
@@ -10321,7 +10395,7 @@ const updateDebugInfo = async debugId => {
10321
10395
  };
10322
10396
  set$6(key, oldState, newEditor);
10323
10397
  // @ts-ignore
10324
- await invoke$a('Editor.rerender', key);
10398
+ await invoke$b('Editor.rerender', key);
10325
10399
  };
10326
10400
 
10327
10401
  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 +10482,10 @@ const commandMap = {
10408
10482
  'Editor.handleClickAtPosition': handleClickAtPosition,
10409
10483
  'Editor.applyDocumentEdits': applyDocumentEdits,
10410
10484
  'Editor.contextMenu': handleContextMenu,
10411
- 'Editor.copy': copy,
10485
+ 'Editor.copy': copy$1,
10412
10486
  'Editor.copyLineDown': copyLineDown,
10413
10487
  'Editor.copyLineUp': copyLineUp,
10488
+ 'Editor.getMenuIds': getMenuIds,
10414
10489
  'Editor.create': createEditor,
10415
10490
  'Editor.cursorCharacterLeft': cursorCharacterLeft,
10416
10491
  'Editor.cursorCharacterRight': cursorCharacterRight,
@@ -10425,7 +10500,7 @@ const commandMap = {
10425
10500
  'Editor.cursorWordPartLeft': cursorWordPartLeft,
10426
10501
  'Editor.cursorWordPartRight': cursorWordPartRight,
10427
10502
  'Editor.cursorWordRight': cursorWordRight,
10428
- 'Editor.cut': cut,
10503
+ 'Editor.cut': cut$1,
10429
10504
  'Editor.deleteAllLeft': deleteAllLeft,
10430
10505
  'Editor.deleteAllRight': deleteAllRight,
10431
10506
  'Editor.deleteCharacterLeft': deleteCharacterLeft,
@@ -10438,12 +10513,14 @@ const commandMap = {
10438
10513
  'Editor.deleteWordPartRight': deleteWordPartRight,
10439
10514
  'Editor.deleteWordRight': deleteWordRight,
10440
10515
  'Editor.executeWidgetCommand': executeWidgetCommand,
10441
- 'Editor.findAllReferences': findAllReferences,
10516
+ 'Editor.findAllReferences': findAllReferences$1,
10442
10517
  'Editor.format': format,
10443
10518
  'Editor.getKeyBindings': getKeyBindings,
10444
10519
  'Editor.getKeys': getKeys,
10445
10520
  'Editor.getLanguageId': getLanguageId,
10446
10521
  'Editor.getLines2': getLines2,
10522
+ 'Editor.getMenuEntries': getMenuEntries,
10523
+ 'Editor.getMenuEntries2': getMenuEntries,
10447
10524
  'Editor.getOffsetAtCursor': getOffsetAtCursor,
10448
10525
  'Editor.getPositionAtCursor': getPositionAtCursor,
10449
10526
  'Editor.getSourceActions': getSourceActions,
@@ -10638,12 +10715,8 @@ const createTextMeasurementWorkerRpc = async () => {
10638
10715
  }
10639
10716
  };
10640
10717
 
10641
- const {
10642
- setFactory
10643
- } = createLazyRpc(TextMeasurementWorker);
10644
-
10645
10718
  const listen = async () => {
10646
- setFactory(createTextMeasurementWorkerRpc);
10719
+ setFactory$1(createTextMeasurementWorkerRpc);
10647
10720
  const rpc = await WebWorkerRpcClient.create({
10648
10721
  commandMap: commandMap
10649
10722
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "13.4.0",
3
+ "version": "14.1.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"