@lvce-editor/editor-worker 19.62.2 → 19.63.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.
@@ -2092,6 +2092,13 @@ const getViewportLineIndices = (lineCount, ranges, startVisualRow, numberOfVisib
2092
2092
  }
2093
2093
  return result;
2094
2094
  };
2095
+ const getLongestLineWidth = (lines, charWidth) => {
2096
+ let longest = 0;
2097
+ for (const line of lines) {
2098
+ longest = Math.max(longest, line.length);
2099
+ }
2100
+ return longest * charWidth;
2101
+ };
2095
2102
  const updateLayout = (editor, foldingRanges) => {
2096
2103
  const {
2097
2104
  height,
@@ -2124,6 +2131,9 @@ const updateLayout = (editor, foldingRanges) => {
2124
2131
  finalY,
2125
2132
  foldingRanges,
2126
2133
  maxLineY,
2134
+ ...(editor.largeFile && {
2135
+ longestLineWidth: getLongestLineWidth(lines, editor.charWidth)
2136
+ }),
2127
2137
  mergeConflicts,
2128
2138
  minLineY,
2129
2139
  scrollBarHeight,
@@ -2325,6 +2335,46 @@ const getDecorationClassName = type => {
2325
2335
  }
2326
2336
  };
2327
2337
 
2338
+ // Large files have no token cache. Only materialize the text inside the horizontal viewport.
2339
+ const getLargeFileVisible = editor => {
2340
+ const {
2341
+ deltaX,
2342
+ lines,
2343
+ tabSize,
2344
+ visibleLineIndices,
2345
+ width
2346
+ } = editor;
2347
+ const charWidth = editor.charWidth || 8;
2348
+ const firstColumn = Math.max(0, Math.floor(deltaX / charWidth));
2349
+ const lastColumn = firstColumn + Math.ceil(width / charWidth) + 2;
2350
+ const textInfos = [];
2351
+ const differences = [];
2352
+ for (const row of visibleLineIndices) {
2353
+ const line = lines[row];
2354
+ let text = '';
2355
+ if (line.includes('\t')) {
2356
+ let column = 0;
2357
+ for (let index = 0; index < line.length && column < lastColumn; index++) {
2358
+ const character = line[index];
2359
+ const length = character === '\t' ? Math.max(1, tabSize) : 1;
2360
+ const end = column + length;
2361
+ if (end > firstColumn) {
2362
+ text += character === '\t' ? ' '.repeat(Math.min(end, lastColumn) - Math.max(column, firstColumn)) : character;
2363
+ }
2364
+ column = end;
2365
+ }
2366
+ } else {
2367
+ text = line.slice(firstColumn, lastColumn);
2368
+ }
2369
+ textInfos.push([text, 'Token Text']);
2370
+ differences.push(firstColumn * charWidth - deltaX);
2371
+ }
2372
+ return {
2373
+ differences,
2374
+ textInfos
2375
+ };
2376
+ };
2377
+
2328
2378
  const deepCopy = value => {
2329
2379
  return structuredClone(value);
2330
2380
  };
@@ -3229,6 +3279,9 @@ const getLineInfosViewport = (editor, tokens, embeddedResults, minLineY, maxLine
3229
3279
  };
3230
3280
  };
3231
3281
  const getVisible$1 = async (editor, syncIncremental) => {
3282
+ if (editor.largeFile) {
3283
+ return getLargeFileVisible(editor);
3284
+ }
3232
3285
  // TODO should separate rendering from business logic somehow
3233
3286
  // currently hard to test because need to mock editor height, top, left,
3234
3287
  // invalidStartIndex, lineCache, etc. just for testing editorType
@@ -3458,6 +3511,9 @@ const detectLinks = text => {
3458
3511
  */
3459
3512
  const detectAllLinksAsDecorations = editor => {
3460
3513
  const decorations = [];
3514
+ if (editor.largeFile) {
3515
+ return decorations;
3516
+ }
3461
3517
  const {
3462
3518
  lines
3463
3519
  } = editor;
@@ -4524,6 +4580,9 @@ const getProviderDecorations$1 = results => {
4524
4580
  return decorations;
4525
4581
  };
4526
4582
  const getEditorGutterDecorations = async editor => {
4583
+ if (editor.largeFile) {
4584
+ return [];
4585
+ }
4527
4586
  const textDocument = {
4528
4587
  languageId: editor.languageId,
4529
4588
  text: getText$1(editor),
@@ -5188,6 +5247,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir, _langua
5188
5247
  height,
5189
5248
  highlightActiveLineNumber: true,
5190
5249
  highlightedLine: -1,
5250
+ hoverDelay: 200,
5191
5251
  hoverEnabled: false,
5192
5252
  id,
5193
5253
  incrementalEdits: emptyIncrementalEdits,
@@ -5439,6 +5499,7 @@ const createEditor = async ({
5439
5499
  formatOnSave,
5440
5500
  height,
5441
5501
  highlightActiveLineNumber = true,
5502
+ hoverDelay = 200,
5442
5503
  hoverEnabled,
5443
5504
  id,
5444
5505
  isAutoClosingBracketsEnabled,
@@ -5507,6 +5568,7 @@ const createEditor = async ({
5507
5568
  hasListener: false,
5508
5569
  height,
5509
5570
  highlightActiveLineNumber,
5571
+ hoverDelay,
5510
5572
  id,
5511
5573
  incrementalEdits: emptyIncrementalEdits,
5512
5574
  insertSpaces: true,
@@ -5793,6 +5855,39 @@ const dispose$3 = uid => {
5793
5855
  pendingSaves.delete(uid);
5794
5856
  };
5795
5857
 
5858
+ const state$6 = {
5859
+ editor: undefined,
5860
+ timeout: -1,
5861
+ token: 0,
5862
+ x: 0,
5863
+ y: 0
5864
+ };
5865
+ const get$2 = () => {
5866
+ return state$6;
5867
+ };
5868
+ const set$2 = (editor, timeout, x, y, token) => {
5869
+ state$6.editor = editor;
5870
+ state$6.timeout = timeout;
5871
+ state$6.token = token;
5872
+ state$6.x = x;
5873
+ state$6.y = y;
5874
+ };
5875
+ const clear$1 = editorUid => {
5876
+ const {
5877
+ editor,
5878
+ timeout
5879
+ } = state$6;
5880
+ if (editorUid !== undefined && editor?.uid !== editorUid) {
5881
+ return;
5882
+ }
5883
+ if (timeout !== -1) {
5884
+ clearTimeout(timeout);
5885
+ }
5886
+ state$6.editor = undefined;
5887
+ state$6.timeout = -1;
5888
+ state$6.token++;
5889
+ };
5890
+
5796
5891
  const getOffset = (lines, rowIndex, columnIndex) => {
5797
5892
  let offset = columnIndex;
5798
5893
  for (let i = 0; i < rowIndex; i++) {
@@ -5908,11 +6003,11 @@ const next = editorUid => {
5908
6003
  revisions.set(editorUid, revision);
5909
6004
  return revision;
5910
6005
  };
5911
- const get$2 = editorUid => {
6006
+ const get$1 = editorUid => {
5912
6007
  return revisions.get(editorUid) || 0;
5913
6008
  };
5914
6009
  const record = (editorUid, revision) => {
5915
- revisions.set(editorUid, Math.max(get$2(editorUid), revision));
6010
+ revisions.set(editorUid, Math.max(get$1(editorUid), revision));
5916
6011
  };
5917
6012
  const dispose$1 = editorUid => {
5918
6013
  revisions.delete(editorUid);
@@ -5968,6 +6063,7 @@ const disposeEditor = async editorUid => {
5968
6063
  if (!editor) {
5969
6064
  return [];
5970
6065
  }
6066
+ clear$1(editorUid);
5971
6067
  for (const widget of editor.widgets) {
5972
6068
  if (widget.id === ColorPicker$2) {
5973
6069
  await invoke$7('ColorPicker.dispose', widget.newState.uid);
@@ -6239,6 +6335,9 @@ const handleError$1 = async (error, prefix = '') => {
6239
6335
  };
6240
6336
 
6241
6337
  const getFormattingEdits = async editor => {
6338
+ if (editor.largeFile) {
6339
+ return [];
6340
+ }
6242
6341
  const textDocument = {
6243
6342
  documentId: editor.id || editor.uid,
6244
6343
  languageId: editor.languageId,
@@ -6254,7 +6353,7 @@ const isFormattingError = error => {
6254
6353
  return error && error instanceof Error && error.message.startsWith(expectedErrorMessage$1);
6255
6354
  };
6256
6355
 
6257
- const state$6 = {
6356
+ const state$5 = {
6258
6357
  configured: false,
6259
6358
  lastId: -1,
6260
6359
  nextId: 0
@@ -6262,23 +6361,23 @@ const state$6 = {
6262
6361
  const configure = (start, end) => {
6263
6362
  const {
6264
6363
  configured
6265
- } = state$6;
6364
+ } = state$5;
6266
6365
  if (configured) {
6267
6366
  throw new Error('Component id range is already configured');
6268
6367
  }
6269
6368
  if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || start <= 0 || end < start) {
6270
6369
  throw new Error('Invalid component id range');
6271
6370
  }
6272
- state$6.nextId = start;
6273
- state$6.lastId = end;
6274
- state$6.configured = true;
6371
+ state$5.nextId = start;
6372
+ state$5.lastId = end;
6373
+ state$5.configured = true;
6275
6374
  };
6276
6375
  const create$8 = () => {
6277
6376
  const {
6278
6377
  configured,
6279
6378
  lastId,
6280
6379
  nextId
6281
- } = state$6;
6380
+ } = state$5;
6282
6381
  if (!configured) {
6283
6382
  // Compatibility with renderer versions that do not assign worker id ranges.
6284
6383
  return Math.random();
@@ -6286,7 +6385,7 @@ const create$8 = () => {
6286
6385
  if (nextId > lastId) {
6287
6386
  throw new Error('Component id range exhausted');
6288
6387
  }
6289
- return state$6.nextId++;
6388
+ return state$5.nextId++;
6290
6389
  };
6291
6390
 
6292
6391
  const Message = 9;
@@ -6681,6 +6780,9 @@ const execute = async ({
6681
6780
  method,
6682
6781
  noProviderFoundResult = undefined
6683
6782
  }) => {
6783
+ if (editor.largeFile) {
6784
+ return noProviderFoundResult;
6785
+ }
6684
6786
  const textDocument = getTextDocument$3(editor);
6685
6787
  const result = await invoke$8(editor.applicationId, 'Extensions.executeLanguageProvider', kind, method, textDocument, ...args);
6686
6788
  if (!result.found) {
@@ -7197,7 +7299,7 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
7197
7299
  if (!newState) {
7198
7300
  return editor;
7199
7301
  }
7200
- if (get$2(editor.uid) !== widgetRevision) {
7302
+ if (get$1(editor.uid) !== widgetRevision) {
7201
7303
  return get$8(editor.uid)?.newState || editor;
7202
7304
  }
7203
7305
  // @ts-ignore
@@ -7304,12 +7406,12 @@ const closeColorPicker = editor => {
7304
7406
  };
7305
7407
  };
7306
7408
 
7307
- const state$5 = {
7409
+ const state$4 = {
7308
7410
  compositionText: '',
7309
7411
  isComposing: false
7310
7412
  };
7311
7413
  const compositionStart = (editor, event) => {
7312
- state$5.isComposing = true;
7414
+ state$4.isComposing = true;
7313
7415
  return editor;
7314
7416
  };
7315
7417
  const getCompositionChanges = (selections, data) => {
@@ -7319,9 +7421,9 @@ const getCompositionChanges = (selections, data) => {
7319
7421
  const selectionStartColumn = selections[i + 1];
7320
7422
  const selectionEndRow = selections[i + 2];
7321
7423
  const selectionEndColumn = selections[i + 3];
7322
- const startColumnIndex = selectionStartColumn - state$5.compositionText.length;
7424
+ const startColumnIndex = selectionStartColumn - state$4.compositionText.length;
7323
7425
  changes.push({
7324
- deleted: [state$5.compositionText],
7426
+ deleted: [state$4.compositionText],
7325
7427
  end: {
7326
7428
  columnIndex: selectionEndColumn,
7327
7429
  rowIndex: selectionEndRow
@@ -7341,7 +7443,7 @@ const compositionUpdate = (editor, data) => {
7341
7443
  selections
7342
7444
  } = editor;
7343
7445
  const changes = getCompositionChanges(selections, data);
7344
- state$5.compositionText = data;
7446
+ state$4.compositionText = data;
7345
7447
  return scheduleDocumentAndCursorsSelections(editor, changes);
7346
7448
  };
7347
7449
  const compositionEnd = (editor, data) => {
@@ -7349,8 +7451,8 @@ const compositionEnd = (editor, data) => {
7349
7451
  selections
7350
7452
  } = editor;
7351
7453
  const changes = getCompositionChanges(selections, data);
7352
- state$5.isComposing = false;
7353
- state$5.compositionText = '';
7454
+ state$4.isComposing = false;
7455
+ state$4.compositionText = '';
7354
7456
  return scheduleDocumentAndCursorsSelections(editor, changes);
7355
7457
  };
7356
7458
 
@@ -8841,6 +8943,9 @@ const getProviderDecorations = (results, rowIndex) => {
8841
8943
  return decorations;
8842
8944
  };
8843
8945
  const getEditorLineDecorations = async (editor, rowIndex) => {
8946
+ if (editor.largeFile) {
8947
+ return [];
8948
+ }
8844
8949
  const textDocument = {
8845
8950
  languageId: editor.languageId,
8846
8951
  text: getText$1(editor),
@@ -8961,7 +9066,7 @@ const clear = editor => {
8961
9066
  decorations: filtered
8962
9067
  };
8963
9068
  };
8964
- const set$2 = (editor, offset, length) => {
9069
+ const set$1 = (editor, offset, length) => {
8965
9070
  if (matches(editor, offset, length)) {
8966
9071
  return editor;
8967
9072
  }
@@ -9117,24 +9222,6 @@ const handleMouseDown = async (state, button, altKey, ctrlKey, x, y, detail, shi
9117
9222
  };
9118
9223
  };
9119
9224
 
9120
- const state$4 = {
9121
- editor: undefined,
9122
- timeout: -1,
9123
- token: 0,
9124
- x: 0,
9125
- y: 0
9126
- };
9127
- const get$1 = () => {
9128
- return state$4;
9129
- };
9130
- const set$1 = (editor, timeout, x, y, token) => {
9131
- state$4.editor = editor;
9132
- state$4.timeout = timeout;
9133
- state$4.token = token;
9134
- state$4.x = x;
9135
- state$4.y = y;
9136
- };
9137
-
9138
9225
  const RE_ALPHA_NUMERIC = /[a-zA-Z\d]/;
9139
9226
  const isAlphaNumeric = char => {
9140
9227
  return RE_ALPHA_NUMERIC.test(char);
@@ -9196,7 +9283,7 @@ const handleMouseMoveWithAltKey = async (editor, x, y) => {
9196
9283
  if (!definition) {
9197
9284
  return clear(editor);
9198
9285
  }
9199
- return set$2(editor, wordOffset, wordLength);
9286
+ return set$1(editor, wordOffset, wordLength);
9200
9287
  } catch (error) {
9201
9288
  if (isNoDefinitionProviderFoundError(error)) {
9202
9289
  return clear(editor);
@@ -9492,7 +9579,7 @@ const applyHoverContent = async (editor, getNewState) => {
9492
9579
  const widgetRevision = next(editor.uid);
9493
9580
  const widget = widgets[widgetIndex];
9494
9581
  const newState = await getNewState(widget.newState);
9495
- if (get$2(editor.uid) !== widgetRevision) {
9582
+ if (get$1(editor.uid) !== widgetRevision) {
9496
9583
  return editor;
9497
9584
  }
9498
9585
  if (!newState) {
@@ -9532,9 +9619,12 @@ const showHover = async (editor, position, token) => {
9532
9619
  return;
9533
9620
  }
9534
9621
  const latestEditor = instance.newState;
9622
+ if (!latestEditor.hoverEnabled) {
9623
+ return;
9624
+ }
9535
9625
  const newEditor = await showHover$1(latestEditor, position);
9536
9626
  const latestInstance = get$8(editor.uid);
9537
- if (latestEditor === newEditor || !latestInstance || latestInstance.newState !== latestEditor || get$1().token !== token) {
9627
+ if (latestEditor === newEditor || !latestInstance || latestInstance.newState !== latestEditor || get$2().token !== token) {
9538
9628
  return;
9539
9629
  }
9540
9630
  set$8(editor.uid, latestInstance.oldState, newEditor);
@@ -9556,8 +9646,12 @@ const onHoverIdle = async token => {
9556
9646
  token: latestToken,
9557
9647
  x,
9558
9648
  y
9559
- } = get$1();
9560
- if (latestToken !== token) {
9649
+ } = get$2();
9650
+ if (latestToken !== token || !editor) {
9651
+ return;
9652
+ }
9653
+ const instance = get$8(editor.uid);
9654
+ if (!instance || !instance.newState.hoverEnabled) {
9561
9655
  return;
9562
9656
  }
9563
9657
  const position = await at(editor, x, y);
@@ -9566,8 +9660,8 @@ const onHoverIdle = async token => {
9566
9660
  // Hover providers are optional and should not surface errors from an idle mouse event.
9567
9661
  }
9568
9662
  };
9569
- const hoverDelay = 200;
9570
9663
  const handleMouseMove = async (editor, x, y, altKey) => {
9664
+ clear$1();
9571
9665
  if (altKey) {
9572
9666
  return handleMouseMoveWithAltKey(editor, x, y);
9573
9667
  }
@@ -9575,13 +9669,9 @@ const handleMouseMove = async (editor, x, y, altKey) => {
9575
9669
  if (!editorWithoutDefinitionLink.hoverEnabled) {
9576
9670
  return editorWithoutDefinitionLink;
9577
9671
  }
9578
- const oldState = get$1();
9579
- if (oldState.timeout !== -1) {
9580
- clearTimeout(oldState.timeout);
9581
- }
9582
9672
  const token = create$8();
9583
- const timeout = setTimeout(onHoverIdle, hoverDelay, token);
9584
- set$1(editorWithoutDefinitionLink, timeout, x, y, token);
9673
+ const timeout = setTimeout(onHoverIdle, editorWithoutDefinitionLink.hoverDelay ?? 200, token);
9674
+ set$2(editorWithoutDefinitionLink, timeout, x, y, token);
9585
9675
  return editorWithoutDefinitionLink;
9586
9676
  };
9587
9677
 
@@ -11075,6 +11165,9 @@ const openRename = async editor => {
11075
11165
  };
11076
11166
 
11077
11167
  const getOrganizeImportEdits = async editor => {
11168
+ if (editor.largeFile) {
11169
+ return [];
11170
+ }
11078
11171
  const textDocument = {
11079
11172
  documentId: editor.id || editor.uid,
11080
11173
  languageId: editor.languageId,
@@ -11689,6 +11782,12 @@ const setIndentation = (editor, insertSpaces) => {
11689
11782
  };
11690
11783
 
11691
11784
  const setLanguageId = async (editor, languageId, tokenizePath) => {
11785
+ if (editor.largeFile) {
11786
+ return {
11787
+ ...editor,
11788
+ languageId
11789
+ };
11790
+ }
11692
11791
  const {
11693
11792
  tokenizerId
11694
11793
  } = editor;
@@ -14397,8 +14496,16 @@ const getMergeConflictActionsEnabled = async () => {
14397
14496
  return (await get$3(kMergeConflictActions)) ?? false;
14398
14497
  };
14399
14498
 
14499
+ const DEFAULT_HOVER_DELAY = 200;
14500
+ const getHoverDelay = value => {
14501
+ const delay = typeof value === 'number' ? value : Number(value);
14502
+ if (!Number.isFinite(delay) || delay < 0) {
14503
+ return DEFAULT_HOVER_DELAY;
14504
+ }
14505
+ return delay;
14506
+ };
14400
14507
  const getEditorPreferences = async () => {
14401
- const [diagnosticsEnabled, fontFamily, fontSize, fontWeight, formatOnSave, hoverEnabled, 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'), 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')]);
14508
+ 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')]);
14402
14509
  return {
14403
14510
  breadcrumbsEnabled: breadcrumbsEnabled ?? false,
14404
14511
  combineWhitespaceTokens: combineWhitespaceTokens ?? true,
@@ -14410,7 +14517,8 @@ const getEditorPreferences = async () => {
14410
14517
  fontWeight,
14411
14518
  formatOnSave: formatOnSave ?? false,
14412
14519
  highlightActiveLineNumber,
14413
- hoverEnabled: hoverEnabled ?? true,
14520
+ hoverDelay: getHoverDelay(hoverDelay),
14521
+ hoverEnabled: hoverEnabled ?? false,
14414
14522
  insertSpaces: insertSpaces ?? true,
14415
14523
  isAutoClosingBracketsEnabled: isAutoClosingBracketsEnabled$1,
14416
14524
  isAutoClosingQuotesEnabled: isAutoClosingQuotesEnabled$1,
@@ -14426,6 +14534,21 @@ const getEditorPreferences = async () => {
14426
14534
  };
14427
14535
  };
14428
14536
 
14537
+ const getLargeFilePreferences = () => ({
14538
+ breadcrumbsEnabled: false,
14539
+ completionsOnType: false,
14540
+ completionTriggerCharacters: [],
14541
+ diagnosticsEnabled: false,
14542
+ formatOnSave: false,
14543
+ hoverEnabled: false,
14544
+ isAutoClosingBracketsEnabled: false,
14545
+ isAutoClosingQuotesEnabled: false,
14546
+ isAutoClosingTagsEnabled: false,
14547
+ isQuickSuggestionsEnabled: false,
14548
+ mergeConflictActionsEnabled: false,
14549
+ minimapEnabled: false
14550
+ });
14551
+
14429
14552
  const getWorkspaceUri$1 = async applicationId => {
14430
14553
  try {
14431
14554
  return await invoke$9(applicationId, 'Workspace.getPath');
@@ -14434,7 +14557,10 @@ const getWorkspaceUri$1 = async applicationId => {
14434
14557
  }
14435
14558
  };
14436
14559
  const handleSettingsChanged = async state => {
14437
- const editorPreferences = await getEditorPreferences();
14560
+ const editorPreferences = {
14561
+ ...(await getEditorPreferences()),
14562
+ ...(state.largeFile && getLargeFilePreferences())
14563
+ };
14438
14564
  const {
14439
14565
  breadcrumbsEnabled,
14440
14566
  diagnosticsEnabled,
@@ -14451,13 +14577,16 @@ const handleSettingsChanged = async state => {
14451
14577
  ...state,
14452
14578
  ...editorPreferences,
14453
14579
  charWidth,
14454
- completionsOnType: Boolean(completionsOnTypeRaw),
14580
+ completionsOnType: !state.largeFile && Boolean(completionsOnTypeRaw),
14455
14581
  diagnostics: diagnosticsEnabled ? state.diagnostics : [],
14456
14582
  isMonospaceFont,
14457
14583
  itemHeight: rowHeight,
14458
14584
  minimapRevision: (state.minimapRevision || 0) + (minimapEnabled ? 1 : 0),
14459
14585
  visualDecorations: diagnosticsEnabled ? state.visualDecorations : []
14460
14586
  };
14587
+ if (!editorWithUpdatedSettings.hoverEnabled) {
14588
+ clear$1(state.uid);
14589
+ }
14461
14590
  let documentSymbols = state.documentSymbols || [];
14462
14591
  let workspaceUri = state.workspaceUri || '';
14463
14592
  if (!breadcrumbsEnabled) {
@@ -14733,7 +14862,7 @@ const getSavedHistory = (savedState, content) => {
14733
14862
  undoStack
14734
14863
  };
14735
14864
  };
14736
- const loadContent = async (state, savedState) => {
14865
+ const loadContent = async (state, savedState, largeFile = false) => {
14737
14866
  const {
14738
14867
  assetDir,
14739
14868
  height,
@@ -14755,6 +14884,7 @@ const loadContent = async (state, savedState) => {
14755
14884
  fontWeight,
14756
14885
  formatOnSave,
14757
14886
  highlightActiveLineNumber,
14887
+ hoverDelay,
14758
14888
  hoverEnabled,
14759
14889
  insertSpaces,
14760
14890
  isAutoClosingBracketsEnabled,
@@ -14774,11 +14904,6 @@ const loadContent = async (state, savedState) => {
14774
14904
  const languages = await getLanguages(platform, assetDir);
14775
14905
  setTokenizePaths(languages);
14776
14906
  const computedLanguageId = getLanguageId$1(uri, languages);
14777
- const tokenizePath = getTokenizePath(languages, computedLanguageId);
14778
- await loadTokenizer(computedLanguageId, tokenizePath);
14779
- const tokenizer = getTokenizer(computedLanguageId);
14780
- const newTokenizerId = state.tokenizerId + 1;
14781
- set$3(newTokenizerId, tokenizer);
14782
14907
  const newEditor0 = {
14783
14908
  ...state,
14784
14909
  breadcrumbsEnabled,
@@ -14792,6 +14917,7 @@ const loadContent = async (state, savedState) => {
14792
14917
  fontWeight,
14793
14918
  formatOnSave,
14794
14919
  highlightActiveLineNumber,
14920
+ hoverDelay,
14795
14921
  hoverEnabled,
14796
14922
  insertSpaces,
14797
14923
  isAutoClosingBracketsEnabled,
@@ -14807,7 +14933,7 @@ const loadContent = async (state, savedState) => {
14807
14933
  roundedSelection,
14808
14934
  rowHeight,
14809
14935
  tabSize,
14810
- tokenizerId: newTokenizerId
14936
+ tokenizerId: state.tokenizerId
14811
14937
  };
14812
14938
  let existingEditor;
14813
14939
  for (const key of getKeys$2()) {
@@ -14837,11 +14963,26 @@ const loadContent = async (state, savedState) => {
14837
14963
  textInfos: []
14838
14964
  };
14839
14965
  }
14966
+ const savedLargeFile = !!savedState && typeof savedState === 'object' && savedState.largeFile === true;
14967
+ largeFile ||= state.largeFile === true || existingEditor?.largeFile === true || savedLargeFile || content.length > 50 * 1024 * 1024;
14968
+ const effectiveEditor = {
14969
+ ...newEditor0,
14970
+ largeFile,
14971
+ ...(largeFile && getLargeFilePreferences())
14972
+ };
14973
+ if (!largeFile) {
14974
+ const tokenizePath = getTokenizePath(languages, computedLanguageId);
14975
+ await loadTokenizer(computedLanguageId, tokenizePath);
14976
+ const tokenizer = getTokenizer(computedLanguageId);
14977
+ const newTokenizerId = state.tokenizerId + 1;
14978
+ set$3(newTokenizerId, tokenizer);
14979
+ effectiveEditor.tokenizerId = newTokenizerId;
14980
+ }
14840
14981
  const savedHistory = existingEditor ? undefined : getSavedHistory(savedState, content);
14841
14982
 
14842
14983
  // TODO avoid creating intermediate editors here
14843
14984
  const newEditor1 = setBounds({
14844
- ...newEditor0,
14985
+ ...effectiveEditor,
14845
14986
  endOfLine
14846
14987
  }, x, y, width, height, 9);
14847
14988
  const newEditor2 = setText$1(newEditor1, content);
@@ -14855,7 +14996,7 @@ const loadContent = async (state, savedState) => {
14855
14996
  };
14856
14997
  let documentSymbols = state.documentSymbols || [];
14857
14998
  let workspaceUri = state.workspaceUri || '';
14858
- if (breadcrumbsEnabled) {
14999
+ if (effectiveEditor.breadcrumbsEnabled) {
14859
15000
  [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(newEditor3WithLinks), getWorkspaceUri(state.applicationId)]);
14860
15001
  }
14861
15002
  const newEditor3WithBreadcrumbs = {
@@ -14879,7 +15020,7 @@ const loadContent = async (state, savedState) => {
14879
15020
  const completionsOnType = Boolean(completionsOnTypeRaw);
14880
15021
  const newEditor5 = {
14881
15022
  ...newEditor4,
14882
- completionsOnType,
15023
+ completionsOnType: !largeFile && completionsOnType,
14883
15024
  initial: false,
14884
15025
  modified: existingEditor?.modified || false,
14885
15026
  redoStack: existingEditor?.redoStack || savedHistory?.redoStack || [],
@@ -16274,11 +16415,15 @@ const revealProblem = (editor, rowIndex, columnIndex) => {
16274
16415
 
16275
16416
  const saveState = (state, savedState) => {
16276
16417
  const {
16418
+ largeFile,
16277
16419
  lines,
16278
16420
  redoStack,
16279
16421
  undoStack
16280
16422
  } = state;
16281
16423
  return {
16424
+ ...(largeFile && {
16425
+ largeFile: true
16426
+ }),
16282
16427
  lines,
16283
16428
  redoStack,
16284
16429
  undoStack
@@ -759,7 +759,17 @@
759
759
  "heading": "Hover",
760
760
  "id": "editor.hover",
761
761
  "type": "boolean",
762
- "value": "true"
762
+ "value": false
763
+ },
764
+ {
765
+ "category": "text-editor",
766
+ "description": "Controls the delay in milliseconds after which hover information will show up",
767
+ "heading": "Hover Delay",
768
+ "id": "editor.hoverDelay",
769
+ "type": "number",
770
+ "value": 200,
771
+ "minimum": 0,
772
+ "maximum": 10000
763
773
  },
764
774
  {
765
775
  "category": "text-editor",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.62.2",
3
+ "version": "19.63.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"