@lvce-editor/editor-worker 19.30.2 → 19.30.4
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 +43 -9
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -4987,24 +4987,45 @@ const addCursorBelow = editor => {
|
|
|
4987
4987
|
|
|
4988
4988
|
const getDocumentEdits = (editor, edits) => {
|
|
4989
4989
|
const documentEdits = [];
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4990
|
+
let currentDocument = editor;
|
|
4991
|
+
let linesDelta = 0;
|
|
4992
|
+
let offsetDelta = 0;
|
|
4993
|
+
const sortedEdits = edits.toSorted((a, b) => a.startOffset - b.startOffset || a.endOffset - b.endOffset);
|
|
4994
|
+
for (const edit of sortedEdits) {
|
|
4995
|
+
const currentStart = positionAt(currentDocument, edit.startOffset + offsetDelta);
|
|
4996
|
+
const currentEnd = positionAt(currentDocument, edit.endOffset + offsetDelta);
|
|
4997
|
+
const deleted = getSelectionText(currentDocument, {
|
|
4998
|
+
end: currentEnd,
|
|
4999
|
+
start: currentStart
|
|
4996
5000
|
});
|
|
4997
5001
|
const documentEdit = {
|
|
4998
5002
|
deleted,
|
|
4999
|
-
end
|
|
5003
|
+
end: {
|
|
5004
|
+
columnIndex: currentEnd.columnIndex,
|
|
5005
|
+
rowIndex: currentEnd.rowIndex - linesDelta
|
|
5006
|
+
},
|
|
5000
5007
|
inserted: splitLines(edit.inserted),
|
|
5001
5008
|
origin: Format,
|
|
5002
|
-
start
|
|
5009
|
+
start: {
|
|
5010
|
+
columnIndex: currentStart.columnIndex,
|
|
5011
|
+
rowIndex: currentStart.rowIndex - linesDelta
|
|
5012
|
+
}
|
|
5003
5013
|
};
|
|
5004
5014
|
if (documentEdit.inserted.length === 0) {
|
|
5005
5015
|
documentEdit.inserted = [''];
|
|
5006
5016
|
}
|
|
5007
5017
|
documentEdits.push(documentEdit);
|
|
5018
|
+
const currentEdit = {
|
|
5019
|
+
...documentEdit,
|
|
5020
|
+
end: currentEnd,
|
|
5021
|
+
start: currentStart
|
|
5022
|
+
};
|
|
5023
|
+
currentDocument = {
|
|
5024
|
+
...currentDocument,
|
|
5025
|
+
lines: applyEdits(currentDocument, [currentEdit])
|
|
5026
|
+
};
|
|
5027
|
+
linesDelta += documentEdit.inserted.length - documentEdit.deleted.length;
|
|
5028
|
+
offsetDelta += edit.inserted.length - (edit.endOffset - edit.startOffset);
|
|
5008
5029
|
}
|
|
5009
5030
|
return documentEdits;
|
|
5010
5031
|
};
|
|
@@ -11172,6 +11193,19 @@ const HandleScrollBarVerticalPointerUp = 32;
|
|
|
11172
11193
|
const HandleWheel = 33;
|
|
11173
11194
|
const HandleKeyUp = 34;
|
|
11174
11195
|
|
|
11196
|
+
const getDiagnosticHoverDetail = ({
|
|
11197
|
+
code,
|
|
11198
|
+
source
|
|
11199
|
+
}) => {
|
|
11200
|
+
if (code === undefined) {
|
|
11201
|
+
return source || '';
|
|
11202
|
+
}
|
|
11203
|
+
if (!source) {
|
|
11204
|
+
return String(code);
|
|
11205
|
+
}
|
|
11206
|
+
return `${source} (${code})`;
|
|
11207
|
+
};
|
|
11208
|
+
|
|
11175
11209
|
const Div = 4;
|
|
11176
11210
|
const Input = 6;
|
|
11177
11211
|
const Span = 8;
|
|
@@ -11252,7 +11286,7 @@ const getHoverVirtualDom = (lineInfos, documentation, diagnostics) => {
|
|
|
11252
11286
|
type: Div
|
|
11253
11287
|
});
|
|
11254
11288
|
for (const diagnostic of diagnostics) {
|
|
11255
|
-
dom.push(hoverProblemMessage, text(diagnostic.message), hoverProblemDetail, text(
|
|
11289
|
+
dom.push(hoverProblemMessage, text(diagnostic.message), hoverProblemDetail, text(getDiagnosticHoverDetail(diagnostic)));
|
|
11256
11290
|
}
|
|
11257
11291
|
}
|
|
11258
11292
|
if (lineInfos.length > 0) {
|