@lvce-editor/editor-worker 19.56.0 → 19.56.2
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 +44 -5
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -6418,7 +6418,7 @@ const handleBlur$1 = async editor => {
|
|
|
6418
6418
|
widgetRevision,
|
|
6419
6419
|
widgets: closeWidgetsMaybe(editor.widgets || [])
|
|
6420
6420
|
};
|
|
6421
|
-
if (!editor.modified) {
|
|
6421
|
+
if (!editor.modified || isUntitledFile(editor.uri)) {
|
|
6422
6422
|
return newEditor;
|
|
6423
6423
|
}
|
|
6424
6424
|
const autoSave = await get$3('files.autoSave');
|
|
@@ -15996,17 +15996,55 @@ const notifyDiagnosticsChange = async uri => {
|
|
|
15996
15996
|
// Older renderer workers do not support diagnostics change listeners.
|
|
15997
15997
|
}
|
|
15998
15998
|
};
|
|
15999
|
+
const diagnosticsEqual = (left, right) => {
|
|
16000
|
+
if (left === right) {
|
|
16001
|
+
return true;
|
|
16002
|
+
}
|
|
16003
|
+
if ((left?.length ?? 0) !== right.length) {
|
|
16004
|
+
return false;
|
|
16005
|
+
}
|
|
16006
|
+
return right.every((diagnostic, index) => {
|
|
16007
|
+
const other = left[index];
|
|
16008
|
+
return other.code === diagnostic.code && other.columnIndex === diagnostic.columnIndex && other.endColumnIndex === diagnostic.endColumnIndex && other.endRowIndex === diagnostic.endRowIndex && other.message === diagnostic.message && other.rowIndex === diagnostic.rowIndex && other.source === diagnostic.source && other.type === diagnostic.type && other.uri === diagnostic.uri;
|
|
16009
|
+
});
|
|
16010
|
+
};
|
|
16011
|
+
const diagnosticLayoutEqual = (left, right) => left.charWidth === right.charWidth && left.deltaY === right.deltaY && left.fontFamily === right.fontFamily && left.fontSize === right.fontSize && left.fontWeight === right.fontWeight && left.isMonospaceFont === right.isMonospaceFont && left.itemHeight === right.itemHeight && left.letterSpacing === right.letterSpacing && left.lines === right.lines && left.minLineY === right.minLineY && left.rowHeight === right.rowHeight && left.tabSize === right.tabSize && left.viewLineIndices === right.viewLineIndices && left.width === right.width;
|
|
16012
|
+
const isApplicable = (latest, editor) => latest && latest.newState.diagnosticsEnabled && latest.newState.lines === editor.lines && latest.newState.uri === editor.uri;
|
|
16013
|
+
const mergeDiagnostics = (editor, editorWithDiagnostics) => ({
|
|
16014
|
+
...editor,
|
|
16015
|
+
decorations: editorWithDiagnostics.decorations,
|
|
16016
|
+
diagnostics: editorWithDiagnostics.diagnostics,
|
|
16017
|
+
lightBulbRowIndex: editorWithDiagnostics.lightBulbRowIndex,
|
|
16018
|
+
visualDecorations: editorWithDiagnostics.visualDecorations
|
|
16019
|
+
});
|
|
15999
16020
|
const updateDiagnostics = async editor => {
|
|
16000
16021
|
if (!editor.diagnosticsEnabled) {
|
|
16001
16022
|
return editor;
|
|
16002
16023
|
}
|
|
16003
16024
|
try {
|
|
16004
16025
|
const diagnostics = await getDiagnostics(editor);
|
|
16005
|
-
|
|
16006
|
-
if (!latest
|
|
16026
|
+
let latest = get$8(editor.id);
|
|
16027
|
+
if (!isApplicable(latest, editor)) {
|
|
16007
16028
|
return editor;
|
|
16008
16029
|
}
|
|
16009
|
-
|
|
16030
|
+
if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
|
|
16031
|
+
return latest.newState;
|
|
16032
|
+
}
|
|
16033
|
+
let calculationState = latest.newState;
|
|
16034
|
+
let editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
16035
|
+
latest = get$8(editor.id);
|
|
16036
|
+
while (isApplicable(latest, editor) && !diagnosticLayoutEqual(calculationState, latest.newState)) {
|
|
16037
|
+
calculationState = latest.newState;
|
|
16038
|
+
editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
16039
|
+
latest = get$8(editor.id);
|
|
16040
|
+
}
|
|
16041
|
+
if (!isApplicable(latest, editor)) {
|
|
16042
|
+
return editor;
|
|
16043
|
+
}
|
|
16044
|
+
if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
|
|
16045
|
+
return latest.newState;
|
|
16046
|
+
}
|
|
16047
|
+
const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
|
|
16010
16048
|
set$8(editor.id, latest.oldState, newEditor);
|
|
16011
16049
|
await invoke$7('Editor.renderPending', newEditor.id);
|
|
16012
16050
|
await notifyDiagnosticsChange(newEditor.uri);
|
|
@@ -16166,7 +16204,7 @@ const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...ar
|
|
|
16166
16204
|
set$8(otherUid, instance.oldState, synchronizedEditor);
|
|
16167
16205
|
}
|
|
16168
16206
|
}
|
|
16169
|
-
if (lines !== finalEditor.lines) {
|
|
16207
|
+
if (lines !== finalEditor.lines && !isUntitledFile(finalEditor.uri)) {
|
|
16170
16208
|
schedule(uid, token => saveAfterDelay(uid, token));
|
|
16171
16209
|
} else if (modified && !finalEditor.modified) {
|
|
16172
16210
|
dispose$2(uid);
|
|
@@ -16409,6 +16447,7 @@ const commandMap = {
|
|
|
16409
16447
|
'EditorCompletion.closeDetails': closeDetails$1,
|
|
16410
16448
|
'EditorCompletion.focusFirst': focusFirst$1,
|
|
16411
16449
|
'EditorCompletion.focusIndex': focusIndex$2,
|
|
16450
|
+
'EditorCompletion.focusLast': focusLast$1,
|
|
16412
16451
|
'EditorCompletion.focusNext': focusNext$2,
|
|
16413
16452
|
'EditorCompletion.focusPrevious': focusPrevious$1,
|
|
16414
16453
|
'EditorCompletion.handleEditorBlur': handleEditorBlur,
|