@lvce-editor/editor-worker 19.76.2 → 19.76.4

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.
package/dist/diff-sdk.js CHANGED
@@ -4112,6 +4112,7 @@ const mergeLinksWithDiagnosticDecorations = (editor, diagnosticDecorations) => {
4112
4112
  const requestGenerations = new Map();
4113
4113
  const requestDiagnosticSnapshots = new Map();
4114
4114
  const previousProviderResults = new Map();
4115
+ const pendingDiagnosticNotifications = new Set();
4115
4116
  const getDiagnostics$1 = async (editor, resultPort) => {
4116
4117
  return streamDiagnosticProvider(editor, resultPort);
4117
4118
  };
@@ -4170,6 +4171,9 @@ const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) =>
4170
4171
  }
4171
4172
  if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
4172
4173
  onAccepted?.();
4174
+ if (pendingDiagnosticNotifications.delete(editor.id)) {
4175
+ await notifyDiagnosticsChange(latest.newState.uri, latest.newState.applicationId);
4176
+ }
4173
4177
  return latest.newState;
4174
4178
  }
4175
4179
  let calculationState = latest.newState;
@@ -4191,6 +4195,7 @@ const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) =>
4191
4195
  requestDiagnosticSnapshots.set(editor.id, diagnostics);
4192
4196
  onAccepted?.();
4193
4197
  await invoke$8('Editor.renderPending', newEditor.id);
4198
+ pendingDiagnosticNotifications.delete(editor.id);
4194
4199
  await notifyDiagnosticsChange(newEditor.uri, newEditor.applicationId);
4195
4200
  return newEditor;
4196
4201
  })) ?? editor;
@@ -4359,6 +4364,7 @@ const clearDiagnosticRequestState = editorId => {
4359
4364
  requestGenerations.delete(editorId);
4360
4365
  requestDiagnosticSnapshots.delete(editorId);
4361
4366
  previousProviderResults.delete(editorId);
4367
+ pendingDiagnosticNotifications.delete(editorId);
4362
4368
  };
4363
4369
  const transformCachedDiagnostics = (editorId, changes) => {
4364
4370
  const previous = previousProviderResults.get(editorId);
@@ -4367,9 +4373,13 @@ const transformCachedDiagnostics = (editorId, changes) => {
4367
4373
  }
4368
4374
  const providers = new Map();
4369
4375
  for (const [providerId, result] of previous.providers) {
4376
+ const diagnostics = transformDiagnostics(result.diagnostics, changes);
4377
+ if (!diagnosticsEqual(result.diagnostics, diagnostics)) {
4378
+ pendingDiagnosticNotifications.add(editorId);
4379
+ }
4370
4380
  providers.set(providerId, {
4371
4381
  ...result,
4372
- diagnostics: transformDiagnostics(result.diagnostics, changes)
4382
+ diagnostics
4373
4383
  });
4374
4384
  }
4375
4385
  previousProviderResults.set(editorId, {
@@ -16770,7 +16780,9 @@ const createCommandMap = commands => ({
16770
16780
  if (!current || editor.lifecycle?.disposed || current.lifecycle !== editor.lifecycle) return;
16771
16781
  // The wrapped command has released the document queue before requesting a
16772
16782
  // render; a diff can now run without waiting on its own command.
16773
- await RendererWorker.invoke('Viewlet.requestRender', uid, false);
16783
+ // Blur can finish after another editor has gained focus. Apply its state
16784
+ // without letting the delayed render replace the current focus context.
16785
+ await RendererWorker.invoke('Viewlet.requestRender', uid, command === 'handleBlur');
16774
16786
  }
16775
16787
  });
16776
16788
 
@@ -4525,6 +4525,7 @@ const mergeLinksWithDiagnosticDecorations = (editor, diagnosticDecorations) => {
4525
4525
  const requestGenerations = new Map();
4526
4526
  const requestDiagnosticSnapshots = new Map();
4527
4527
  const previousProviderResults = new Map();
4528
+ const pendingDiagnosticNotifications = new Set();
4528
4529
  const getDiagnostics$1 = async (editor, resultPort) => {
4529
4530
  return streamDiagnosticProvider(editor, resultPort);
4530
4531
  };
@@ -4583,6 +4584,9 @@ const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) =>
4583
4584
  }
4584
4585
  if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
4585
4586
  onAccepted?.();
4587
+ if (pendingDiagnosticNotifications.delete(editor.id)) {
4588
+ await notifyDiagnosticsChange(latest.newState.uri, latest.newState.applicationId);
4589
+ }
4586
4590
  return latest.newState;
4587
4591
  }
4588
4592
  let calculationState = latest.newState;
@@ -4604,6 +4608,7 @@ const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) =>
4604
4608
  requestDiagnosticSnapshots.set(editor.id, diagnostics);
4605
4609
  onAccepted?.();
4606
4610
  await invoke$8('Editor.renderPending', newEditor.id);
4611
+ pendingDiagnosticNotifications.delete(editor.id);
4607
4612
  await notifyDiagnosticsChange(newEditor.uri, newEditor.applicationId);
4608
4613
  return newEditor;
4609
4614
  })) ?? editor;
@@ -4772,6 +4777,7 @@ const clearDiagnosticRequestState = editorId => {
4772
4777
  requestGenerations.delete(editorId);
4773
4778
  requestDiagnosticSnapshots.delete(editorId);
4774
4779
  previousProviderResults.delete(editorId);
4780
+ pendingDiagnosticNotifications.delete(editorId);
4775
4781
  };
4776
4782
  const transformCachedDiagnostics = (editorId, changes) => {
4777
4783
  const previous = previousProviderResults.get(editorId);
@@ -4780,9 +4786,13 @@ const transformCachedDiagnostics = (editorId, changes) => {
4780
4786
  }
4781
4787
  const providers = new Map();
4782
4788
  for (const [providerId, result] of previous.providers) {
4789
+ const diagnostics = transformDiagnostics(result.diagnostics, changes);
4790
+ if (!diagnosticsEqual(result.diagnostics, diagnostics)) {
4791
+ pendingDiagnosticNotifications.add(editorId);
4792
+ }
4783
4793
  providers.set(providerId, {
4784
4794
  ...result,
4785
- diagnostics: transformDiagnostics(result.diagnostics, changes)
4795
+ diagnostics
4786
4796
  });
4787
4797
  }
4788
4798
  previousProviderResults.set(editorId, {
@@ -17174,7 +17184,9 @@ const createCommandMap = commands => ({
17174
17184
  if (!current || editor.lifecycle?.disposed || current.lifecycle !== editor.lifecycle) return;
17175
17185
  // The wrapped command has released the document queue before requesting a
17176
17186
  // render; a diff can now run without waiting on its own command.
17177
- await invoke$e('Viewlet.requestRender', uid, false);
17187
+ // Blur can finish after another editor has gained focus. Apply its state
17188
+ // without letting the delayed render replace the current focus context.
17189
+ await invoke$e('Viewlet.requestRender', uid, command === 'handleBlur');
17178
17190
  }
17179
17191
  });
17180
17192
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.76.2",
3
+ "version": "19.76.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"