@lvce-editor/editor-worker 19.69.8 → 19.69.10

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.
@@ -6393,13 +6393,14 @@ const mergeDiagnostics = (editor, editorWithDiagnostics) => ({
6393
6393
  lightBulbRowIndex: editorWithDiagnostics.lightBulbRowIndex,
6394
6394
  visualDecorations: editorWithDiagnostics.visualDecorations
6395
6395
  });
6396
- const commitDiagnostics = async (editor, generation, diagnostics) => {
6396
+ const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) => {
6397
6397
  return (await enqueue(editor.id, async () => {
6398
6398
  let latest = get$8(editor.id);
6399
6399
  if (!isApplicable(latest, editor, generation)) {
6400
6400
  return editor;
6401
6401
  }
6402
6402
  if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
6403
+ onAccepted?.();
6403
6404
  return latest.newState;
6404
6405
  }
6405
6406
  let calculationState = latest.newState;
@@ -6419,6 +6420,7 @@ const commitDiagnostics = async (editor, generation, diagnostics) => {
6419
6420
  const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
6420
6421
  set$9(editor.id, latest.oldState, newEditor);
6421
6422
  requestDiagnosticSnapshots.set(editor.id, diagnostics);
6423
+ onAccepted?.();
6422
6424
  await invoke$5('Editor.renderPending', newEditor.id);
6423
6425
  await notifyDiagnosticsChange(newEditor.uri, newEditor.applicationId);
6424
6426
  return newEditor;
@@ -6429,6 +6431,13 @@ const flattenProviderDiagnostics = providers => {
6429
6431
  diagnostics
6430
6432
  }) => diagnostics);
6431
6433
  };
6434
+ const saveProviderResults = (editor, providers) => {
6435
+ previousProviderResults.set(editor.id, {
6436
+ languageId: editor.languageId,
6437
+ providers: new Map(providers),
6438
+ uri: editor.uri
6439
+ });
6440
+ };
6432
6441
  const updateDiagnostics = async editor => {
6433
6442
  if (!editor.diagnosticsEnabled || editor.loadError) {
6434
6443
  return editor;
@@ -6438,7 +6447,7 @@ const updateDiagnostics = async editor => {
6438
6447
  requestDiagnosticSnapshots.set(editor.id, get$8(editor.id)?.newState.diagnostics ?? editor.diagnostics);
6439
6448
  const providers = new Map();
6440
6449
  const previous = previousProviderResults.get(editor.id);
6441
- if (previous && previous.languageId === editor.languageId && previous.lines === editor.lines && previous.uri === editor.uri) {
6450
+ if (previous && previous.languageId === editor.languageId && previous.uri === editor.uri) {
6442
6451
  for (const [providerId, result] of previous.providers) {
6443
6452
  providers.set(providerId, result);
6444
6453
  }
@@ -6477,6 +6486,9 @@ const updateDiagnostics = async editor => {
6477
6486
  providers.delete(providerId);
6478
6487
  }
6479
6488
  }
6489
+ if (requestGenerations.get(editor.id) === generation) {
6490
+ saveProviderResults(editor, providers);
6491
+ }
6480
6492
  return;
6481
6493
  }
6482
6494
  if (message.type === 'result' && message.providerId !== undefined) {
@@ -6484,20 +6496,17 @@ const updateDiagnostics = async editor => {
6484
6496
  diagnostics: message.diagnostics ?? [],
6485
6497
  providerIndex: message.providerIndex ?? providers.size
6486
6498
  });
6487
- await commitDiagnostics(editor, generation, flattenProviderDiagnostics(providers));
6499
+ await commitDiagnostics(editor, generation, flattenProviderDiagnostics(providers), () => saveProviderResults(editor, providers));
6488
6500
  return;
6489
6501
  }
6490
6502
  if (message.type === 'done') {
6491
6503
  if (providerCount === 0) {
6492
6504
  providers.clear();
6493
- await commitDiagnostics(editor, generation, []);
6505
+ await commitDiagnostics(editor, generation, [], () => saveProviderResults(editor, providers));
6506
+ }
6507
+ if (requestGenerations.get(editor.id) === generation) {
6508
+ saveProviderResults(editor, providers);
6494
6509
  }
6495
- previousProviderResults.set(editor.id, {
6496
- languageId: editor.languageId,
6497
- lines: editor.lines,
6498
- providers: new Map(providers),
6499
- uri: editor.uri
6500
- });
6501
6510
  port1.close();
6502
6511
  completed.resolve();
6503
6512
  }
@@ -6516,13 +6525,7 @@ const updateDiagnostics = async editor => {
6516
6525
  diagnostics: response,
6517
6526
  providerIndex: 0
6518
6527
  });
6519
- await commitDiagnostics(editor, generation, response);
6520
- previousProviderResults.set(editor.id, {
6521
- languageId: editor.languageId,
6522
- lines: editor.lines,
6523
- providers: new Map(providers),
6524
- uri: editor.uri
6525
- });
6528
+ await commitDiagnostics(editor, generation, response, () => saveProviderResults(editor, providers));
6526
6529
  port1.close();
6527
6530
  completed.resolve();
6528
6531
  }
@@ -9329,6 +9332,7 @@ const EditorDecrementSelection = 'Editor: Decrement Selection';
9329
9332
  const EditorFormatDocumentForced = 'Editor: Format Document (forced)';
9330
9333
  const EditorGoToDefinition = 'Editor: Go To Definition';
9331
9334
  const EditorGoToTypeDefinition = 'Editor: Go To Type Definition';
9335
+ const EditorOrganizeImports = 'Editor: Organize Imports';
9332
9336
  const EditorIndent = 'Editor: Indent';
9333
9337
  const EditorIncrementSelection = 'Editor: Increment Selection';
9334
9338
  const EditorOpenColorPicker = 'Editor: Open Color Picker';
@@ -9395,6 +9399,9 @@ const noTypeDefinitionFound = () => {
9395
9399
  const sourceAction = () => {
9396
9400
  return i18nString(SourceAction);
9397
9401
  };
9402
+ const editorOrganizeImports = () => {
9403
+ return i18nString(EditorOrganizeImports);
9404
+ };
9398
9405
  const escapeToClose = () => {
9399
9406
  return i18nString(EscapeToClose);
9400
9407
  };
@@ -10380,12 +10387,14 @@ const getEditorHoverInfo = async (editorUid, position) => {
10380
10387
  const wordPart = getWordBefore(editor, rowIndex, columnIndex);
10381
10388
  const wordStart = columnIndex - wordPart.length;
10382
10389
  const documentationHeight = documentation ? await measureTextBlockHeight(documentation, hoverDocumentationFontFamily, hoverDocumentationFontSize, hoverDocumentationLineHeight, hoverDocumentationWidth) : 0;
10390
+ const measuredDisplayStringHeight = displayString ? await measureTextBlockHeight(displayString, editor.fontFamily, editor.fontSize, `${editor.rowHeight}px`, hoverDocumentationWidth) : 0;
10391
+ const displayStringHeight = displayString ? measuredDisplayStringHeight + (measuredDisplayStringHeight > editor.rowHeight ? editor.rowHeight : 0) + 12 : 0;
10383
10392
  let diagnosticText = '';
10384
10393
  for (const diagnostic of matchingDiagnostics) {
10385
10394
  diagnosticText += `${diagnosticText ? '\n' : ''}${diagnostic.message} ${diagnostic.source} (${diagnostic.code})`;
10386
10395
  }
10387
10396
  const diagnosticsHeight = diagnosticText ? (await measureTextBlockHeight(diagnosticText, editor.fontFamily, editor.fontSize, `${editor.rowHeight}px`, hoverDocumentationWidth)) + 10 : 0;
10388
- const height = Math.min(diagnosticsHeight + (lineInfos.length > 0 ? lineInfos.length * editor.rowHeight + 12 : 0) + (documentation ? documentationHeight + 11 : 0) || 20, editor.height);
10397
+ const height = Math.min(diagnosticsHeight + displayStringHeight + (documentation ? documentationHeight + 11 : 0) || 20, editor.height);
10389
10398
  const x$1 = Math.max(editor.x, Math.min(x(editor, rowIndex, wordStart), editor.x + editor.width - hoverWidth));
10390
10399
  const rowBottom = y(editor, rowIndex);
10391
10400
  const y$1 = rowBottom + height <= editor.y + editor.height ? rowBottom : Math.max(editor.y, rowBottom - editor.rowHeight - height);
@@ -15376,6 +15385,9 @@ const getQuickPickMenuEntries = () => {
15376
15385
  }, {
15377
15386
  id: 'Editor.format',
15378
15387
  label: formatDocument()
15388
+ }, {
15389
+ id: 'Editor.organizeImports',
15390
+ label: editorOrganizeImports()
15379
15391
  }, {
15380
15392
  id: 'Editor.showHover',
15381
15393
  label: editorShowHover()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.69.8",
3
+ "version": "19.69.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"