@lvce-editor/editor-worker 19.66.4 → 19.66.6
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 -38
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1798,7 +1798,7 @@ const toEditorValue = (value, originalValue) => {
|
|
|
1798
1798
|
|
|
1799
1799
|
const editorStates = create$b();
|
|
1800
1800
|
const {
|
|
1801
|
-
dispose: dispose$
|
|
1801
|
+
dispose: dispose$6,
|
|
1802
1802
|
getCommandIds,
|
|
1803
1803
|
registerCommands,
|
|
1804
1804
|
wrapGetter
|
|
@@ -3671,7 +3671,7 @@ const start = delivery => {
|
|
|
3671
3671
|
delivery.running = run$1(delivery);
|
|
3672
3672
|
return delivery.running;
|
|
3673
3673
|
};
|
|
3674
|
-
const dispose$
|
|
3674
|
+
const dispose$5 = rpcId => {
|
|
3675
3675
|
const delivery = deliveries.get(rpcId);
|
|
3676
3676
|
if (delivery) {
|
|
3677
3677
|
delivery.disposed = true;
|
|
@@ -3681,7 +3681,7 @@ const dispose$4 = rpcId => {
|
|
|
3681
3681
|
const send$2 = (rpcId, rpc, status) => {
|
|
3682
3682
|
let delivery = deliveries.get(rpcId);
|
|
3683
3683
|
if (!delivery || delivery.rpc !== rpc) {
|
|
3684
|
-
dispose$
|
|
3684
|
+
dispose$5(rpcId);
|
|
3685
3685
|
delivery = {
|
|
3686
3686
|
baseline: undefined,
|
|
3687
3687
|
disposed: false,
|
|
@@ -3728,7 +3728,7 @@ const unregisterListener$1 = (listenerType, rpcId) => {
|
|
|
3728
3728
|
number(listenerType);
|
|
3729
3729
|
number(rpcId);
|
|
3730
3730
|
if (listenerType === EditorSelection$1) {
|
|
3731
|
-
dispose$
|
|
3731
|
+
dispose$5(rpcId);
|
|
3732
3732
|
}
|
|
3733
3733
|
if (Object.hasOwn(state$a, listenerType)) {
|
|
3734
3734
|
const index = state$a[listenerType].indexOf(rpcId);
|
|
@@ -5926,7 +5926,7 @@ const run = async (uid, token, save) => {
|
|
|
5926
5926
|
await save(token);
|
|
5927
5927
|
};
|
|
5928
5928
|
const schedule = (uid, save) => {
|
|
5929
|
-
dispose$
|
|
5929
|
+
dispose$4(uid);
|
|
5930
5930
|
const token = ++state$7.nextToken;
|
|
5931
5931
|
const timeout = setTimeout(run, autoSaveDelay, uid, token, save);
|
|
5932
5932
|
pendingSaves.set(uid, {
|
|
@@ -5941,9 +5941,9 @@ const consume = (uid, token) => {
|
|
|
5941
5941
|
if (!isLatest(uid, token)) {
|
|
5942
5942
|
return;
|
|
5943
5943
|
}
|
|
5944
|
-
dispose$
|
|
5944
|
+
dispose$4(uid);
|
|
5945
5945
|
};
|
|
5946
|
-
const dispose$
|
|
5946
|
+
const dispose$4 = uid => {
|
|
5947
5947
|
const pendingSave = pendingSaves.get(uid);
|
|
5948
5948
|
if (!pendingSave) {
|
|
5949
5949
|
return;
|
|
@@ -6066,7 +6066,7 @@ const invoke$6 = async (method, ...params) => {
|
|
|
6066
6066
|
const worker = await workerPromise;
|
|
6067
6067
|
return await worker.invoke(method, ...params);
|
|
6068
6068
|
};
|
|
6069
|
-
const dispose$
|
|
6069
|
+
const dispose$3 = async () => {
|
|
6070
6070
|
if (getKeys$2().some(uid => get$8(Number(uid))?.newState.widgets?.some(widget => widget.id === Rename$1))) {
|
|
6071
6071
|
return;
|
|
6072
6072
|
}
|
|
@@ -6079,6 +6079,17 @@ const dispose$2 = async () => {
|
|
|
6079
6079
|
} catch {}
|
|
6080
6080
|
};
|
|
6081
6081
|
|
|
6082
|
+
const renderedDoms = new Map();
|
|
6083
|
+
const get$1 = uid => {
|
|
6084
|
+
return renderedDoms.get(uid);
|
|
6085
|
+
};
|
|
6086
|
+
const set$1 = (uid, dom) => {
|
|
6087
|
+
renderedDoms.set(uid, dom);
|
|
6088
|
+
};
|
|
6089
|
+
const dispose$2 = uid => {
|
|
6090
|
+
renderedDoms.delete(uid);
|
|
6091
|
+
};
|
|
6092
|
+
|
|
6082
6093
|
const addWidget$1 = widget => {
|
|
6083
6094
|
const module = get$7(widget.id);
|
|
6084
6095
|
if (!module) {
|
|
@@ -6100,11 +6111,11 @@ const next = editorUid => {
|
|
|
6100
6111
|
revisions.set(editorUid, revision);
|
|
6101
6112
|
return revision;
|
|
6102
6113
|
};
|
|
6103
|
-
const get
|
|
6114
|
+
const get = editorUid => {
|
|
6104
6115
|
return revisions.get(editorUid) || 0;
|
|
6105
6116
|
};
|
|
6106
6117
|
const record = (editorUid, revision) => {
|
|
6107
|
-
revisions.set(editorUid, Math.max(get
|
|
6118
|
+
revisions.set(editorUid, Math.max(get(editorUid), revision));
|
|
6108
6119
|
};
|
|
6109
6120
|
const dispose$1 = editorUid => {
|
|
6110
6121
|
revisions.delete(editorUid);
|
|
@@ -6165,8 +6176,9 @@ const disposeEditor = async editorUid => {
|
|
|
6165
6176
|
delete editor.lifecycle.sentLines;
|
|
6166
6177
|
}
|
|
6167
6178
|
// Invalidate the registry before awaiting widget or worker cleanup.
|
|
6168
|
-
dispose$
|
|
6169
|
-
dispose$
|
|
6179
|
+
dispose$6(editorUid);
|
|
6180
|
+
dispose$2(editorUid);
|
|
6181
|
+
dispose$4(editorUid);
|
|
6170
6182
|
clear$1(editorUid);
|
|
6171
6183
|
dispose$1(editorUid);
|
|
6172
6184
|
const pending = [];
|
|
@@ -6182,7 +6194,7 @@ const disposeEditor = async editorUid => {
|
|
|
6182
6194
|
...editor,
|
|
6183
6195
|
widgets: []
|
|
6184
6196
|
});
|
|
6185
|
-
pending.push(dispose$
|
|
6197
|
+
pending.push(dispose$3());
|
|
6186
6198
|
await Promise.all(pending);
|
|
6187
6199
|
if (getKeys$2().length === 0) {
|
|
6188
6200
|
await notifyEditorStatusCleared();
|
|
@@ -7406,7 +7418,7 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
7406
7418
|
if (!newState) {
|
|
7407
7419
|
return editor;
|
|
7408
7420
|
}
|
|
7409
|
-
if (get
|
|
7421
|
+
if (get(editor.uid) !== widgetRevision) {
|
|
7410
7422
|
return get$8(editor.uid)?.newState || editor;
|
|
7411
7423
|
}
|
|
7412
7424
|
// @ts-ignore
|
|
@@ -9173,7 +9185,7 @@ const clear = editor => {
|
|
|
9173
9185
|
decorations: filtered
|
|
9174
9186
|
};
|
|
9175
9187
|
};
|
|
9176
|
-
const set
|
|
9188
|
+
const set = (editor, offset, length) => {
|
|
9177
9189
|
if (matches(editor, offset, length)) {
|
|
9178
9190
|
return editor;
|
|
9179
9191
|
}
|
|
@@ -9390,7 +9402,7 @@ const handleMouseMoveWithAltKey = async (editor, x, y) => {
|
|
|
9390
9402
|
if (!definition) {
|
|
9391
9403
|
return clear(editor);
|
|
9392
9404
|
}
|
|
9393
|
-
return set
|
|
9405
|
+
return set(editor, wordOffset, wordLength);
|
|
9394
9406
|
} catch (error) {
|
|
9395
9407
|
if (isNoDefinitionProviderFoundError(error)) {
|
|
9396
9408
|
return clear(editor);
|
|
@@ -9689,7 +9701,7 @@ const applyHoverContent = async (editor, getNewState) => {
|
|
|
9689
9701
|
const widgetRevision = next(editor.uid);
|
|
9690
9702
|
const widget = widgets[widgetIndex];
|
|
9691
9703
|
const newState = await getNewState(widget.newState);
|
|
9692
|
-
if (get
|
|
9704
|
+
if (get(editor.uid) !== widgetRevision) {
|
|
9693
9705
|
return editor;
|
|
9694
9706
|
}
|
|
9695
9707
|
if (!newState) {
|
|
@@ -10963,7 +10975,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
10963
10975
|
const latestChildIndex = latestAfterInvoke.widgets.findIndex(isWidget);
|
|
10964
10976
|
if (latestChildIndex === -1) {
|
|
10965
10977
|
set$8(editor.uid, editor, latestAfterInvoke);
|
|
10966
|
-
await dispose$
|
|
10978
|
+
await dispose$3();
|
|
10967
10979
|
return latestAfterInvoke;
|
|
10968
10980
|
}
|
|
10969
10981
|
const diff = await invoke(`${name}.diff2`, uid);
|
|
@@ -11267,11 +11279,11 @@ const openRename = async editor => {
|
|
|
11267
11279
|
try {
|
|
11268
11280
|
editorWithRenameWidget = await addWidgetToEditor(Rename$1, FocusEditorRename$1, editor, create$1, newStateGenerator$1, fullFocus);
|
|
11269
11281
|
} catch (error) {
|
|
11270
|
-
await dispose$
|
|
11282
|
+
await dispose$3();
|
|
11271
11283
|
throw error;
|
|
11272
11284
|
}
|
|
11273
11285
|
if (editorWithRenameWidget === editor) {
|
|
11274
|
-
await dispose$
|
|
11286
|
+
await dispose$3();
|
|
11275
11287
|
return editor;
|
|
11276
11288
|
}
|
|
11277
11289
|
const wordBefore = getWordBefore(editor, rowIndex, columnIndex);
|
|
@@ -12594,7 +12606,7 @@ const getLineCommentEdit = (rowIndex, line, lineComment) => {
|
|
|
12594
12606
|
};
|
|
12595
12607
|
};
|
|
12596
12608
|
|
|
12597
|
-
const getSelectedLineCommentEdits = (editor, lineComment) => {
|
|
12609
|
+
const getSelectedLineCommentEdits = (editor, lineComment, origin = ToggleBlockComment$1) => {
|
|
12598
12610
|
const {
|
|
12599
12611
|
lines,
|
|
12600
12612
|
selections
|
|
@@ -12628,7 +12640,7 @@ const getSelectedLineCommentEdits = (editor, lineComment) => {
|
|
|
12628
12640
|
rowIndex
|
|
12629
12641
|
},
|
|
12630
12642
|
inserted: [`${lineComment} `],
|
|
12631
|
-
origin
|
|
12643
|
+
origin,
|
|
12632
12644
|
start: {
|
|
12633
12645
|
columnIndex,
|
|
12634
12646
|
rowIndex
|
|
@@ -12665,10 +12677,7 @@ const editorToggleLineComment = async editor => {
|
|
|
12665
12677
|
if (!lineComment) {
|
|
12666
12678
|
return editor;
|
|
12667
12679
|
}
|
|
12668
|
-
const
|
|
12669
|
-
const cursorRowIndex = editor.selections[0];
|
|
12670
|
-
const line = getLine$1(textDocument, cursorRowIndex);
|
|
12671
|
-
const documentEdits = [getLineCommentEdit(cursorRowIndex, line, lineComment)];
|
|
12680
|
+
const documentEdits = getSelectedLineCommentEdits(editor, lineComment, LineComment);
|
|
12672
12681
|
return scheduleDocumentAndCursorsSelections(editor, documentEdits);
|
|
12673
12682
|
};
|
|
12674
12683
|
|
|
@@ -16160,14 +16169,6 @@ const getScrollBarDiagnostics = (editor, diagnostics) => {
|
|
|
16160
16169
|
return scrollBarDecorations;
|
|
16161
16170
|
};
|
|
16162
16171
|
|
|
16163
|
-
const renderedDoms = new Map();
|
|
16164
|
-
const get = uid => {
|
|
16165
|
-
return renderedDoms.get(uid);
|
|
16166
|
-
};
|
|
16167
|
-
const set = (uid, dom) => {
|
|
16168
|
-
renderedDoms.set(uid, dom);
|
|
16169
|
-
};
|
|
16170
|
-
|
|
16171
16172
|
const getDom = state => {
|
|
16172
16173
|
const {
|
|
16173
16174
|
diagnostics = [],
|
|
@@ -16193,13 +16194,13 @@ const mergeConflictsEqual = (oldState, newState) => {
|
|
|
16193
16194
|
});
|
|
16194
16195
|
};
|
|
16195
16196
|
const renderIncremental = (oldState, newState) => {
|
|
16196
|
-
const oldDom = oldState.initial || !mergeConflictsEqual(oldState, newState) ? getDom(oldState) : get(newState.uid) || getDom(oldState);
|
|
16197
|
+
const oldDom = oldState.initial || !mergeConflictsEqual(oldState, newState) ? getDom(oldState) : get$1(newState.uid) || getDom(oldState);
|
|
16197
16198
|
const newDom = getDom(newState);
|
|
16198
16199
|
const patches = diffTree(oldDom, newDom);
|
|
16199
16200
|
if (patches.length === 0) {
|
|
16200
16201
|
return [];
|
|
16201
16202
|
}
|
|
16202
|
-
set(newState.uid, newDom);
|
|
16203
|
+
set$1(newState.uid, newDom);
|
|
16203
16204
|
return [SetPatches, newState.uid, patches];
|
|
16204
16205
|
};
|
|
16205
16206
|
|
|
@@ -16911,7 +16912,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
16911
16912
|
}
|
|
16912
16913
|
const newEditorWithDerivedState = await updateDerivedState(state, newEditor);
|
|
16913
16914
|
set$8(uid, state, newEditorWithDerivedState);
|
|
16914
|
-
await dispose$
|
|
16915
|
+
await dispose$3();
|
|
16915
16916
|
if (editorDiagnosticEffect.isActive(state, newEditorWithDerivedState)) {
|
|
16916
16917
|
void editorDiagnosticEffect.apply(newEditorWithDerivedState);
|
|
16917
16918
|
}
|
|
@@ -16948,7 +16949,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
16948
16949
|
if (lines !== finalEditor.lines && !isUntitledFile(finalEditor.uri)) {
|
|
16949
16950
|
schedule(uid, token => saveAfterDelay(uid, token));
|
|
16950
16951
|
} else if (modified && !finalEditor.modified) {
|
|
16951
|
-
dispose$
|
|
16952
|
+
dispose$4(uid);
|
|
16952
16953
|
}
|
|
16953
16954
|
return returnState ? finalEditor : undefined;
|
|
16954
16955
|
});
|