@lvce-editor/editor-worker 19.55.2 → 19.55.3

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.
@@ -5750,10 +5750,14 @@ const diff = (oldState, newState) => {
5750
5750
  };
5751
5751
 
5752
5752
  const diff2 = uid => {
5753
+ const editor = get$8(uid);
5754
+ if (!editor) {
5755
+ return [];
5756
+ }
5753
5757
  const {
5754
5758
  newState,
5755
5759
  oldState
5756
- } = get$8(uid);
5760
+ } = editor;
5757
5761
  const result = diff(oldState, newState);
5758
5762
  return result;
5759
5763
  };
@@ -15769,10 +15773,14 @@ const applyRender = (oldState, newState, diffResult) => {
15769
15773
  };
15770
15774
 
15771
15775
  const render2 = (uid, diffResult) => {
15776
+ const editor = get$8(uid);
15777
+ if (!editor) {
15778
+ return [];
15779
+ }
15772
15780
  const {
15773
15781
  newState,
15774
15782
  oldState
15775
- } = get$8(uid);
15783
+ } = editor;
15776
15784
  set$8(uid, newState, newState);
15777
15785
  const commands = applyRender(oldState, newState, diffResult);
15778
15786
  return commands;
@@ -16150,17 +16158,22 @@ const updateDiagnostics = async editor => {
16150
16158
  try {
16151
16159
  const diagnostics = await getDiagnostics(editor);
16152
16160
  const latest = get$8(editor.id);
16153
- if (!latest) {
16161
+ if (!latest || !latest.newState.diagnosticsEnabled || latest.newState.lines !== editor.lines || latest.newState.uri !== editor.uri) {
16154
16162
  return editor;
16155
16163
  }
16156
16164
  const newEditor = await addDiagnostics(latest.newState, diagnostics);
16157
16165
  set$8(editor.id, latest.oldState, newEditor);
16166
+ await invoke$7('Editor.renderPending', newEditor.id);
16158
16167
  await notifyDiagnosticsChange(newEditor.uri);
16159
16168
  return newEditor;
16160
16169
  } catch (error) {
16161
16170
  return handleError(error, editor);
16162
16171
  }
16163
16172
  };
16173
+ const requestDiagnostics = editor => {
16174
+ void updateDiagnostics(editor);
16175
+ return editor;
16176
+ };
16164
16177
  const updateDiagnosticsAll = async () => {
16165
16178
  for (const key of getKeys$2()) {
16166
16179
  const editor = get$8(Number(key))?.newState;
@@ -16224,6 +16237,9 @@ const saveAfterDelay = async (uid, token) => {
16224
16237
 
16225
16238
  const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...args) => {
16226
16239
  const initialInstance = get$8(uid);
16240
+ if (!initialInstance) {
16241
+ return undefined;
16242
+ }
16227
16243
  const queueKey = initialInstance?.newState.uri || uid;
16228
16244
  const previous = queues[queueKey];
16229
16245
  const {
@@ -16236,6 +16252,9 @@ const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...ar
16236
16252
  }
16237
16253
  try {
16238
16254
  const oldInstance = get$8(uid);
16255
+ if (!oldInstance) {
16256
+ return undefined;
16257
+ }
16239
16258
  const state = oldInstance.newState;
16240
16259
  const {
16241
16260
  cursorUndoStack,
@@ -16272,14 +16291,10 @@ const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...ar
16272
16291
  }
16273
16292
  const newEditorWithDerivedState = await updateDerivedState(state, newEditor);
16274
16293
  set$8(uid, state, newEditorWithDerivedState);
16275
- let finalEditor = newEditorWithDerivedState;
16276
16294
  if (editorDiagnosticEffect.isActive(state, newEditorWithDerivedState)) {
16277
- finalEditor = await editorDiagnosticEffect.apply(newEditorWithDerivedState);
16278
- if (!get$8(uid)) {
16279
- return finalEditor;
16280
- }
16281
- set$8(uid, state, finalEditor);
16295
+ void editorDiagnosticEffect.apply(newEditorWithDerivedState);
16282
16296
  }
16297
+ const finalEditor = newEditorWithDerivedState;
16283
16298
  await notifyEditorStatusChange(state, finalEditor);
16284
16299
  if (!initial && uri === finalEditor.uri && (endOfLine !== finalEditor.endOfLine || insertSpaces !== finalEditor.insertSpaces || lines !== finalEditor.lines || modified !== finalEditor.modified || redoStack !== finalEditor.redoStack || undoStack !== finalEditor.undoStack)) {
16285
16300
  for (const key of getKeys$2()) {
@@ -16543,7 +16558,7 @@ const commandMap = {
16543
16558
  'Editor.unIndent': wrapCommand(editorUnindent),
16544
16559
  'Editor.updateColorPickerValue': wrapCommand(updateColorPickerValue$1),
16545
16560
  'Editor.updateDebugInfo': updateDebugInfo,
16546
- 'Editor.updateDiagnostics': wrapCommand(updateDiagnostics),
16561
+ 'Editor.updateDiagnostics': wrapCommand(requestDiagnostics),
16547
16562
  'Editor.updateDiagnosticsAll': updateDiagnosticsAll,
16548
16563
  'EditorCompletion.close': close$3,
16549
16564
  'EditorCompletion.closeDetails': closeDetails$1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.55.2",
3
+ "version": "19.55.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"