@lvce-editor/editor-worker 19.70.5 → 19.70.6

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.
@@ -1187,7 +1187,7 @@ const createMockRpc = ({
1187
1187
  };
1188
1188
 
1189
1189
  const rpcs = Object.create(null);
1190
- const set$i = (id, rpc) => {
1190
+ const set$j = (id, rpc) => {
1191
1191
  rpcs[id] = rpc;
1192
1192
  };
1193
1193
  const get$9 = id => {
@@ -1220,7 +1220,7 @@ const create$c = rpcId => {
1220
1220
  const mockRpc = createMockRpc({
1221
1221
  commandMap
1222
1222
  });
1223
- set$i(rpcId, mockRpc);
1223
+ set$j(rpcId, mockRpc);
1224
1224
  // @ts-ignore
1225
1225
  mockRpc[Symbol.dispose] = () => {
1226
1226
  remove$8(rpcId);
@@ -1229,7 +1229,7 @@ const create$c = rpcId => {
1229
1229
  return mockRpc;
1230
1230
  },
1231
1231
  set(rpc) {
1232
- set$i(rpcId, rpc);
1232
+ set$j(rpcId, rpc);
1233
1233
  }
1234
1234
  };
1235
1235
  };
@@ -1328,23 +1328,23 @@ const FocusEditorText$1 = 12;
1328
1328
 
1329
1329
  const {
1330
1330
  invoke: invoke$j,
1331
- set: set$h
1331
+ set: set$i
1332
1332
  } = create$c(DialogWorker);
1333
1333
 
1334
1334
  const {
1335
1335
  invoke: invoke$i,
1336
- set: set$g
1336
+ set: set$h
1337
1337
  } = create$c(DragAndDropWorker);
1338
1338
 
1339
1339
  const {
1340
1340
  invoke: invoke$h,
1341
- set: set$f
1341
+ set: set$g
1342
1342
  } = create$c(ErrorWorker);
1343
1343
 
1344
1344
  const {
1345
1345
  invoke: invoke$g,
1346
1346
  invokeAndTransfer: invokeAndTransfer$2,
1347
- set: set$e
1347
+ set: set$f
1348
1348
  } = create$c(ExtensionManagementWorker);
1349
1349
  const getLanguages$1 = (platform, assetDir) => {
1350
1350
  return invoke$g('Extensions.getLanguages', platform, assetDir);
@@ -1363,7 +1363,7 @@ const createLazyRpc = rpcId => {
1363
1363
  throw new Error('Lazy RPC launch was superseded');
1364
1364
  }
1365
1365
  activeRpc = rpc;
1366
- set$i(rpcId, rpc);
1366
+ set$j(rpcId, rpc);
1367
1367
  return rpc;
1368
1368
  };
1369
1369
  const ensureRpc = async () => {
@@ -1425,7 +1425,7 @@ const createLazyRpc = rpcId => {
1425
1425
 
1426
1426
  const {
1427
1427
  invoke: invoke$f,
1428
- set: set$d
1428
+ set: set$e
1429
1429
  } = create$c(OpenerWorker);
1430
1430
  const openUrl = async (url, platform) => {
1431
1431
  return invoke$f('Open.openUrl', url, platform);
@@ -1433,13 +1433,13 @@ const openUrl = async (url, platform) => {
1433
1433
 
1434
1434
  const {
1435
1435
  invoke: invoke$e,
1436
- set: set$c
1436
+ set: set$d
1437
1437
  } = create$c(TextMeasurementWorker);
1438
1438
 
1439
1439
  const {
1440
1440
  invoke: invoke$d,
1441
1441
  invokeAndTransfer: invokeAndTransfer$1,
1442
- set: set$b
1442
+ set: set$c
1443
1443
  } = create$c(RendererWorker);
1444
1444
  const showContextMenu2 = async (uid, menuId, x, y, args) => {
1445
1445
  number(uid);
@@ -1494,13 +1494,13 @@ const sendMessagePortToSyntaxHighlightingWorker$1 = async port => {
1494
1494
 
1495
1495
  const {
1496
1496
  invoke: invoke$c,
1497
- set: set$a
1497
+ set: set$b
1498
1498
  } = create$c(MarkdownWorker);
1499
1499
 
1500
1500
  const SyntaxHighlightingWorker = {
1501
1501
  __proto__: null,
1502
1502
  invoke: invoke$c,
1503
- set: set$a
1503
+ set: set$b
1504
1504
  };
1505
1505
 
1506
1506
  const toCommandId = key => {
@@ -1811,7 +1811,7 @@ const getKeys$2 = () => {
1811
1811
  const keys = editorStates.getKeys();
1812
1812
  return keys.map(String);
1813
1813
  };
1814
- const set$9 = (id, oldEditor, newEditor) => {
1814
+ const set$a = (id, oldEditor, newEditor) => {
1815
1815
  editorStates.set(id, oldEditor, newEditor);
1816
1816
  };
1817
1817
 
@@ -1862,7 +1862,7 @@ const ToggleBlockComment$1 = 'toggleBlockComment';
1862
1862
  const Unknown$2 = 'unknown';
1863
1863
 
1864
1864
  const map$1 = Object.create(null);
1865
- const set$8 = (id, widget) => {
1865
+ const set$9 = (id, widget) => {
1866
1866
  map$1[id] = widget;
1867
1867
  };
1868
1868
  const get$7 = id => {
@@ -2506,7 +2506,7 @@ const getEnabled$1 = () => {
2506
2506
 
2507
2507
  const {
2508
2508
  invoke: invoke$b,
2509
- set: set$7
2509
+ set: set$8
2510
2510
  } = SyntaxHighlightingWorker;
2511
2511
 
2512
2512
  const state$c = {
@@ -2517,7 +2517,7 @@ const state$c = {
2517
2517
  const has = languageId => {
2518
2518
  return Object.hasOwn(state$c.tokenizers, languageId);
2519
2519
  };
2520
- const set$6 = (languageId, tokenizer) => {
2520
+ const set$7 = (languageId, tokenizer) => {
2521
2521
  state$c.tokenizers[languageId] = tokenizer;
2522
2522
  };
2523
2523
  const get$6 = languageId => {
@@ -2541,7 +2541,7 @@ const isPending = languageId => {
2541
2541
  };
2542
2542
 
2543
2543
  const tokenMaps = Object.create(null);
2544
- const set$5 = (languageId, tokenMap) => {
2544
+ const set$6 = (languageId, tokenMap) => {
2545
2545
  tokenMaps[languageId] = tokenMap;
2546
2546
  };
2547
2547
  const get$5 = languageId => {
@@ -2557,7 +2557,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
2557
2557
  if (getEnabled$1()) {
2558
2558
  // @ts-ignore
2559
2559
  const tokenMap = await invoke$b('Tokenizer.load', languageId, tokenizePath);
2560
- set$5(languageId, tokenMap);
2560
+ set$6(languageId, tokenMap);
2561
2561
  return;
2562
2562
  }
2563
2563
  try {
@@ -2573,8 +2573,8 @@ const loadTokenizer = async (languageId, tokenizePath) => {
2573
2573
  console.warn(`tokenizer.TokenMap should be an object in "${tokenizePath}"`);
2574
2574
  return;
2575
2575
  }
2576
- set$5(languageId, tokenizer.TokenMap);
2577
- set$6(languageId, tokenizer);
2576
+ set$6(languageId, tokenizer.TokenMap);
2577
+ set$7(languageId, tokenizer);
2578
2578
  } catch (error) {
2579
2579
  // TODO better error handling
2580
2580
  console.error(error);
@@ -2591,7 +2591,7 @@ const getTokenizer = languageId => {
2591
2591
  };
2592
2592
 
2593
2593
  const tokenizers = Object.create(null);
2594
- const set$4 = (id, value) => {
2594
+ const set$5 = (id, value) => {
2595
2595
  tokenizers[id] = value;
2596
2596
  };
2597
2597
  const get$4 = id => {
@@ -4390,7 +4390,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
4390
4390
  ...newEditor,
4391
4391
  decorations: linkDecorations
4392
4392
  };
4393
- set$9(editor.uid, editor, newEditorWithDecorations);
4393
+ set$a(editor.uid, editor, newEditorWithDecorations);
4394
4394
 
4395
4395
  // Notify main-area-worker about modified status change
4396
4396
  if (!editor.modified) {
@@ -5273,7 +5273,7 @@ const updateColorPickerValue = async (editorUid, value) => {
5273
5273
  return;
5274
5274
  }
5275
5275
  const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
5276
- set$9(editorUid, editor, newEditorWithDerivedState);
5276
+ set$a(editorUid, editor, newEditorWithDerivedState);
5277
5277
  };
5278
5278
 
5279
5279
  const getColorPickerWorkerCommandMap = () => ({
@@ -5484,7 +5484,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir, _langua
5484
5484
  x,
5485
5485
  y
5486
5486
  };
5487
- set$9(id, editor, editor);
5487
+ set$a(id, editor, editor);
5488
5488
  };
5489
5489
 
5490
5490
  const emptyEditor = {
@@ -5827,10 +5827,10 @@ const createEditor = async ({
5827
5827
  focused: true,
5828
5828
  textInfos
5829
5829
  };
5830
- set$9(id, emptyEditor, newEditor4);
5830
+ set$a(id, emptyEditor, newEditor4);
5831
5831
  const completionsOnTypeRaw = await get$3('editor.completionsOnType');
5832
5832
  const completionsOnType = Boolean(completionsOnTypeRaw);
5833
- set$9(id, emptyEditor, {
5833
+ set$a(id, emptyEditor, {
5834
5834
  ...newEditor4,
5835
5835
  completionsOnType
5836
5836
  });
@@ -5861,7 +5861,7 @@ const createStandaloneEditor = async ({
5861
5861
  const createdEditor = get$8(id).newState;
5862
5862
  await loadTokenizer(languageId, tokenizePath);
5863
5863
  const tokenizerId = createdEditor.tokenizerId + 1;
5864
- set$4(tokenizerId, getTokenizer(languageId));
5864
+ set$5(tokenizerId, getTokenizer(languageId));
5865
5865
  const configuredEditor = {
5866
5866
  ...createdEditor,
5867
5867
  charWidth,
@@ -5906,7 +5906,7 @@ const createStandaloneEditor = async ({
5906
5906
  selectionInfos
5907
5907
  };
5908
5908
  if (!createdEditor.lifecycle?.disposed) {
5909
- set$9(id, createdEditor, finalEditor);
5909
+ set$a(id, createdEditor, finalEditor);
5910
5910
  }
5911
5911
  };
5912
5912
 
@@ -6019,17 +6019,17 @@ const dispose$4 = uid => {
6019
6019
  pendingSaves.delete(uid);
6020
6020
  };
6021
6021
 
6022
- const dismissals = new Map();
6023
- const clear$2 = editorUid => {
6024
- const dismissal = dismissals.get(editorUid);
6022
+ const dismissals$1 = new Map();
6023
+ const clear$3 = editorUid => {
6024
+ const dismissal = dismissals$1.get(editorUid);
6025
6025
  if (dismissal) {
6026
6026
  clearTimeout(dismissal.timeout);
6027
- dismissals.delete(editorUid);
6027
+ dismissals$1.delete(editorUid);
6028
6028
  }
6029
6029
  };
6030
- const set$3 = (editorUid, dismissal) => {
6031
- clear$2(editorUid);
6032
- dismissals.set(editorUid, dismissal);
6030
+ const set$4 = (editorUid, dismissal) => {
6031
+ clear$3(editorUid);
6032
+ dismissals$1.set(editorUid, dismissal);
6033
6033
  };
6034
6034
 
6035
6035
  const state$6 = {
@@ -6042,14 +6042,14 @@ const state$6 = {
6042
6042
  const get$2 = () => {
6043
6043
  return state$6;
6044
6044
  };
6045
- const set$2 = (editor, timeout, x, y, token) => {
6045
+ const set$3 = (editor, timeout, x, y, token) => {
6046
6046
  state$6.editor = editor;
6047
6047
  state$6.timeout = timeout;
6048
6048
  state$6.token = token;
6049
6049
  state$6.x = x;
6050
6050
  state$6.y = y;
6051
6051
  };
6052
- const clear$1 = editorUid => {
6052
+ const clear$2 = editorUid => {
6053
6053
  const {
6054
6054
  editor,
6055
6055
  timeout
@@ -6065,6 +6065,20 @@ const clear$1 = editorUid => {
6065
6065
  state$6.token++;
6066
6066
  };
6067
6067
 
6068
+ const dismissals = new Map();
6069
+ const clear$1 = editorUid => {
6070
+ const dismissal = dismissals.get(editorUid);
6071
+ if (!dismissal) {
6072
+ return;
6073
+ }
6074
+ clearTimeout(dismissal.timeout);
6075
+ dismissals.delete(editorUid);
6076
+ };
6077
+ const set$2 = (editorUid, dismissal) => {
6078
+ clear$1(editorUid);
6079
+ dismissals.set(editorUid, dismissal);
6080
+ };
6081
+
6068
6082
  const getOffset = (lines, rowIndex, columnIndex) => {
6069
6083
  let offset = columnIndex;
6070
6084
  for (let i = 0; i < rowIndex; i++) {
@@ -6436,7 +6450,7 @@ const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) =>
6436
6450
  return latest.newState;
6437
6451
  }
6438
6452
  const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
6439
- set$9(editor.id, latest.oldState, newEditor);
6453
+ set$a(editor.id, latest.oldState, newEditor);
6440
6454
  requestDiagnosticSnapshots.set(editor.id, diagnostics);
6441
6455
  onAccepted?.();
6442
6456
  await invoke$5('Editor.renderPending', newEditor.id);
@@ -6649,8 +6663,9 @@ const disposeEditor = async editorUid => {
6649
6663
  }
6650
6664
  dispose$2(editorUid);
6651
6665
  dispose$4(editorUid);
6652
- clear$1(editorUid);
6653
6666
  clear$2(editorUid);
6667
+ clear$3(editorUid);
6668
+ clear$1(editorUid);
6654
6669
  dispose$1(editorUid);
6655
6670
  const pending = [];
6656
6671
  if (getEnabled$1()) {
@@ -7308,6 +7323,20 @@ const create$8 = () => {
7308
7323
  return state$5.nextId++;
7309
7324
  };
7310
7325
 
7326
+ const getIndex = (widgets, id) => {
7327
+ for (const [i, widget] of widgets.entries()) {
7328
+ if (widget.id === id) {
7329
+ return i;
7330
+ }
7331
+ }
7332
+ return -1;
7333
+ };
7334
+ const removeEditorWidget = (widgets, id) => {
7335
+ const index = getIndex(widgets, id);
7336
+ const newWidgets = [...widgets.slice(0, index), ...widgets.slice(index + 1)];
7337
+ return newWidgets;
7338
+ };
7339
+
7311
7340
  const Message = 9;
7312
7341
 
7313
7342
  const getAccurateColumnIndexAscii = async (line, guess, averageCharWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth) => {
@@ -7452,21 +7481,32 @@ const at = async (editor, eventX, eventY) => {
7452
7481
  };
7453
7482
 
7454
7483
  /**
7455
- * @deprecated this doesn't work for variable width characters (Unicode/emoji).
7456
- * Use position computation in renderer process instead
7457
- *
7458
- * @param {object} editor
7459
- * @param {number} rowIndex
7460
- * @param {number} columnIndex
7461
- * @returns
7484
+ * @deprecated this doesn't account for variable-width characters, gutters, or horizontal scrolling.
7462
7485
  */
7463
7486
  const x = (editor, rowIndex, columnIndex) => {
7464
7487
  const {
7465
7488
  columnWidth,
7466
7489
  x
7467
7490
  } = editor;
7468
- const offsetX = columnIndex * columnWidth + x;
7469
- return offsetX;
7491
+ return columnIndex * columnWidth + x;
7492
+ };
7493
+ const getCursorX = async (editor, rowIndex, columnIndex) => {
7494
+ const {
7495
+ charWidth,
7496
+ deltaX,
7497
+ fontFamily,
7498
+ fontSize,
7499
+ fontWeight,
7500
+ gutterWidth = 0,
7501
+ isMonospaceFont,
7502
+ letterSpacing,
7503
+ lines,
7504
+ tabSize,
7505
+ width,
7506
+ x
7507
+ } = editor;
7508
+ const textX = await getX(lines[rowIndex] || '', columnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, 0, width, charWidth);
7509
+ return x + gutterWidth + textX - deltaX;
7470
7510
  };
7471
7511
  const y = (editor, rowIndex) => {
7472
7512
  const {
@@ -7478,6 +7518,8 @@ const y = (editor, rowIndex) => {
7478
7518
  return offsetY;
7479
7519
  };
7480
7520
 
7521
+ const defaultMessageDelay = 3000;
7522
+
7481
7523
  /**
7482
7524
  *
7483
7525
  * @param {any} editor
@@ -7488,29 +7530,54 @@ const y = (editor, rowIndex) => {
7488
7530
  * @returns
7489
7531
  */
7490
7532
  // @ts-ignore
7491
- const editorShowMessage = (editor, rowIndex, columnIndex, message, _isError) => {
7533
+ const editorShowMessage = async (editor, rowIndex, columnIndex, message, _isError) => {
7492
7534
  object(editor);
7493
7535
  number(rowIndex);
7494
7536
  number(columnIndex);
7495
7537
  string(message);
7496
- const x$1 = x(editor, rowIndex, columnIndex);
7538
+ const x = await getCursorX(editor, rowIndex, columnIndex);
7497
7539
  const y$1 = y(editor, rowIndex);
7498
7540
  const existingWidget = editor.widgets.find(widget => widget.id === Message);
7499
7541
  const uid = existingWidget?.newState.uid ?? create$8();
7500
7542
  const newState = {
7501
7543
  message,
7502
7544
  uid,
7503
- x: x$1,
7545
+ x,
7504
7546
  y: y$1
7505
7547
  };
7506
7548
  const widget = {
7507
7549
  id: Message,
7508
7550
  newState
7509
7551
  };
7510
- return {
7552
+ const newEditor = {
7511
7553
  ...editor,
7512
7554
  widgets: [...editor.widgets.filter(item => item.id !== Message), widget]
7513
7555
  };
7556
+ if (typeof editor.uid === 'number') {
7557
+ const timeout = setTimeout(async () => {
7558
+ clear$1(editor.uid);
7559
+ const latestInstance = get$8(editor.uid);
7560
+ if (!latestInstance) {
7561
+ return;
7562
+ }
7563
+ const latestEditor = latestInstance.newState;
7564
+ const latestWidget = latestEditor.widgets.find(item => item.id === Message);
7565
+ if (latestWidget?.newState.uid !== uid) {
7566
+ return;
7567
+ }
7568
+ const editorWithoutMessage = {
7569
+ ...latestEditor,
7570
+ widgetRevision: next(editor.uid),
7571
+ widgets: removeEditorWidget(latestEditor.widgets, Message)
7572
+ };
7573
+ set$a(editor.uid, latestEditor, editorWithoutMessage);
7574
+ await invoke$d('Editor.renderPending', editor.uid);
7575
+ }, editor.messageDelay ?? defaultMessageDelay);
7576
+ set$2(editor.uid, {
7577
+ timeout
7578
+ });
7579
+ }
7580
+ return newEditor;
7514
7581
  };
7515
7582
 
7516
7583
  /**
@@ -7522,8 +7589,8 @@ const editorShowMessage = (editor, rowIndex, columnIndex, message, _isError) =>
7522
7589
  * @returns
7523
7590
  */
7524
7591
  // @ts-ignore
7525
- const showErrorMessage = (editor, rowIndex, columnIndex, message) => {
7526
- return editorShowMessage(editor, rowIndex, columnIndex, message);
7592
+ const showErrorMessage = async (editor, rowIndex, columnIndex, message) => {
7593
+ return await editorShowMessage(editor, rowIndex, columnIndex, message);
7527
7594
  };
7528
7595
 
7529
7596
  const expectedErrorMessage = 'Failed to execute formatting provider: FormattingError:';
@@ -7791,20 +7858,6 @@ const getCursorOffset = editor => {
7791
7858
  return offsetAt(editor, editor.selections[0], editor.selections[1]);
7792
7859
  };
7793
7860
 
7794
- const getIndex = (widgets, id) => {
7795
- for (const [i, widget] of widgets.entries()) {
7796
- if (widget.id === id) {
7797
- return i;
7798
- }
7799
- }
7800
- return -1;
7801
- };
7802
- const removeEditorWidget = (widgets, id) => {
7803
- const index = getIndex(widgets, id);
7804
- const newWidgets = [...widgets.slice(0, index), ...widgets.slice(index + 1)];
7805
- return newWidgets;
7806
- };
7807
-
7808
7861
  const cancelSelection = editor => {
7809
7862
  const {
7810
7863
  selections,
@@ -10193,14 +10246,14 @@ const handleMouseLeave = (viewletUid, editorUidValue) => {
10193
10246
  const {
10194
10247
  widgets = []
10195
10248
  } = instance.newState;
10196
- clear$1(editorUid);
10197
10249
  clear$2(editorUid);
10250
+ clear$3(editorUid);
10198
10251
  const hoverWidget = widgets.find(widget => widget.id === Hover);
10199
10252
  if (!hoverWidget) {
10200
10253
  return;
10201
10254
  }
10202
10255
  const timeout = setTimeout(async () => {
10203
- clear$2(editorUid);
10256
+ clear$3(editorUid);
10204
10257
  const latestInstance = get$8(editorUid);
10205
10258
  if (!latestInstance) {
10206
10259
  return;
@@ -10218,16 +10271,16 @@ const handleMouseLeave = (viewletUid, editorUidValue) => {
10218
10271
  widgetRevision: next(editorUid),
10219
10272
  widgets: removeEditorWidget(latestEditor.widgets, Hover)
10220
10273
  };
10221
- set$9(editorUid, latestEditor, newEditor);
10274
+ set$a(editorUid, latestEditor, newEditor);
10222
10275
  await invoke$d('Editor.renderPending', editorUid);
10223
10276
  }, editorHoverDismissDelay);
10224
- set$3(editorUid, {
10277
+ set$4(editorUid, {
10225
10278
  timeout
10226
10279
  });
10227
10280
  };
10228
10281
  const handleMouseEnter = (viewletUid, editorUidValue) => {
10229
10282
  const targetEditorUid = editorUidValue ?? viewletUid;
10230
- clear$2(Number(targetEditorUid));
10283
+ clear$3(Number(targetEditorUid));
10231
10284
  };
10232
10285
 
10233
10286
  const RE_ALPHA_NUMERIC = /[a-zA-Z\d]/;
@@ -10651,7 +10704,7 @@ const showHover = async (editor, position, token) => {
10651
10704
  if (latestEditor === newEditor || !latestInstance || latestInstance.newState !== latestEditor || get$2().token !== token) {
10652
10705
  return;
10653
10706
  }
10654
- set$9(editor.uid, latestInstance.oldState, newEditor);
10707
+ set$a(editor.uid, latestInstance.oldState, newEditor);
10655
10708
  await invoke$d('Editor.renderPending', editor.uid);
10656
10709
  };
10657
10710
 
@@ -10685,7 +10738,7 @@ const onHoverIdle = async token => {
10685
10738
  }
10686
10739
  };
10687
10740
  const handleMouseMove = async (editor, x, y, altKey) => {
10688
- clear$1();
10741
+ clear$2();
10689
10742
  if (altKey) {
10690
10743
  return handleMouseMoveWithAltKey(editor, x, y);
10691
10744
  }
@@ -10695,7 +10748,7 @@ const handleMouseMove = async (editor, x, y, altKey) => {
10695
10748
  }
10696
10749
  const token = create$8();
10697
10750
  const timeout = setTimeout(onHoverIdle, editorWithoutDefinitionLink.hoverDelay ?? 200, token);
10698
- set$2(editorWithoutDefinitionLink, timeout, x, y, token);
10751
+ set$3(editorWithoutDefinitionLink, timeout, x, y, token);
10699
10752
  return editorWithoutDefinitionLink;
10700
10753
  };
10701
10754
 
@@ -10913,7 +10966,7 @@ const continueScrollingAndMovingSelection = async editorUid => {
10913
10966
  }
10914
10967
  return;
10915
10968
  }
10916
- set$9(editor.uid, editor, derivedEditor);
10969
+ set$a(editor.uid, editor, derivedEditor);
10917
10970
  if (derivedEditor.hasListener) {
10918
10971
  requestAnimationFrame(() => continueScrollingAndMovingSelection(editorUid));
10919
10972
  }
@@ -11702,7 +11755,7 @@ const updateEditor = async (editorUid, editor, newEditor) => {
11702
11755
  return;
11703
11756
  }
11704
11757
  const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
11705
- set$9(editorUid, editor, newEditorWithDerivedState);
11758
+ set$a(editorUid, editor, newEditorWithDerivedState);
11706
11759
  };
11707
11760
  const applyDocumentEdits = async (editorUid, edits) => {
11708
11761
  const editor = getEditor$1(editorUid);
@@ -11752,7 +11805,7 @@ const launch = async () => {
11752
11805
  return;
11753
11806
  }
11754
11807
  const rpc = await launchFindWidgetWorker();
11755
- set$i(rpcId, rpc);
11808
+ set$j(rpcId, rpc);
11756
11809
  };
11757
11810
  const invoke$3 = async (method, ...params) => {
11758
11811
  const rpc = get$9(rpcId);
@@ -11883,7 +11936,7 @@ const createFn = (key, name, widgetId) => {
11883
11936
  const latestAfterInvoke = get$8(editor.uid).newState;
11884
11937
  const latestChildIndex = latestAfterInvoke.widgets.findIndex(isWidget);
11885
11938
  if (latestChildIndex === -1) {
11886
- set$9(editor.uid, editor, latestAfterInvoke);
11939
+ set$a(editor.uid, editor, latestAfterInvoke);
11887
11940
  await dispose$3();
11888
11941
  return latestAfterInvoke;
11889
11942
  }
@@ -11897,7 +11950,7 @@ const createFn = (key, name, widgetId) => {
11897
11950
  widgetRevision,
11898
11951
  widgets: removeEditorWidget(latest.widgets, widgetId)
11899
11952
  };
11900
- set$9(editor.uid, latest, newEditor);
11953
+ set$a(editor.uid, latest, newEditor);
11901
11954
  return newEditor;
11902
11955
  }
11903
11956
  const newState = {
@@ -11905,7 +11958,7 @@ const createFn = (key, name, widgetId) => {
11905
11958
  commands
11906
11959
  };
11907
11960
  const newEditor = updateWidget(latest, widgetId, newState);
11908
- set$9(editor.uid, editor, newEditor);
11961
+ set$a(editor.uid, editor, newEditor);
11909
11962
  return newEditor;
11910
11963
  };
11911
11964
  return fn;
@@ -12935,7 +12988,7 @@ const setLanguageId = async (editor, languageId, tokenizePath, isExplicit = fals
12935
12988
  await loadTokenizer(languageId, tokenizePath);
12936
12989
  const tokenizer = getTokenizer(languageId);
12937
12990
  const newTokenizerId = tokenizerId + 1;
12938
- set$4(newTokenizerId, tokenizer);
12991
+ set$5(newTokenizerId, tokenizer);
12939
12992
  return {
12940
12993
  ...editor,
12941
12994
  explicitLanguageId: isExplicit ? languageId : editor.explicitLanguageId,
@@ -14940,7 +14993,7 @@ const setSelections2 = async (editorUid, selections) => {
14940
14993
  const editor = getEditor$1(editorUid);
14941
14994
  const newEditor = setSelections$2(editor, selections);
14942
14995
  const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
14943
- set$9(editorUid, editor, newEditorWithDerivedState);
14996
+ set$a(editorUid, editor, newEditorWithDerivedState);
14944
14997
  };
14945
14998
  const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocus$1) => {
14946
14999
  const editor = getEditor$1(editorUid);
@@ -14964,7 +15017,7 @@ const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocu
14964
15017
  widgets: newWidgets
14965
15018
  };
14966
15019
  const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
14967
- set$9(editorUid, editor, newEditorWithDerivedState);
15020
+ set$a(editorUid, editor, newEditorWithDerivedState);
14968
15021
  await setFocus(FocusEditorText);
14969
15022
  if (unsetAdditionalFocus$1) {
14970
15023
  await unsetAdditionalFocus(unsetAdditionalFocus$1);
@@ -14977,7 +15030,7 @@ const applyEdits2 = async (editorUid, edits, selectionChanges) => {
14977
15030
  const editor = getEditor$1(editorUid);
14978
15031
  const newEditor = await applyEdit(editor, edits, selectionChanges);
14979
15032
  const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
14980
- set$9(editorUid, editor, newEditorWithDerivedState);
15033
+ set$a(editorUid, editor, newEditorWithDerivedState);
14981
15034
  };
14982
15035
  const getSourceActions = async editorUid => {
14983
15036
  const actions = await getEditorSourceActions(editorUid);
@@ -15651,7 +15704,7 @@ const handleMessagePort = async (port, rpcId) => {
15651
15704
  messagePort: port
15652
15705
  });
15653
15706
  if (rpcId) {
15654
- set$i(rpcId, rpc);
15707
+ set$j(rpcId, rpc);
15655
15708
  await initializeListener(rpcId);
15656
15709
  }
15657
15710
  };
@@ -15769,6 +15822,8 @@ const getMergeConflictActionsEnabled = async () => {
15769
15822
  };
15770
15823
 
15771
15824
  const DEFAULT_HOVER_DELAY = 200;
15825
+ const DEFAULT_MESSAGE_DELAY = 3000;
15826
+ const MAX_MESSAGE_DELAY = 10_000;
15772
15827
  const getHoverDelay = value => {
15773
15828
  const delay = typeof value === 'number' ? value : Number(value);
15774
15829
  if (!Number.isFinite(delay) || delay < 0) {
@@ -15776,8 +15831,15 @@ const getHoverDelay = value => {
15776
15831
  }
15777
15832
  return delay;
15778
15833
  };
15834
+ const getMessageDelay = value => {
15835
+ const delay = typeof value === 'number' ? value : Number(value);
15836
+ if (!Number.isFinite(delay) || delay < 0 || delay > MAX_MESSAGE_DELAY) {
15837
+ return DEFAULT_MESSAGE_DELAY;
15838
+ }
15839
+ return delay;
15840
+ };
15779
15841
  const getEditorPreferences = async () => {
15780
- const [diagnosticsEnabled, fontFamily, fontSize, fontWeight, formatOnSave, hoverEnabled, hoverDelay, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, breadcrumbsEnabled, insertSpaces, dragAndDropEnabled, roundedSelection, combineWhitespaceTokens] = await Promise.all([get$3('editor.diagnostics'), getFontFamily(), getFontSize(), getFontWeight(), get$3('editor.formatOnSave'), get$3('editor.hover'), get$3('editor.hoverDelay'), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getHighlightActiveLineNumber(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters(), getMinimapEnabled(), getMergeConflictActionsEnabled(), get$3('breadcrumbs.enabled'), get$3('editor.insertSpaces'), get$3('editor.dragAndDrop'), get$3('editor.roundedSelection'), get$3('editor.combineWhitespaceTokens')]);
15842
+ const [diagnosticsEnabled, fontFamily, fontSize, fontWeight, formatOnSave, hoverEnabled, hoverDelay, messageDelay, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, breadcrumbsEnabled, insertSpaces, dragAndDropEnabled, roundedSelection, combineWhitespaceTokens] = await Promise.all([get$3('editor.diagnostics'), getFontFamily(), getFontSize(), getFontWeight(), get$3('editor.formatOnSave'), get$3('editor.hover'), get$3('editor.hoverDelay'), get$3('editor.messageDelay'), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getHighlightActiveLineNumber(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters(), getMinimapEnabled(), getMergeConflictActionsEnabled(), get$3('breadcrumbs.enabled'), get$3('editor.insertSpaces'), get$3('editor.dragAndDrop'), get$3('editor.roundedSelection'), get$3('editor.combineWhitespaceTokens')]);
15781
15843
  return {
15782
15844
  breadcrumbsEnabled: breadcrumbsEnabled ?? false,
15783
15845
  combineWhitespaceTokens: combineWhitespaceTokens ?? true,
@@ -15799,6 +15861,7 @@ const getEditorPreferences = async () => {
15799
15861
  letterSpacing,
15800
15862
  lineNumbers,
15801
15863
  mergeConflictActionsEnabled,
15864
+ messageDelay: getMessageDelay(messageDelay),
15802
15865
  minimapEnabled,
15803
15866
  roundedSelection: roundedSelection === true,
15804
15867
  rowHeight,
@@ -15873,7 +15936,7 @@ const handleSettingsChanged = async state => {
15873
15936
  visualDecorations: diagnosticsEnabled ? state.visualDecorations : []
15874
15937
  };
15875
15938
  if (!editorWithUpdatedSettings.hoverEnabled) {
15876
- clear$1(state.uid);
15939
+ clear$2(state.uid);
15877
15940
  }
15878
15941
  let documentSymbols = state.documentSymbols || [];
15879
15942
  let workspaceUri = state.workspaceUri || '';
@@ -16058,7 +16121,7 @@ const hotReload = async () => {
16058
16121
  await relaunchWorkers();
16059
16122
  const newEditors = await restoreWidgetState(keys, savedStates);
16060
16123
  for (const editor of newEditors) {
16061
- set$9(editor.newState.uid, editor.oldState, editor.newState);
16124
+ set$a(editor.newState.uid, editor.oldState, editor.newState);
16062
16125
  }
16063
16126
 
16064
16127
  // TODO ask renderer worker to rerender all editors
@@ -16096,7 +16159,7 @@ const initializeSyntaxHighlighting = async (syntaxHighlightingEnabled, syncIncre
16096
16159
  if (syntaxHighlightingEnabled) {
16097
16160
  setEnabled$1(true);
16098
16161
  const syntaxRpc = await createSyntaxHighlightingWorkerRpc();
16099
- set$7(syntaxRpc);
16162
+ set$8(syntaxRpc);
16100
16163
  }
16101
16164
  if (syncIncremental) {
16102
16165
  setEnabled(true);
@@ -16293,7 +16356,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true) =
16293
16356
  await loadTokenizer(computedLanguageId, tokenizePath);
16294
16357
  const tokenizer = getTokenizer(computedLanguageId);
16295
16358
  const newTokenizerId = state.tokenizerId + 1;
16296
- set$4(newTokenizerId, tokenizer);
16359
+ set$5(newTokenizerId, tokenizer);
16297
16360
  effectiveEditor.tokenizerId = newTokenizerId;
16298
16361
  }
16299
16362
  const savedHistory = existingEditor ? undefined : getSavedHistory(savedState, content);
@@ -16437,7 +16500,7 @@ const refreshGutterDecorationsAll = async () => {
16437
16500
  if (!latest) {
16438
16501
  continue;
16439
16502
  }
16440
- set$9(editor.id, latest.oldState, {
16503
+ set$a(editor.id, latest.oldState, {
16441
16504
  ...latest.newState,
16442
16505
  gutterDecorations: refreshedEditor.gutterDecorations
16443
16506
  });
@@ -17748,7 +17811,7 @@ const render2 = (uid, _diffResult) => {
17748
17811
  } = editor;
17749
17812
  // Diagnostics can change after the caller calculated its diff in a separate RPC.
17750
17813
  const diffResult = diff(oldState, newState);
17751
- set$9(uid, newState, newState);
17814
+ set$a(uid, newState, newState);
17752
17815
  const commands = applyRender(oldState, newState, diffResult);
17753
17816
  return commands;
17754
17817
  };
@@ -17858,7 +17921,7 @@ const renderEditor = async id => {
17858
17921
  oldState
17859
17922
  } = instance;
17860
17923
  const commands = [];
17861
- set$9(id, newState, newState);
17924
+ set$a(id, newState, newState);
17862
17925
  for (const item of render$7) {
17863
17926
  if (item.isEqual(oldState, newState)) {
17864
17927
  continue;
@@ -18073,7 +18136,7 @@ const updateDebugInfo = async debugId => {
18073
18136
  ...newState,
18074
18137
  highlightedLine: newInfo.rowIndex
18075
18138
  };
18076
- set$9(key, oldState, newEditor);
18139
+ set$a(key, oldState, newEditor);
18077
18140
  // @ts-ignore
18078
18141
  await invoke$d('Editor.rerender', key);
18079
18142
  };
@@ -18170,7 +18233,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
18170
18233
  return returnState ? newEditor : undefined;
18171
18234
  }
18172
18235
  const newEditorWithDerivedState = await updateDerivedState(state, newEditor);
18173
- set$9(uid, state, newEditorWithDerivedState);
18236
+ set$a(uid, state, newEditorWithDerivedState);
18174
18237
  await dispose$3();
18175
18238
  if (editorDiagnosticEffect.isActive(state, newEditorWithDerivedState)) {
18176
18239
  void editorDiagnosticEffect.apply(newEditorWithDerivedState);
@@ -18199,7 +18262,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
18199
18262
  undoStack: finalEditor.undoStack,
18200
18263
  visualDecorations: finalEditor.visualDecorations
18201
18264
  });
18202
- set$9(otherUid, instance.oldState, synchronizedEditor);
18265
+ set$a(otherUid, instance.oldState, synchronizedEditor);
18203
18266
  if (editorDiagnosticEffect.isActive(editor, synchronizedEditor)) {
18204
18267
  void editorDiagnosticEffect.apply(synchronizedEditor);
18205
18268
  }
@@ -18578,7 +18641,7 @@ const initializeDragAndDropWorker = async () => {
18578
18641
  commandMap: {},
18579
18642
  send: sendMessagePortToDragAndDropWorker
18580
18643
  });
18581
- set$g(rpc);
18644
+ set$h(rpc);
18582
18645
  };
18583
18646
 
18584
18647
  const initializeErrorWorker = async () => {
@@ -18588,7 +18651,7 @@ const initializeErrorWorker = async () => {
18588
18651
  return sendMessagePortToErrorWorker(port, EditorWorker);
18589
18652
  }
18590
18653
  });
18591
- set$f(rpc);
18654
+ set$g(rpc);
18592
18655
  };
18593
18656
 
18594
18657
  const createExtensionManagementWorkerRpc = async () => {
@@ -18604,7 +18667,7 @@ const createExtensionManagementWorkerRpc = async () => {
18604
18667
  const initializeExtensionManagementWorker = async () => {
18605
18668
  try {
18606
18669
  const rpc = await createExtensionManagementWorkerRpc();
18607
- set$e(rpc);
18670
+ set$f(rpc);
18608
18671
  } catch {
18609
18672
  // ignore
18610
18673
  }
@@ -18619,14 +18682,14 @@ const initializeOpenerWorker = async () => {
18619
18682
  commandMap: {},
18620
18683
  send: send$1
18621
18684
  });
18622
- set$d(rpc);
18685
+ set$e(rpc);
18623
18686
  };
18624
18687
 
18625
18688
  const initializeRendererWorker = async () => {
18626
18689
  const rpc = await create$d({
18627
18690
  commandMap: commandMap
18628
18691
  });
18629
- set$b(rpc);
18692
+ set$c(rpc);
18630
18693
  };
18631
18694
 
18632
18695
  const send = port => {
@@ -18637,7 +18700,7 @@ const initializeTextMeasurementWorker = async () => {
18637
18700
  commandMap: {},
18638
18701
  send
18639
18702
  });
18640
- set$c(rpc);
18703
+ set$d(rpc);
18641
18704
  };
18642
18705
 
18643
18706
  const listen = async () => {
@@ -18647,7 +18710,7 @@ const listen = async () => {
18647
18710
  commandMap: {},
18648
18711
  send: sendMessagePortToDialogWorker
18649
18712
  });
18650
- set$h(dialogRpc);
18713
+ set$i(dialogRpc);
18651
18714
  };
18652
18715
 
18653
18716
  const CodeGeneratorInput = 'CodeGeneratorInput';
@@ -18969,15 +19032,15 @@ const EditorMessageWidget = {
18969
19032
  };
18970
19033
 
18971
19034
  const registerWidgets = () => {
18972
- set$8(ColorPicker$2, EditorColorPickerWidget);
18973
- set$8(Completion, EditorCompletionWidget);
18974
- set$8(CompletionDetail, EditorCompletionDetailWidget);
18975
- set$8(Find, EditorFindWidget);
18976
- set$8(Hover, EditorHoverWidget);
18977
- set$8(Message, EditorMessageWidget);
18978
- set$8(Rename$1, EditorRenameWidget);
18979
- set$8(SourceAction$1, EditorSourceActionWidget);
18980
- set$8(CodeGenerator, EditorCodeGeneratorWidget);
19035
+ set$9(ColorPicker$2, EditorColorPickerWidget);
19036
+ set$9(Completion, EditorCompletionWidget);
19037
+ set$9(CompletionDetail, EditorCompletionDetailWidget);
19038
+ set$9(Find, EditorFindWidget);
19039
+ set$9(Hover, EditorHoverWidget);
19040
+ set$9(Message, EditorMessageWidget);
19041
+ set$9(Rename$1, EditorRenameWidget);
19042
+ set$9(SourceAction$1, EditorSourceActionWidget);
19043
+ set$9(CodeGenerator, EditorCodeGeneratorWidget);
18981
19044
  };
18982
19045
 
18983
19046
  const handleUnhandledRejection = event => {
@@ -791,6 +791,16 @@
791
791
  "minimum": 0,
792
792
  "maximum": 10000
793
793
  },
794
+ {
795
+ "category": "text-editor",
796
+ "description": "Controls how long editor messages remain visible, in milliseconds",
797
+ "heading": "Message Display Duration",
798
+ "id": "editor.messageDelay",
799
+ "type": "number",
800
+ "value": 3000,
801
+ "minimum": 0,
802
+ "maximum": 10000
803
+ },
794
804
  {
795
805
  "category": "text-editor",
796
806
  "description": "Controls whether the editor should be in a diff editor",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.70.5",
3
+ "version": "19.70.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"