@lvce-editor/editor-worker 19.70.3 → 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.
- package/dist/editorWorkerMain.js +39 -5
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -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 {
|
|
@@ -16155,7 +16173,7 @@ const getSavedLanguageId = (savedState, languages) => {
|
|
|
16155
16173
|
}
|
|
16156
16174
|
return explicitLanguageId;
|
|
16157
16175
|
};
|
|
16158
|
-
const loadContent = async (state, savedState, largeFile = false) => {
|
|
16176
|
+
const loadContent = async (state, savedState, largeFile = false, focus = true) => {
|
|
16159
16177
|
const {
|
|
16160
16178
|
assetDir,
|
|
16161
16179
|
height,
|
|
@@ -16254,7 +16272,7 @@ const loadContent = async (state, savedState, largeFile = false) => {
|
|
|
16254
16272
|
...newEditor1,
|
|
16255
16273
|
differences: [],
|
|
16256
16274
|
focus: FocusEditorText$1,
|
|
16257
|
-
focused:
|
|
16275
|
+
focused: focus,
|
|
16258
16276
|
initial: false,
|
|
16259
16277
|
loadError: getErrorMessage(error),
|
|
16260
16278
|
textInfos: []
|
|
@@ -16316,7 +16334,7 @@ const loadContent = async (state, savedState, largeFile = false) => {
|
|
|
16316
16334
|
...newEditor3WithBreadcrumbs,
|
|
16317
16335
|
differences,
|
|
16318
16336
|
focus: FocusEditorText$1,
|
|
16319
|
-
focused:
|
|
16337
|
+
focused: focus,
|
|
16320
16338
|
textInfos
|
|
16321
16339
|
};
|
|
16322
16340
|
const completionsOnTypeRaw = await get$3('editor.completionsOnType');
|
|
@@ -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':
|
|
18429
|
-
'Editor.showHover2':
|
|
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),
|