@lvce-editor/editor-worker 19.0.0 → 19.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.
@@ -674,7 +674,7 @@ const execute$1 = (command, ...args) => {
674
674
 
675
675
  const Two$1 = '2.0';
676
676
  const callbacks = Object.create(null);
677
- const get$8 = id => {
677
+ const get$9 = id => {
678
678
  return callbacks[id];
679
679
  };
680
680
  const remove$9 = id => {
@@ -823,7 +823,7 @@ const warn$1 = (...args) => {
823
823
  console.warn(...args);
824
824
  };
825
825
  const resolve = (id, response) => {
826
- const fn = get$8(id);
826
+ const fn = get$9(id);
827
827
  if (!fn) {
828
828
  console.log(response);
829
829
  warn$1(`callback ${id} may already be disposed`);
@@ -1225,10 +1225,10 @@ const createMockRpc = ({
1225
1225
  };
1226
1226
 
1227
1227
  const rpcs = Object.create(null);
1228
- const set$e = (id, rpc) => {
1228
+ const set$f = (id, rpc) => {
1229
1229
  rpcs[id] = rpc;
1230
1230
  };
1231
- const get$7 = id => {
1231
+ const get$8 = id => {
1232
1232
  return rpcs[id];
1233
1233
  };
1234
1234
  const remove$8 = id => {
@@ -1239,18 +1239,18 @@ const remove$8 = id => {
1239
1239
  const create$9 = rpcId => {
1240
1240
  return {
1241
1241
  async dispose() {
1242
- const rpc = get$7(rpcId);
1242
+ const rpc = get$8(rpcId);
1243
1243
  await rpc.dispose();
1244
1244
  },
1245
1245
  // @ts-ignore
1246
1246
  invoke(method, ...params) {
1247
- const rpc = get$7(rpcId);
1247
+ const rpc = get$8(rpcId);
1248
1248
  // @ts-ignore
1249
1249
  return rpc.invoke(method, ...params);
1250
1250
  },
1251
1251
  // @ts-ignore
1252
1252
  invokeAndTransfer(method, ...params) {
1253
- const rpc = get$7(rpcId);
1253
+ const rpc = get$8(rpcId);
1254
1254
  // @ts-ignore
1255
1255
  return rpc.invokeAndTransfer(method, ...params);
1256
1256
  },
@@ -1258,7 +1258,7 @@ const create$9 = rpcId => {
1258
1258
  const mockRpc = createMockRpc({
1259
1259
  commandMap
1260
1260
  });
1261
- set$e(rpcId, mockRpc);
1261
+ set$f(rpcId, mockRpc);
1262
1262
  // @ts-ignore
1263
1263
  mockRpc[Symbol.dispose] = () => {
1264
1264
  remove$8(rpcId);
@@ -1267,7 +1267,7 @@ const create$9 = rpcId => {
1267
1267
  return mockRpc;
1268
1268
  },
1269
1269
  set(rpc) {
1270
- set$e(rpcId, rpc);
1270
+ set$f(rpcId, rpc);
1271
1271
  }
1272
1272
  };
1273
1273
  };
@@ -1353,18 +1353,18 @@ const FocusEditorText$1 = 12;
1353
1353
 
1354
1354
  const {
1355
1355
  invoke: invoke$f,
1356
- set: set$d
1356
+ set: set$e
1357
1357
  } = create$9(ExtensionHostWorker);
1358
1358
 
1359
1359
  const ExtensionHost = {
1360
1360
  __proto__: null,
1361
1361
  invoke: invoke$f,
1362
- set: set$d
1362
+ set: set$e
1363
1363
  };
1364
1364
 
1365
1365
  const {
1366
1366
  invoke: invoke$e,
1367
- set: set$c
1367
+ set: set$d
1368
1368
  } = create$9(ExtensionManagementWorker);
1369
1369
  const getLanguages$1 = (platform, assetDir) => {
1370
1370
  return invoke$e('Extensions.getLanguages', platform, assetDir);
@@ -1372,7 +1372,7 @@ const getLanguages$1 = (platform, assetDir) => {
1372
1372
 
1373
1373
  const {
1374
1374
  invoke: invoke$d,
1375
- set: set$b
1375
+ set: set$c
1376
1376
  } = create$9(OpenerWorker);
1377
1377
  const openUrl = async (url, platform) => {
1378
1378
  return invoke$d('Open.openUrl', url, platform);
@@ -1380,13 +1380,13 @@ const openUrl = async (url, platform) => {
1380
1380
 
1381
1381
  const {
1382
1382
  invoke: invoke$c,
1383
- set: set$a
1383
+ set: set$b
1384
1384
  } = create$9(IconThemeWorker);
1385
1385
 
1386
1386
  const {
1387
1387
  invoke: invoke$b,
1388
1388
  invokeAndTransfer,
1389
- set: set$9
1389
+ set: set$a
1390
1390
  } = create$9(RendererWorker$1);
1391
1391
  const showContextMenu2 = async (uid, menuId, x, y, args) => {
1392
1392
  number(uid);
@@ -1451,20 +1451,20 @@ const RendererWorker = {
1451
1451
  sendMessagePortToOpenerWorker,
1452
1452
  sendMessagePortToSyntaxHighlightingWorker: sendMessagePortToSyntaxHighlightingWorker$1,
1453
1453
  sendMessagePortToTextMeasurementWorker,
1454
- set: set$9,
1454
+ set: set$a,
1455
1455
  showContextMenu2,
1456
1456
  writeClipBoardText
1457
1457
  };
1458
1458
 
1459
1459
  const {
1460
1460
  invoke: invoke$a,
1461
- set: set$8
1461
+ set: set$9
1462
1462
  } = create$9(MarkdownWorker);
1463
1463
 
1464
1464
  const SyntaxHighlightingWorker = {
1465
1465
  __proto__: null,
1466
1466
  invoke: invoke$a,
1467
- set: set$8
1467
+ set: set$9
1468
1468
  };
1469
1469
 
1470
1470
  const createLazyRpc = rpcId => {
@@ -1472,7 +1472,7 @@ const createLazyRpc = rpcId => {
1472
1472
  let factory;
1473
1473
  const createRpc = async () => {
1474
1474
  const rpc = await factory();
1475
- set$e(rpcId, rpc);
1475
+ set$f(rpcId, rpc);
1476
1476
  };
1477
1477
  const ensureRpc = async () => {
1478
1478
  if (!rpcPromise) {
@@ -1483,12 +1483,12 @@ const createLazyRpc = rpcId => {
1483
1483
  return {
1484
1484
  async invoke(method, ...params) {
1485
1485
  await ensureRpc();
1486
- const rpc = get$7(rpcId);
1486
+ const rpc = get$8(rpcId);
1487
1487
  return rpc.invoke(method, ...params);
1488
1488
  },
1489
1489
  async invokeAndTransfer(method, ...params) {
1490
1490
  await ensureRpc();
1491
- const rpc = get$7(rpcId);
1491
+ const rpc = get$8(rpcId);
1492
1492
  return rpc.invokeAndTransfer(method, ...params);
1493
1493
  },
1494
1494
  setFactory(value) {
@@ -1574,14 +1574,14 @@ const {
1574
1574
  registerCommands,
1575
1575
  wrapGetter
1576
1576
  } = editorStates;
1577
- const get$6 = id => {
1577
+ const get$7 = id => {
1578
1578
  return editorStates.get(id);
1579
1579
  };
1580
1580
  const getKeys$2 = () => {
1581
1581
  const keys = editorStates.getKeys();
1582
1582
  return keys.map(String);
1583
1583
  };
1584
- const set$7 = (id, oldEditor, newEditor) => {
1584
+ const set$8 = (id, oldEditor, newEditor) => {
1585
1585
  editorStates.set(id, oldEditor, newEditor);
1586
1586
  };
1587
1587
 
@@ -1672,7 +1672,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
1672
1672
  x,
1673
1673
  y
1674
1674
  };
1675
- set$7(id, editor, editor);
1675
+ set$8(id, editor, editor);
1676
1676
  };
1677
1677
 
1678
1678
  // TODO use numeric enum
@@ -1695,15 +1695,15 @@ const Rename = 'rename';
1695
1695
  const ToggleBlockComment$1 = 'toggleBlockComment';
1696
1696
 
1697
1697
  const map$1 = Object.create(null);
1698
- const set$6 = (id, widget) => {
1698
+ const set$7 = (id, widget) => {
1699
1699
  map$1[id] = widget;
1700
1700
  };
1701
- const get$5 = id => {
1701
+ const get$6 = id => {
1702
1702
  return map$1[id];
1703
1703
  };
1704
1704
 
1705
1705
  const getModule = id => {
1706
- return get$5(id);
1706
+ return get$6(id);
1707
1707
  };
1708
1708
 
1709
1709
  const applyWidgetChange = async (editor, widget, changes) => {
@@ -1935,7 +1935,7 @@ const getEnabled$1 = () => {
1935
1935
 
1936
1936
  const {
1937
1937
  invoke: invoke$8,
1938
- set: set$5
1938
+ set: set$6
1939
1939
  } = SyntaxHighlightingWorker;
1940
1940
 
1941
1941
  const state$c = {
@@ -1946,10 +1946,10 @@ const state$c = {
1946
1946
  const has = languageId => {
1947
1947
  return Object.hasOwn(state$c.tokenizers, languageId);
1948
1948
  };
1949
- const set$4 = (languageId, tokenizer) => {
1949
+ const set$5 = (languageId, tokenizer) => {
1950
1950
  state$c.tokenizers[languageId] = tokenizer;
1951
1951
  };
1952
- const get$4 = languageId => {
1952
+ const get$5 = languageId => {
1953
1953
  return state$c.tokenizers[languageId];
1954
1954
  };
1955
1955
  const setTokenizePath = (languageId, tokenizePath) => {
@@ -1970,10 +1970,10 @@ const isPending = languageId => {
1970
1970
  };
1971
1971
 
1972
1972
  const tokenMaps = Object.create(null);
1973
- const set$3 = (languageId, tokenMap) => {
1973
+ const set$4 = (languageId, tokenMap) => {
1974
1974
  tokenMaps[languageId] = tokenMap;
1975
1975
  };
1976
- const get$3 = languageId => {
1976
+ const get$4 = languageId => {
1977
1977
  return tokenMaps[languageId] || {};
1978
1978
  };
1979
1979
 
@@ -1986,7 +1986,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
1986
1986
  if (getEnabled$1()) {
1987
1987
  // @ts-ignore
1988
1988
  const tokenMap = await invoke$8('Tokenizer.load', languageId, tokenizePath);
1989
- set$3(languageId, tokenMap);
1989
+ set$4(languageId, tokenMap);
1990
1990
  return;
1991
1991
  }
1992
1992
  try {
@@ -2002,8 +2002,8 @@ const loadTokenizer = async (languageId, tokenizePath) => {
2002
2002
  console.warn(`tokenizer.TokenMap should be an object in "${tokenizePath}"`);
2003
2003
  return;
2004
2004
  }
2005
- set$3(languageId, tokenizer.TokenMap);
2006
- set$4(languageId, tokenizer);
2005
+ set$4(languageId, tokenizer.TokenMap);
2006
+ set$5(languageId, tokenizer);
2007
2007
  } catch (error) {
2008
2008
  // TODO better error handling
2009
2009
  console.error(error);
@@ -2011,7 +2011,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
2011
2011
  };
2012
2012
  const getTokenizer = languageId => {
2013
2013
  if (has(languageId)) {
2014
- return get$4(languageId);
2014
+ return get$5(languageId);
2015
2015
  }
2016
2016
  if (isPending(languageId)) {
2017
2017
  return TokenizePlainText;
@@ -2020,10 +2020,10 @@ const getTokenizer = languageId => {
2020
2020
  };
2021
2021
 
2022
2022
  const tokenizers = Object.create(null);
2023
- const set$2 = (id, value) => {
2023
+ const set$3 = (id, value) => {
2024
2024
  tokenizers[id] = value;
2025
2025
  };
2026
- const get$2 = id => {
2026
+ const get$3 = id => {
2027
2027
  return tokenizers[id] || TokenizePlainText;
2028
2028
  };
2029
2029
 
@@ -2105,7 +2105,7 @@ const getTokensViewport = (editor, startLineIndex, endLineIndex) => {
2105
2105
  lines,
2106
2106
  tokenizerId
2107
2107
  } = editor;
2108
- const tokenizer = get$2(tokenizerId);
2108
+ const tokenizer = get$3(tokenizerId);
2109
2109
  const {
2110
2110
  hasArrayReturn,
2111
2111
  initialLineState,
@@ -2686,7 +2686,7 @@ const getLineInfosViewport = (editor, tokens, embeddedResults, minLineY, maxLine
2686
2686
  languageId,
2687
2687
  lines
2688
2688
  } = editor;
2689
- const tokenMap = get$3(languageId);
2689
+ const tokenMap = get$4(languageId);
2690
2690
  let offset = minLineOffset;
2691
2691
  const tabSize = 2;
2692
2692
  for (let i = minLineY; i < maxLineY; i++) {
@@ -3056,7 +3056,7 @@ const notifyListeners = async (listenerType, method, ...params) => {
3056
3056
  // Notify all listeners in parallel
3057
3057
  const notifications = rpcIds.map(async rpcId => {
3058
3058
  try {
3059
- const rpc = get$7(rpcId);
3059
+ const rpc = get$8(rpcId);
3060
3060
  if (rpc) {
3061
3061
  await rpc.invoke(method, ...params);
3062
3062
  }
@@ -3516,7 +3516,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
3516
3516
  ...newEditor,
3517
3517
  decorations: linkDecorations
3518
3518
  };
3519
- set$7(editor.uid, editor, newEditorWithDecorations);
3519
+ set$8(editor.uid, editor, newEditorWithDecorations);
3520
3520
 
3521
3521
  // Notify main-area-worker about modified status change
3522
3522
  if (!editor.modified) {
@@ -3722,7 +3722,7 @@ const TextDocumentSyncFull = 'ExtensionHostTextDocument.syncFull';
3722
3722
 
3723
3723
  const {
3724
3724
  invoke: invoke$6,
3725
- set: set$1
3725
+ set: set$2
3726
3726
  } = ExtensionHost;
3727
3727
 
3728
3728
  const getFileExtensionIndex = file => {
@@ -3788,7 +3788,7 @@ const measureCharacterWidth = async (fontWeight, fontSize, fontFamily, letterSpa
3788
3788
  return await measureTextWidth('a', fontWeight, fontSize, fontFamily, letterSpacing, false, 0);
3789
3789
  };
3790
3790
 
3791
- const get$1 = async key => {
3791
+ const get$2 = async key => {
3792
3792
  const value = await getPreference(key);
3793
3793
  return value;
3794
3794
  };
@@ -3933,7 +3933,7 @@ const updateDiagnostics = async newState => {
3933
3933
  // @ts-ignore
3934
3934
  await invoke$6(TextDocumentSyncFull, newState.uri, newState.id, newState.languageId, content);
3935
3935
  const diagnostics = await executeDiagnosticProvider(newState);
3936
- const latest = get$6(newState.id);
3936
+ const latest = get$7(newState.id);
3937
3937
  if (!latest) {
3938
3938
  return newState;
3939
3939
  }
@@ -3949,7 +3949,7 @@ const updateDiagnostics = async newState => {
3949
3949
  diagnostics,
3950
3950
  visualDecorations // Visual decorations (objects with x, y, width, height) for squiggly underlines
3951
3951
  };
3952
- set$7(newState.id, latest.oldState, newEditor);
3952
+ set$8(newState.id, latest.oldState, newEditor);
3953
3953
  // @ts-ignore
3954
3954
  await invoke$b('Editor.rerender', newState.id);
3955
3955
  return newEditor;
@@ -4102,7 +4102,7 @@ const createEditor = async ({
4102
4102
  focused: true,
4103
4103
  textInfos
4104
4104
  };
4105
- set$7(id, emptyEditor, newEditor4);
4105
+ set$8(id, emptyEditor, newEditor4);
4106
4106
 
4107
4107
  // TODO only sync when needed
4108
4108
  // e.g. it might not always be necessary to send text to extension host worker
@@ -4113,9 +4113,9 @@ const createEditor = async ({
4113
4113
  if (diagnosticsEnabled) {
4114
4114
  await updateDiagnostics(newEditor4);
4115
4115
  }
4116
- const completionsOnTypeRaw = await get$1('editor.completionsOnType');
4116
+ const completionsOnTypeRaw = await get$2('editor.completionsOnType');
4117
4117
  const completionsOnType = Boolean(completionsOnTypeRaw);
4118
- set$7(id, emptyEditor, {
4118
+ set$8(id, emptyEditor, {
4119
4119
  ...newEditor4,
4120
4120
  completionsOnType
4121
4121
  });
@@ -4159,7 +4159,7 @@ const diff2 = uid => {
4159
4159
  const {
4160
4160
  newState,
4161
4161
  oldState
4162
- } = get$6(uid);
4162
+ } = get$7(uid);
4163
4163
  const result = diff(oldState, newState);
4164
4164
  return result;
4165
4165
  };
@@ -4716,7 +4716,7 @@ const closeRename = async editor => {
4716
4716
  }
4717
4717
  const renameWidget = widgets[renameWidgetIndex];
4718
4718
  await invoke$5('Rename.close', renameWidget.newState.uid);
4719
- const latest = get$6(uid);
4719
+ const latest = get$7(uid);
4720
4720
  const {
4721
4721
  newState
4722
4722
  } = latest;
@@ -6198,10 +6198,10 @@ const state$5 = {
6198
6198
  x: 0,
6199
6199
  y: 0
6200
6200
  };
6201
- const get = () => {
6201
+ const get$1 = () => {
6202
6202
  return state$5;
6203
6203
  };
6204
- const set = (editor, timeout, x, y) => {
6204
+ const set$1 = (editor, timeout, x, y) => {
6205
6205
  state$5.editor = editor;
6206
6206
  state$5.timeout = timeout;
6207
6207
  state$5.x = x;
@@ -6227,7 +6227,7 @@ const onHoverIdle = async () => {
6227
6227
  editor,
6228
6228
  x,
6229
6229
  y
6230
- } = get();
6230
+ } = get$1();
6231
6231
  await at(editor, x, y);
6232
6232
  await showHover$1();
6233
6233
  };
@@ -6238,12 +6238,12 @@ const handleMouseMove = (editor, x, y) => {
6238
6238
  if (!editor.hoverEnabled) {
6239
6239
  return editor;
6240
6240
  }
6241
- const oldState = get();
6241
+ const oldState = get$1();
6242
6242
  if (oldState.timeout !== -1) {
6243
6243
  clearTimeout(oldState.timeout);
6244
6244
  }
6245
6245
  const timeout = setTimeout(onHoverIdle, hoverDelay);
6246
- set(editor, timeout, x, y);
6246
+ set$1(editor, timeout, x, y);
6247
6247
  return editor;
6248
6248
  };
6249
6249
 
@@ -7083,7 +7083,7 @@ const newStateGenerator$4 = async (state, parentUid) => {
7083
7083
  } = state;
7084
7084
  const {
7085
7085
  newState
7086
- } = get$6(parentUid);
7086
+ } = get$7(parentUid);
7087
7087
  const {
7088
7088
  languageId
7089
7089
  } = newState;
@@ -7136,18 +7136,18 @@ const launchFindWidgetWorker = async () => {
7136
7136
  const rpcId = 9002;
7137
7137
  const launch = async () => {
7138
7138
  // TODO race condition
7139
- if (get$7(rpcId)) {
7139
+ if (get$8(rpcId)) {
7140
7140
  return;
7141
7141
  }
7142
7142
  const rpc = await launchFindWidgetWorker();
7143
- set$e(rpcId, rpc);
7143
+ set$f(rpcId, rpc);
7144
7144
  };
7145
7145
  const invoke$3 = async (method, ...params) => {
7146
- const rpc = get$7(rpcId);
7146
+ const rpc = get$8(rpcId);
7147
7147
  return await rpc.invoke(method, ...params);
7148
7148
  };
7149
7149
  const dispose = async () => {
7150
- const rpc = get$7(rpcId);
7150
+ const rpc = get$8(rpcId);
7151
7151
  remove$8(rpcId);
7152
7152
  if (rpc) {
7153
7153
  await rpc.dispose();
@@ -7159,7 +7159,7 @@ const dispose = async () => {
7159
7159
  };
7160
7160
 
7161
7161
  const getEditor = editorUid => {
7162
- const instance = get$6(editorUid);
7162
+ const instance = get$7(editorUid);
7163
7163
  if (!instance) {
7164
7164
  throw new Error(`editor ${editorUid} not found`);
7165
7165
  }
@@ -7253,7 +7253,7 @@ const newStateGenerator$2 = async (state, parentUid) => {
7253
7253
  } = state;
7254
7254
  const {
7255
7255
  newState
7256
- } = get$6(parentUid);
7256
+ } = get$7(parentUid);
7257
7257
  const {
7258
7258
  languageId
7259
7259
  } = newState;
@@ -8076,7 +8076,7 @@ const setLanguageId = async (editor, languageId, tokenizePath) => {
8076
8076
  await loadTokenizer(languageId, tokenizePath);
8077
8077
  const tokenizer = getTokenizer(languageId);
8078
8078
  const newTokenizerId = tokenizerId + 1;
8079
- set$2(newTokenizerId, tokenizer);
8079
+ set$3(newTokenizerId, tokenizer);
8080
8080
  const latest = getEditor(editor.uid);
8081
8081
  if (!latest) {
8082
8082
  return editor;
@@ -8231,7 +8231,7 @@ const newStateGenerator$1 = async (state, parentUid) => {
8231
8231
  } = state;
8232
8232
  const {
8233
8233
  newState
8234
- } = get$6(parentUid);
8234
+ } = get$7(parentUid);
8235
8235
  const {
8236
8236
  languageId
8237
8237
  } = newState;
@@ -8315,7 +8315,7 @@ const newStateGenerator = async (state, parentUid) => {
8315
8315
  } = state;
8316
8316
  const {
8317
8317
  newState
8318
- } = get$6(parentUid);
8318
+ } = get$7(parentUid);
8319
8319
  const {
8320
8320
  languageId
8321
8321
  } = newState;
@@ -9227,7 +9227,7 @@ const createFn = (key, name, widgetId) => {
9227
9227
  ...state,
9228
9228
  commands
9229
9229
  };
9230
- const latest = get$6(editor.uid).newState;
9230
+ const latest = get$7(editor.uid).newState;
9231
9231
  const newEditor = updateWidget(latest, widgetId, newState);
9232
9232
  return newEditor;
9233
9233
  };
@@ -9542,7 +9542,7 @@ const getHoverPositionXy = (editor, rowIndex, wordStart, documentationHeight) =>
9542
9542
  };
9543
9543
  const getEditorHoverInfo = async (editorUid, position) => {
9544
9544
  number(editorUid);
9545
- const instance = get$6(editorUid);
9545
+ const instance = get$7(editorUid);
9546
9546
  const editor = instance.newState;
9547
9547
  const {
9548
9548
  selections
@@ -9951,7 +9951,7 @@ const getEditorSourceActions = async editorId => {
9951
9951
  }
9952
9952
  const {
9953
9953
  newState
9954
- } = get$6(editorId);
9954
+ } = get$7(editorId);
9955
9955
  const {
9956
9956
  languageId
9957
9957
  } = newState;
@@ -10096,7 +10096,7 @@ const setSelections2 = async (editorUid, selections) => {
10096
10096
  selections
10097
10097
  };
10098
10098
  const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
10099
- set$7(editorUid, editor, newEditorWithDerivedState);
10099
+ set$8(editorUid, editor, newEditorWithDerivedState);
10100
10100
  };
10101
10101
  const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocus$1) => {
10102
10102
  const editor = getEditor(editorUid);
@@ -10116,7 +10116,7 @@ const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocu
10116
10116
  widgets: newWidgets
10117
10117
  };
10118
10118
  const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
10119
- set$7(editorUid, editor, newEditorWithDerivedState);
10119
+ set$8(editorUid, editor, newEditorWithDerivedState);
10120
10120
  await setFocus(FocusEditorText);
10121
10121
  if (unsetAdditionalFocus$1) {
10122
10122
  await unsetAdditionalFocus(unsetAdditionalFocus$1);
@@ -10129,7 +10129,7 @@ const applyEdits2 = async (editorUid, edits) => {
10129
10129
  const editor = getEditor(editorUid);
10130
10130
  const newEditor = await applyEdit(editor, edits);
10131
10131
  const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
10132
- set$7(editorUid, editor, newEditorWithDerivedState);
10132
+ set$8(editorUid, editor, newEditorWithDerivedState);
10133
10133
  };
10134
10134
  const getSourceActions = async editorUid => {
10135
10135
  const actions = await getEditorSourceActions(editorUid);
@@ -10592,7 +10592,7 @@ const getProblems = async () => {
10592
10592
  const keys = getKeys$2();
10593
10593
  const editors = keys.map(key => {
10594
10594
  const numericKey = parseInt(key);
10595
- const editor = get$6(numericKey);
10595
+ const editor = get$7(numericKey);
10596
10596
  return editor;
10597
10597
  });
10598
10598
  const newEditors = editors.map(editor => editor.newState);
@@ -10707,7 +10707,7 @@ const handleMessagePort = async (port, rpcId) => {
10707
10707
  messagePort: port
10708
10708
  });
10709
10709
  if (rpcId) {
10710
- set$e(rpcId, rpc);
10710
+ set$f(rpcId, rpc);
10711
10711
  }
10712
10712
  };
10713
10713
 
@@ -10740,7 +10740,7 @@ const getWidgetName = widgetId => {
10740
10740
  const saveWidgetState = async keys => {
10741
10741
  const savedStates = Object.create(null);
10742
10742
  for (const key of keys) {
10743
- const editor = get$6(parseInt(key));
10743
+ const editor = get$7(parseInt(key));
10744
10744
  const {
10745
10745
  widgets
10746
10746
  } = editor.newState;
@@ -10759,7 +10759,7 @@ const restoreWidgetState = async (keys, savedStates) => {
10759
10759
  const newEditors = [];
10760
10760
  for (const key of keys) {
10761
10761
  const editorUid = parseInt(key);
10762
- const editor = get$6(editorUid);
10762
+ const editor = get$7(editorUid);
10763
10763
  const {
10764
10764
  widgets
10765
10765
  } = editor.newState;
@@ -10808,7 +10808,7 @@ const hotReload = async () => {
10808
10808
  await relaunchWorkers();
10809
10809
  const newEditors = await restoreWidgetState(keys, savedStates);
10810
10810
  for (const editor of newEditors) {
10811
- set$7(editor.newState.uid, editor.oldState, editor.newState);
10811
+ set$8(editor.newState.uid, editor.oldState, editor.newState);
10812
10812
  }
10813
10813
 
10814
10814
  // TODO ask renderer worker to rerender all editors
@@ -10844,7 +10844,7 @@ const initializeSyntaxHighlighting = async (syntaxHighlightingEnabled, syncIncre
10844
10844
  if (syntaxHighlightingEnabled) {
10845
10845
  setEnabled$1(true);
10846
10846
  const syntaxRpc = await createSyntaxHighlightingWorkerRpc();
10847
- set$5(syntaxRpc);
10847
+ set$6(syntaxRpc);
10848
10848
  }
10849
10849
  if (syncIncremental) {
10850
10850
  setEnabled(true);
@@ -10876,46 +10876,46 @@ const kAutoClosingQuotes = 'editor.autoClosingQuotes';
10876
10876
  const kAutoClosingBrackets = 'editor.autoclosingBrackets';
10877
10877
  const kFontWeight = 'editor.fontWeight';
10878
10878
  const isAutoClosingBracketsEnabled = async () => {
10879
- return Boolean(await get$1(kAutoClosingBrackets));
10879
+ return Boolean(await get$2(kAutoClosingBrackets));
10880
10880
  };
10881
10881
  const isAutoClosingQuotesEnabled = async () => {
10882
- return Boolean(await get$1(kAutoClosingQuotes));
10882
+ return Boolean(await get$2(kAutoClosingQuotes));
10883
10883
  };
10884
10884
  const isQuickSuggestionsEnabled = async () => {
10885
- return Boolean(await get$1(kQuickSuggestions));
10885
+ return Boolean(await get$2(kQuickSuggestions));
10886
10886
  };
10887
10887
  const isAutoClosingTagsEnabled = async () => {
10888
10888
  return true;
10889
10889
  };
10890
10890
  const getRowHeight = async () => {
10891
- return (await get$1(kLineHeight)) || 20;
10891
+ return (await get$2(kLineHeight)) || 20;
10892
10892
  };
10893
10893
  const getFontSize = async () => {
10894
- return (await get$1(kFontSize)) || 15; // TODO find out if it is possible to use all numeric values for settings for efficiency, maybe settings could be an array
10894
+ return (await get$2(kFontSize)) || 15; // TODO find out if it is possible to use all numeric values for settings for efficiency, maybe settings could be an array
10895
10895
  };
10896
10896
  const getFontFamily = async () => {
10897
- return (await get$1(kFontFamily)) || 'Fira Code';
10897
+ return (await get$2(kFontFamily)) || 'Fira Code';
10898
10898
  };
10899
10899
  const getLetterSpacing = async () => {
10900
10900
  // if (!false) {
10901
10901
  // return 0
10902
10902
  // }
10903
- return (await get$1(kLetterSpacing)) ?? 0.5;
10903
+ return (await get$2(kLetterSpacing)) ?? 0.5;
10904
10904
  };
10905
10905
  const getTabSize = async () => {
10906
- return (await get$1(kTabSize)) || 2;
10906
+ return (await get$2(kTabSize)) || 2;
10907
10907
  };
10908
10908
  const getLineNumbers = async () => {
10909
- return (await get$1(kLineNumbers)) ?? false;
10909
+ return (await get$2(kLineNumbers)) ?? false;
10910
10910
  };
10911
10911
  const getCompletionTriggerCharacters = async () => {
10912
10912
  return ['.', '/'];
10913
10913
  };
10914
10914
  const diagnosticsEnabled = async () => {
10915
- return (await get$1(kDiagnostics)) ?? false;
10915
+ return (await get$2(kDiagnostics)) ?? false;
10916
10916
  };
10917
10917
  const getFontWeight = async () => {
10918
- return (await get$1(kFontWeight)) ?? 400;
10918
+ return (await get$2(kFontWeight)) ?? 400;
10919
10919
  };
10920
10920
 
10921
10921
  const getEditorPreferences = async () => {
@@ -10980,7 +10980,7 @@ const loadContent = async (state, savedState) => {
10980
10980
  await loadTokenizer(computedLanguageId, tokenizePath);
10981
10981
  const tokenizer = getTokenizer(computedLanguageId);
10982
10982
  const newTokenizerId = state.tokenizerId + 1;
10983
- set$2(newTokenizerId, tokenizer);
10983
+ set$3(newTokenizerId, tokenizer);
10984
10984
  const newEditor0 = {
10985
10985
  ...state,
10986
10986
  charWidth,
@@ -11035,7 +11035,7 @@ const loadContent = async (state, savedState) => {
11035
11035
  if (diagnosticsEnabled) {
11036
11036
  await updateDiagnostics(newEditor4);
11037
11037
  }
11038
- const completionsOnTypeRaw = await get$1('editor.completionsOnType');
11038
+ const completionsOnTypeRaw = await get$2('editor.completionsOnType');
11039
11039
  const completionsOnType = Boolean(completionsOnTypeRaw);
11040
11040
  const newEditor5 = {
11041
11041
  ...newEditor4,
@@ -11701,6 +11701,14 @@ const getEditorVirtualDom = ({
11701
11701
  })];
11702
11702
  };
11703
11703
 
11704
+ const renderedDoms = new Map();
11705
+ const get = uid => {
11706
+ return renderedDoms.get(uid);
11707
+ };
11708
+ const set = (uid, dom) => {
11709
+ renderedDoms.set(uid, dom);
11710
+ };
11711
+
11704
11712
  const getDom = state => {
11705
11713
  const {
11706
11714
  initial,
@@ -11711,13 +11719,24 @@ const getDom = state => {
11711
11719
  }
11712
11720
  return getEditorVirtualDom(state);
11713
11721
  };
11722
+ const isFastScroll = (oldState, newState) => {
11723
+ return Math.abs(newState.minLineY - oldState.minLineY) > 1;
11724
+ };
11714
11725
  const renderIncremental = (oldState, newState) => {
11715
- const oldDom = getDom(oldState);
11726
+ const oldDom = oldState.initial ? getDom(oldState) : get(newState.uid) || getDom(oldState);
11716
11727
  const newDom = getDom(newState);
11728
+ if (isFastScroll(oldState, newState)) {
11729
+ set(newState.uid, newDom);
11730
+ return [SetPatches, newState.uid, [{
11731
+ nodes: newDom,
11732
+ type: 6
11733
+ }]];
11734
+ }
11717
11735
  const patches = diffTree(oldDom, newDom);
11718
11736
  if (patches.length === 0) {
11719
11737
  return [];
11720
11738
  }
11739
+ set(newState.uid, newDom);
11721
11740
  return [SetPatches, newState.uid, patches];
11722
11741
  };
11723
11742
 
@@ -11752,28 +11771,28 @@ const render2 = (uid, diffResult) => {
11752
11771
  const {
11753
11772
  newState,
11754
11773
  oldState
11755
- } = get$6(uid);
11756
- set$7(uid, newState, newState);
11774
+ } = get$7(uid);
11775
+ set$8(uid, newState, newState);
11757
11776
  const commands = applyRender(oldState, newState, diffResult);
11758
11777
  return commands;
11759
11778
  };
11760
11779
 
11761
11780
  const addWidget = widget => {
11762
- const module = get$5(widget.id);
11781
+ const module = get$6(widget.id);
11763
11782
  if (!module) {
11764
11783
  throw new Error('unsupported widget');
11765
11784
  }
11766
11785
  return module.add(widget);
11767
11786
  };
11768
11787
  const renderWidget = widget => {
11769
- const module = get$5(widget.id);
11788
+ const module = get$6(widget.id);
11770
11789
  if (!module) {
11771
11790
  throw new Error('unsupported widget');
11772
11791
  }
11773
11792
  return module.render(widget);
11774
11793
  };
11775
11794
  const removeWidget = widget => {
11776
- const module = get$5(widget.id);
11795
+ const module = get$6(widget.id);
11777
11796
  if (!module) {
11778
11797
  throw new Error('unsupported widget');
11779
11798
  }
@@ -11931,7 +11950,7 @@ const renderWidgets = {
11931
11950
  };
11932
11951
  const render$6 = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets, renderFocusContext, renderAdditionalFocusContext];
11933
11952
  const renderEditor = async id => {
11934
- const instance = get$6(id);
11953
+ const instance = get$7(id);
11935
11954
  if (!instance) {
11936
11955
  return [];
11937
11956
  }
@@ -11940,7 +11959,7 @@ const renderEditor = async id => {
11940
11959
  oldState
11941
11960
  } = instance;
11942
11961
  const commands = [];
11943
- set$7(id, newState, newState);
11962
+ set$8(id, newState, newState);
11944
11963
  for (const item of render$6) {
11945
11964
  if (item.isEqual(oldState, newState)) {
11946
11965
  continue;
@@ -12065,7 +12084,7 @@ const unregisterListener = (listenerType, rpcId) => {
12065
12084
  };
12066
12085
 
12067
12086
  const invoke = async (method, ...params) => {
12068
- const worker = get$7(DebugWorker);
12087
+ const worker = get$8(DebugWorker);
12069
12088
  return worker.invoke(method, ...params);
12070
12089
  };
12071
12090
 
@@ -12081,7 +12100,7 @@ const getKey = () => {
12081
12100
  const updateDebugInfo = async debugId => {
12082
12101
  const newInfo = await getDebugHighlight(debugId);
12083
12102
  const key = getKey();
12084
- const instance = get$6(key);
12103
+ const instance = get$7(key);
12085
12104
  if (!instance) {
12086
12105
  return;
12087
12106
  }
@@ -12093,7 +12112,7 @@ const updateDebugInfo = async debugId => {
12093
12112
  ...newState,
12094
12113
  highlightedLine: newInfo.rowIndex
12095
12114
  };
12096
- set$7(key, oldState, newEditor);
12115
+ set$8(key, oldState, newEditor);
12097
12116
  // @ts-ignore
12098
12117
  await invoke$b('Editor.rerender', key);
12099
12118
  };
@@ -12102,7 +12121,7 @@ const updateDebugInfo = async debugId => {
12102
12121
  // TODO only store editor state in editor worker, not in renderer worker also
12103
12122
 
12104
12123
  const wrapCommand = fn => async (editorUid, ...args) => {
12105
- const oldInstance = get$6(editorUid);
12124
+ const oldInstance = get$7(editorUid);
12106
12125
  const state = oldInstance.newState;
12107
12126
  const newEditor = await fn(state, ...args);
12108
12127
  if (state === newEditor) {
@@ -12114,7 +12133,7 @@ const wrapCommand = fn => async (editorUid, ...args) => {
12114
12133
 
12115
12134
  // TODO combine neweditor with latest editor?
12116
12135
 
12117
- set$7(editorUid, state, newEditorWithDerivedState);
12136
+ set$8(editorUid, state, newEditorWithDerivedState);
12118
12137
  return newEditorWithDerivedState;
12119
12138
  };
12120
12139
 
@@ -12395,7 +12414,7 @@ const createExtensionHostRpc = async () => {
12395
12414
 
12396
12415
  const initializeExtensionHost = async () => {
12397
12416
  const extensionHostRpc = await createExtensionHostRpc();
12398
- set$1(extensionHostRpc);
12417
+ set$2(extensionHostRpc);
12399
12418
  };
12400
12419
 
12401
12420
  const createExtensionManagementWorkerRpc = async () => {
@@ -12411,7 +12430,7 @@ const createExtensionManagementWorkerRpc = async () => {
12411
12430
  const initializeExtensionManagementWorker = async () => {
12412
12431
  try {
12413
12432
  const rpc = await createExtensionManagementWorkerRpc();
12414
- set$c(rpc);
12433
+ set$d(rpc);
12415
12434
  } catch {
12416
12435
  // ignore
12417
12436
  }
@@ -12426,14 +12445,14 @@ const initializeOpenerWorker = async () => {
12426
12445
  commandMap: {},
12427
12446
  send: send$1
12428
12447
  });
12429
- set$b(rpc);
12448
+ set$c(rpc);
12430
12449
  };
12431
12450
 
12432
12451
  const initializeRendererWorker = async () => {
12433
12452
  const rpc = await create$a({
12434
12453
  commandMap: commandMap
12435
12454
  });
12436
- set$9(rpc);
12455
+ set$a(rpc);
12437
12456
  };
12438
12457
 
12439
12458
  const send = port => {
@@ -12444,7 +12463,7 @@ const initializeTextMeasurementWorker = async () => {
12444
12463
  commandMap: {},
12445
12464
  send
12446
12465
  });
12447
- set$a(rpc);
12466
+ set$b(rpc);
12448
12467
  };
12449
12468
 
12450
12469
  const listen = async () => {
@@ -12729,14 +12748,14 @@ const EditorHoverWidget = {
12729
12748
  };
12730
12749
 
12731
12750
  const registerWidgets = () => {
12732
- set$6(ColorPicker$1, EditorColorPickerWidget);
12733
- set$6(Completion, EditorCompletionWidget);
12734
- set$6(CompletionDetail, EditorCompletionDetailWidget);
12735
- set$6(Find, EditorFindWidget);
12736
- set$6(Hover, EditorHoverWidget);
12737
- set$6(Rename$1, EditorRenameWidget);
12738
- set$6(SourceAction$1, EditorSourceActionWidget);
12739
- set$6(CodeGenerator, EditorCodeGeneratorWidget);
12751
+ set$7(ColorPicker$1, EditorColorPickerWidget);
12752
+ set$7(Completion, EditorCompletionWidget);
12753
+ set$7(CompletionDetail, EditorCompletionDetailWidget);
12754
+ set$7(Find, EditorFindWidget);
12755
+ set$7(Hover, EditorHoverWidget);
12756
+ set$7(Rename$1, EditorRenameWidget);
12757
+ set$7(SourceAction$1, EditorSourceActionWidget);
12758
+ set$7(CodeGenerator, EditorCodeGeneratorWidget);
12740
12759
  };
12741
12760
 
12742
12761
  const handleUnhandledRejection = event => {