@lvce-editor/editor-worker 19.70.4 → 19.70.5

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.
@@ -3322,6 +3322,12 @@ const getLineInfosViewport = (editor, tokens, embeddedResults, minLineY, maxLine
3322
3322
  };
3323
3323
  };
3324
3324
  const getVisible$1 = async (editor, syncIncremental) => {
3325
+ if (editor.lifecycle?.disposed) {
3326
+ return {
3327
+ differences: [],
3328
+ textInfos: []
3329
+ };
3330
+ }
3325
3331
  if (editor.largeFile) {
3326
3332
  return getLargeFileVisible(editor);
3327
3333
  }
@@ -3355,6 +3361,12 @@ const getVisible$1 = async (editor, syncIncremental) => {
3355
3361
  } = await getTokensViewport2(editor, minLineY, maxLineY, syncIncremental);
3356
3362
  for (let i = 0; tokenizersToLoad.length > 0 && i < maxTokenizerLoadPasses$1; i++) {
3357
3363
  await loadTokenizers(tokenizersToLoad);
3364
+ if (editor.lifecycle?.disposed) {
3365
+ return {
3366
+ differences: [],
3367
+ textInfos: []
3368
+ };
3369
+ }
3358
3370
  // @ts-ignore
3359
3371
  const refreshed = await getTokensViewport2(editor, minLineY, maxLineY, syncIncremental);
3360
3372
  ({
@@ -3363,6 +3375,12 @@ const getVisible$1 = async (editor, syncIncremental) => {
3363
3375
  tokens
3364
3376
  } = refreshed);
3365
3377
  }
3378
+ if (editor.lifecycle?.disposed) {
3379
+ return {
3380
+ differences: [],
3381
+ textInfos: []
3382
+ };
3383
+ }
3366
3384
  const minLineOffset = await offsetAtSync(editor, minLineY, 0);
3367
3385
  const averageCharWidth = charWidth;
3368
3386
  const {
@@ -18209,6 +18227,19 @@ const wrapFocusCommand$1 = (fn, returnState = true) => {
18209
18227
  };
18210
18228
  };
18211
18229
 
18230
+ // Optional provider work must not hold the editing queue while another worker responds.
18231
+ const wrapDeferredCommand$1 = (fn, returnState = true) => {
18232
+ const apply = wrapCommand$1((editor, snapshot, result) => editor === snapshot ? result : editor, false, returnState);
18233
+ return async (uid, ...args) => {
18234
+ const snapshot = await enqueue(uid, async () => get$8(uid)?.newState);
18235
+ if (!snapshot) {
18236
+ return undefined;
18237
+ }
18238
+ const result = await fn(snapshot, ...args);
18239
+ return apply(uid, snapshot, result);
18240
+ };
18241
+ };
18242
+
18212
18243
  // State and undo history belong in this worker. Rendering reads changes separately.
18213
18244
  const wrapCommand = (fn, preservesTypingCoalescing = false) => {
18214
18245
  return wrapCommand$1(fn, preservesTypingCoalescing, false);
@@ -18216,6 +18247,9 @@ const wrapCommand = (fn, preservesTypingCoalescing = false) => {
18216
18247
  const wrapFocusCommand = fn => {
18217
18248
  return wrapFocusCommand$1(fn, false);
18218
18249
  };
18250
+ const wrapDeferredCommand = fn => {
18251
+ return wrapDeferredCommand$1(fn, false);
18252
+ };
18219
18253
 
18220
18254
  const executeViewletCommand = (uid, commandId, ...args) => {
18221
18255
  return executeViewletCommand$1(commandMap, uid, commandId, ...args);
@@ -18425,8 +18459,8 @@ const commandMap = {
18425
18459
  'Editor.setSelections': wrapCommand(setSelections),
18426
18460
  'Editor.setSelections2': setSelections2,
18427
18461
  'Editor.setText': wrapCommand(setText),
18428
- 'Editor.showHover': wrapCommand(showHover$1),
18429
- 'Editor.showHover2': wrapCommand(showHover$1),
18462
+ 'Editor.showHover': wrapDeferredCommand(showHover$1),
18463
+ 'Editor.showHover2': wrapDeferredCommand(showHover$1),
18430
18464
  'Editor.showSignatureHelp': wrapCommand(showSignatureHelp),
18431
18465
  'Editor.showSourceActions': wrapCommand(showSourceActions),
18432
18466
  'Editor.showSourceActions2': wrapCommand(showSourceActions),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.70.4",
3
+ "version": "19.70.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"