@lvce-editor/editor-worker 19.73.3 → 19.74.0
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 +170 -28
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -5557,6 +5557,54 @@ const getEditorGutterDecorations = async editor => {
|
|
|
5557
5557
|
}
|
|
5558
5558
|
};
|
|
5559
5559
|
|
|
5560
|
+
const isValidEditorTextDecoration = (value, lines) => {
|
|
5561
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
5562
|
+
return false;
|
|
5563
|
+
}
|
|
5564
|
+
const {
|
|
5565
|
+
color,
|
|
5566
|
+
endColumnIndex,
|
|
5567
|
+
endRowIndex,
|
|
5568
|
+
startColumnIndex,
|
|
5569
|
+
startRowIndex,
|
|
5570
|
+
thickness = 2
|
|
5571
|
+
} = value;
|
|
5572
|
+
return [startRowIndex, startColumnIndex, endRowIndex, endColumnIndex].every(item => Number.isSafeInteger(item) && item >= 0) && endRowIndex >= startRowIndex && (endRowIndex !== startRowIndex || endColumnIndex >= startColumnIndex) && endRowIndex < lines.length && startColumnIndex <= lines[startRowIndex].length && endColumnIndex <= lines[endRowIndex].length && typeof color === 'string' && /^#[\da-f]{6}$/i.test(color) && Number.isSafeInteger(thickness) && thickness >= 1 && thickness <= 4;
|
|
5573
|
+
};
|
|
5574
|
+
const getEditorTextDecorations = async editor => {
|
|
5575
|
+
if (editor.largeFile) {
|
|
5576
|
+
return [];
|
|
5577
|
+
}
|
|
5578
|
+
const selections = [];
|
|
5579
|
+
for (let index = 0; index < (editor.selections || []).length; index += 4) {
|
|
5580
|
+
const [startRowIndex, startColumnIndex, endRowIndex, endColumnIndex] = getSelectionPairs(editor.selections, index);
|
|
5581
|
+
selections.push({
|
|
5582
|
+
endColumnIndex,
|
|
5583
|
+
endRowIndex,
|
|
5584
|
+
startColumnIndex,
|
|
5585
|
+
startRowIndex
|
|
5586
|
+
});
|
|
5587
|
+
}
|
|
5588
|
+
try {
|
|
5589
|
+
const results = await invoke$8(editor.applicationId, 'Extensions.executeProvidersByEvent', 'onEditorTextDecoration', 'ExtensionApi.executeEditorTextDecorationProvider', {
|
|
5590
|
+
languageId: editor.languageId,
|
|
5591
|
+
selections,
|
|
5592
|
+
text: getText$1(editor),
|
|
5593
|
+
uri: editor.uri
|
|
5594
|
+
});
|
|
5595
|
+
if (!Array.isArray(results)) {
|
|
5596
|
+
return [];
|
|
5597
|
+
}
|
|
5598
|
+
return results.flatMap(result => Array.isArray(result) ? result.filter(item => isValidEditorTextDecoration(item, editor.lines)) : []);
|
|
5599
|
+
} catch {
|
|
5600
|
+
return [];
|
|
5601
|
+
}
|
|
5602
|
+
};
|
|
5603
|
+
const refreshTextDecorations = async editor => ({
|
|
5604
|
+
...editor,
|
|
5605
|
+
textDecorations: await getEditorTextDecorations(editor)
|
|
5606
|
+
});
|
|
5607
|
+
|
|
5560
5608
|
const diagnosticContainsPosition = (diagnostic, rowIndex, columnIndex) => {
|
|
5561
5609
|
const {
|
|
5562
5610
|
columnIndex: startColumnIndex,
|
|
@@ -5651,6 +5699,80 @@ const getMinimapLines = async (editor, syncIncremental) => {
|
|
|
5651
5699
|
return result.tokens.map((lineState, index) => getLine(lineState, result.embeddedResults, tokenMap, lines[index].length));
|
|
5652
5700
|
};
|
|
5653
5701
|
|
|
5702
|
+
const mergeClassNames = (...classNames) => {
|
|
5703
|
+
return classNames.filter(Boolean).join(' ');
|
|
5704
|
+
};
|
|
5705
|
+
|
|
5706
|
+
const Button$1 = 1;
|
|
5707
|
+
const Div = 4;
|
|
5708
|
+
const Input = 6;
|
|
5709
|
+
const Span = 8;
|
|
5710
|
+
const Text = 12;
|
|
5711
|
+
const Img = 17;
|
|
5712
|
+
const Nav = 40;
|
|
5713
|
+
const TextArea = 62;
|
|
5714
|
+
|
|
5715
|
+
const getTextDecorationsVirtualDom = async editor => {
|
|
5716
|
+
const dom = [];
|
|
5717
|
+
const {
|
|
5718
|
+
deltaY,
|
|
5719
|
+
foldingRanges = [],
|
|
5720
|
+
itemHeight,
|
|
5721
|
+
lines,
|
|
5722
|
+
maxLineY,
|
|
5723
|
+
minLineY,
|
|
5724
|
+
rowHeight,
|
|
5725
|
+
textDecorations = [],
|
|
5726
|
+
viewLineIndices
|
|
5727
|
+
} = editor;
|
|
5728
|
+
const visibleRows = editor.visibleLineIndices || Array.from({
|
|
5729
|
+
length: Math.max(0, maxLineY - minLineY)
|
|
5730
|
+
}, (_, index) => minLineY + index);
|
|
5731
|
+
const getVisualRow = row => viewLineIndices ? getVisualRowForDocumentRow$1(row, viewLineIndices) : getVisualRowForDocumentRow(row, foldingRanges);
|
|
5732
|
+
const startVisualRow = itemHeight ? Math.floor(deltaY / itemHeight) : getVisualRow(minLineY);
|
|
5733
|
+
for (const [decorationIndex, decoration] of textDecorations.entries()) {
|
|
5734
|
+
const {
|
|
5735
|
+
endColumnIndex,
|
|
5736
|
+
endRowIndex,
|
|
5737
|
+
startColumnIndex,
|
|
5738
|
+
startRowIndex,
|
|
5739
|
+
thickness = 2
|
|
5740
|
+
} = decoration;
|
|
5741
|
+
const addRow = async row => {
|
|
5742
|
+
if (row < startRowIndex || row > endRowIndex || row >= lines.length) {
|
|
5743
|
+
return;
|
|
5744
|
+
}
|
|
5745
|
+
const start = row === startRowIndex ? startColumnIndex : 0;
|
|
5746
|
+
const end = row === endRowIndex ? endColumnIndex : lines[row].length;
|
|
5747
|
+
if (end <= start) {
|
|
5748
|
+
return;
|
|
5749
|
+
}
|
|
5750
|
+
const getX$1 = column => getX(lines[row], column, editor.fontWeight, editor.fontSize, editor.fontFamily, editor.isMonospaceFont, editor.letterSpacing, editor.tabSize, 0, Infinity, editor.charWidth, -(editor.deltaX || 0));
|
|
5751
|
+
const x = await getX$1(start);
|
|
5752
|
+
const endX = await getX$1(end);
|
|
5753
|
+
const left = Math.max(0, x);
|
|
5754
|
+
const right = Math.min(editor.width - (editor.gutterWidth || 0), endX);
|
|
5755
|
+
if (right <= left) {
|
|
5756
|
+
return;
|
|
5757
|
+
}
|
|
5758
|
+
const top = (getVisualRow(row) - startVisualRow + 1) * rowHeight - thickness;
|
|
5759
|
+
dom.push({
|
|
5760
|
+
childCount: 0,
|
|
5761
|
+
className: mergeClassNames('EditorTextDecoration', `EditorTextDecoration${decorationIndex}`),
|
|
5762
|
+
height: thickness,
|
|
5763
|
+
left,
|
|
5764
|
+
top,
|
|
5765
|
+
type: Div,
|
|
5766
|
+
width: right - left
|
|
5767
|
+
});
|
|
5768
|
+
};
|
|
5769
|
+
for (const row of visibleRows) {
|
|
5770
|
+
await addRow(row);
|
|
5771
|
+
}
|
|
5772
|
+
}
|
|
5773
|
+
return dom;
|
|
5774
|
+
};
|
|
5775
|
+
|
|
5654
5776
|
const closingBrackets = {
|
|
5655
5777
|
'(': ')',
|
|
5656
5778
|
'[': ']',
|
|
@@ -6042,6 +6164,12 @@ const updateDerivedState = async (oldState, newState, deferGutterDecorations = f
|
|
|
6042
6164
|
incrementalEdits: emptyIncrementalEdits
|
|
6043
6165
|
};
|
|
6044
6166
|
let finalState = nextState;
|
|
6167
|
+
if (oldState.lines !== nextState.lines || oldState.uri !== nextState.uri) {
|
|
6168
|
+
finalState = {
|
|
6169
|
+
...finalState,
|
|
6170
|
+
textDecorations: await getEditorTextDecorations(nextState)
|
|
6171
|
+
};
|
|
6172
|
+
}
|
|
6045
6173
|
if (nextState.breadcrumbsEnabled && oldState.lines !== nextState.lines && oldState.documentSymbols === nextState.documentSymbols) {
|
|
6046
6174
|
finalState = {
|
|
6047
6175
|
...finalState,
|
|
@@ -6108,6 +6236,12 @@ const updateDerivedState = async (oldState, newState, deferGutterDecorations = f
|
|
|
6108
6236
|
gutterDecorations: await getEditorGutterDecorations(finalState)
|
|
6109
6237
|
};
|
|
6110
6238
|
}
|
|
6239
|
+
if ((finalState.textDecorations?.length || 0) > 0 || (oldState.textDecorationDom?.length || 0) > 0) {
|
|
6240
|
+
finalState = {
|
|
6241
|
+
...finalState,
|
|
6242
|
+
textDecorationDom: await getTextDecorationsVirtualDom(finalState)
|
|
6243
|
+
};
|
|
6244
|
+
}
|
|
6111
6245
|
if (!shouldUpdateSelectionData(oldState, nextState)) {
|
|
6112
6246
|
return finalState;
|
|
6113
6247
|
}
|
|
@@ -6772,7 +6906,7 @@ const isEqual$5 = (oldState, newState) => {
|
|
|
6772
6906
|
};
|
|
6773
6907
|
|
|
6774
6908
|
const isEqual$4 = (oldState, newState) => {
|
|
6775
|
-
return oldState.rowHeight === newState.rowHeight && oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.deltaX === newState.deltaX && oldState.gutterWidth === newState.gutterWidth && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.width === newState.width && oldState.scrollBarHeight === newState.scrollBarHeight;
|
|
6909
|
+
return oldState.rowHeight === newState.rowHeight && oldState.textDecorations === newState.textDecorations && oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.deltaX === newState.deltaX && oldState.gutterWidth === newState.gutterWidth && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.width === newState.width && oldState.scrollBarHeight === newState.scrollBarHeight;
|
|
6776
6910
|
};
|
|
6777
6911
|
|
|
6778
6912
|
const isEqual$3 = (oldState, newState) => {
|
|
@@ -6789,7 +6923,7 @@ const isEqual$3 = (oldState, newState) => {
|
|
|
6789
6923
|
};
|
|
6790
6924
|
|
|
6791
6925
|
const isEqual$2 = (oldState, newState) => {
|
|
6792
|
-
return oldState.breadcrumbFileIcon === newState.breadcrumbFileIcon && oldState.breadcrumbsEnabled === newState.breadcrumbsEnabled && oldState.breakPoints === newState.breakPoints && oldState.bracketMatchInfos === newState.bracketMatchInfos && oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.documentSymbols === newState.documentSymbols && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.focused === newState.focused && oldState.gutterDecorations === newState.gutterDecorations && oldState.highlightActiveLineNumber === newState.highlightActiveLineNumber && oldState.highlightedLine === newState.highlightedLine && oldState.problemsHighlightedRow === newState.problemsHighlightedRow && oldState.lineNumbers === newState.lineNumbers && oldState.loadError === newState.loadError && oldState.textInfos === newState.textInfos && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.scrollBarHeight === newState.scrollBarHeight && oldState.width === newState.width && oldState.gutterWidth === newState.gutterWidth && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
|
|
6926
|
+
return oldState.textDecorationDom === newState.textDecorationDom && oldState.breadcrumbFileIcon === newState.breadcrumbFileIcon && oldState.breadcrumbsEnabled === newState.breadcrumbsEnabled && oldState.breakPoints === newState.breakPoints && oldState.bracketMatchInfos === newState.bracketMatchInfos && oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.documentSymbols === newState.documentSymbols && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.focused === newState.focused && oldState.gutterDecorations === newState.gutterDecorations && oldState.highlightActiveLineNumber === newState.highlightActiveLineNumber && oldState.highlightedLine === newState.highlightedLine && oldState.problemsHighlightedRow === newState.problemsHighlightedRow && oldState.lineNumbers === newState.lineNumbers && oldState.loadError === newState.loadError && oldState.textInfos === newState.textInfos && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.scrollBarHeight === newState.scrollBarHeight && oldState.width === newState.width && oldState.gutterWidth === newState.gutterWidth && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
|
|
6793
6927
|
};
|
|
6794
6928
|
|
|
6795
6929
|
const isEqual$1 = (oldState, newState) => {
|
|
@@ -8629,6 +8763,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
8629
8763
|
initial,
|
|
8630
8764
|
insertSpaces,
|
|
8631
8765
|
isSelecting,
|
|
8766
|
+
lifecycle,
|
|
8632
8767
|
lines,
|
|
8633
8768
|
modified,
|
|
8634
8769
|
redoStack,
|
|
@@ -8653,11 +8788,14 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
8653
8788
|
cursorUndoStack: [...previousCursorUndoStack.slice(1 - cursorUndoLimit), new Uint32Array(selections)]
|
|
8654
8789
|
};
|
|
8655
8790
|
}
|
|
8656
|
-
if (state === newEditor) {
|
|
8791
|
+
if (state === newEditor || !get$8(uid) || lifecycle?.disposed || get$8(uid).newState.lifecycle !== lifecycle) {
|
|
8657
8792
|
return returnState ? newEditor : undefined;
|
|
8658
8793
|
}
|
|
8659
8794
|
const deferGutterDecorations = !initial && uri === newEditor.uri && lines !== newEditor.lines && Boolean(newEditor.lifecycle);
|
|
8660
8795
|
const newEditorWithDerivedState = await updateDerivedState(state, newEditor, deferGutterDecorations);
|
|
8796
|
+
if (!get$8(uid) || lifecycle?.disposed || get$8(uid).newState.lifecycle !== lifecycle) {
|
|
8797
|
+
return returnState ? newEditorWithDerivedState : undefined;
|
|
8798
|
+
}
|
|
8661
8799
|
// Another command can commit before the renderer consumes this edit.
|
|
8662
8800
|
// Keep its last rendered baseline, including renders completed while we awaited derived state.
|
|
8663
8801
|
const renderedState = get$8(uid)?.oldState ?? oldInstance.oldState;
|
|
@@ -8693,7 +8831,11 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
8693
8831
|
undoStack: finalEditor.undoStack,
|
|
8694
8832
|
visualDecorations: finalEditor.visualDecorations
|
|
8695
8833
|
}, deferGutterDecorations);
|
|
8696
|
-
|
|
8834
|
+
const latest = get$8(otherUid);
|
|
8835
|
+
if (!latest || editor.lifecycle?.disposed || latest.newState.lifecycle !== editor.lifecycle) {
|
|
8836
|
+
continue;
|
|
8837
|
+
}
|
|
8838
|
+
set$a(otherUid, latest.oldState, synchronizedEditor);
|
|
8697
8839
|
if (deferGutterDecorations) {
|
|
8698
8840
|
schedule(synchronizedEditor);
|
|
8699
8841
|
}
|
|
@@ -13176,9 +13318,10 @@ const newStateGenerator$1 = async (state, parentUid) => {
|
|
|
13176
13318
|
newState
|
|
13177
13319
|
} = get$8(parentUid);
|
|
13178
13320
|
const {
|
|
13321
|
+
applicationId,
|
|
13179
13322
|
languageId
|
|
13180
13323
|
} = newState;
|
|
13181
|
-
await invoke$5('Rename.create', uid, x, y, width, height, parentUid, languageId);
|
|
13324
|
+
await invoke$5('Rename.create', uid, x, y, width, height, parentUid, languageId, applicationId);
|
|
13182
13325
|
await invoke$5('Rename.loadContent', uid);
|
|
13183
13326
|
const diff = await invoke$5('Rename.diff2', uid);
|
|
13184
13327
|
const commands = await invoke$5('Rename.render2', uid, diff);
|
|
@@ -15335,15 +15478,6 @@ const HandleMouseOut = 38;
|
|
|
15335
15478
|
const HandleMouseOver = 39;
|
|
15336
15479
|
const HandleHoverMouseDown = 40;
|
|
15337
15480
|
|
|
15338
|
-
const Button$1 = 1;
|
|
15339
|
-
const Div = 4;
|
|
15340
|
-
const Input = 6;
|
|
15341
|
-
const Span = 8;
|
|
15342
|
-
const Text = 12;
|
|
15343
|
-
const Img = 17;
|
|
15344
|
-
const Nav = 40;
|
|
15345
|
-
const TextArea = 62;
|
|
15346
|
-
|
|
15347
15481
|
const text = data => {
|
|
15348
15482
|
return {
|
|
15349
15483
|
childCount: 0,
|
|
@@ -15634,10 +15768,6 @@ const getLineInfosVirtualDom = lineInfos => {
|
|
|
15634
15768
|
return dom;
|
|
15635
15769
|
};
|
|
15636
15770
|
|
|
15637
|
-
const mergeClassNames = (...classNames) => {
|
|
15638
|
-
return classNames.filter(Boolean).join(' ');
|
|
15639
|
-
};
|
|
15640
|
-
|
|
15641
15771
|
const Focusable = 0;
|
|
15642
15772
|
|
|
15643
15773
|
const hoverProblemMessage = {
|
|
@@ -17753,6 +17883,10 @@ ${editorSelector} .EditorGutterDecorationDeleted {
|
|
|
17753
17883
|
top: calc(50% - 1px);
|
|
17754
17884
|
}
|
|
17755
17885
|
${editorSelector} .R{background-color:#add6ff40}
|
|
17886
|
+
${editorSelector} .EditorTextDecoration {
|
|
17887
|
+
position: absolute;
|
|
17888
|
+
pointer-events: none;
|
|
17889
|
+
}
|
|
17756
17890
|
${editorSelector} .BracketMatch {
|
|
17757
17891
|
position: absolute;
|
|
17758
17892
|
box-sizing: border-box;
|
|
@@ -17790,7 +17924,10 @@ const renderCss$1 = (oldState, newState) => {
|
|
|
17790
17924
|
const scrollBarTop = getScrollBarY(deltaY, finalDeltaY, height, scrollBarHeight);
|
|
17791
17925
|
const scrollBarWidth = getScrollBarSize(width, longestLineWidth, minimumSliderSize);
|
|
17792
17926
|
const scrollBarLeft = getScrollBarOffset(deltaX, Math.max(0, longestLineWidth - width), width, scrollBarWidth);
|
|
17793
|
-
const
|
|
17927
|
+
const decorationCss = (newState.textDecorations || []).map(({
|
|
17928
|
+
color
|
|
17929
|
+
}, index) => `.Editor[data-uid="${uid}"] .EditorTextDecoration${index} { background-color: ${color}; }`).join('\n');
|
|
17930
|
+
const css = decorationCss + getCss(uid, rowHeight, scrollBarHeight, scrollBarTop, scrollBarWidth, scrollBarLeft, deltaY);
|
|
17794
17931
|
return [SetCss$1, uid, gutterWidth ? `${css}\n.Editor[data-uid="${uid}"] .Gutter { width: ${gutterWidth}px; }\n` : css];
|
|
17795
17932
|
};
|
|
17796
17933
|
|
|
@@ -18049,14 +18186,14 @@ const getDiagnosticsVirtualDom = diagnostics => {
|
|
|
18049
18186
|
return dom;
|
|
18050
18187
|
};
|
|
18051
18188
|
|
|
18052
|
-
const getEditorDiagnosticsVirtualDom = (diagnostics, bracketMatchInfos = []) => {
|
|
18189
|
+
const getEditorDiagnosticsVirtualDom = (diagnostics, bracketMatchInfos = [], textDecorationDom = []) => {
|
|
18053
18190
|
const diagnosticsDom = getDiagnosticsVirtualDom([...diagnostics]);
|
|
18054
18191
|
const bracketMatchesDom = getBracketMatchesVirtualDom(bracketMatchInfos);
|
|
18055
18192
|
return [{
|
|
18056
|
-
childCount: diagnostics.length + bracketMatchInfos.length,
|
|
18193
|
+
childCount: diagnostics.length + bracketMatchInfos.length + textDecorationDom.length,
|
|
18057
18194
|
className: 'LayerDiagnostics',
|
|
18058
18195
|
type: Div
|
|
18059
|
-
}, ...diagnosticsDom, ...bracketMatchesDom];
|
|
18196
|
+
}, ...diagnosticsDom, ...bracketMatchesDom, ...textDecorationDom];
|
|
18060
18197
|
};
|
|
18061
18198
|
|
|
18062
18199
|
const DiagnosticTag = {
|
|
@@ -18301,8 +18438,8 @@ const editorLayersNode = {
|
|
|
18301
18438
|
className: 'EditorLayers',
|
|
18302
18439
|
type: Div
|
|
18303
18440
|
};
|
|
18304
|
-
const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineNumbers = true, highlightedLine = -1, cursorInfos = [], diagnostics = [], visibleLineIndices = [], endOfLineDecorations = [], bracketMatchInfos = [], focused = true, visibleViewLineIndices = [], problemsHighlightedRow = -1, roundedSelection = false, unnecessaryDiagnostics = [], horizontalVisibleRanges = [], lines = [], tabSize = 2) => {
|
|
18305
|
-
return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused, roundedSelection), ...getEditorRowsVirtualDom(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, problemsHighlightedRow, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize), ...getEditorCursorsVirtualDom(cursorInfos, focused), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos)];
|
|
18441
|
+
const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineNumbers = true, highlightedLine = -1, cursorInfos = [], diagnostics = [], visibleLineIndices = [], endOfLineDecorations = [], bracketMatchInfos = [], focused = true, visibleViewLineIndices = [], problemsHighlightedRow = -1, roundedSelection = false, unnecessaryDiagnostics = [], horizontalVisibleRanges = [], lines = [], tabSize = 2, textDecorationDom = []) => {
|
|
18442
|
+
return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused, roundedSelection), ...getEditorRowsVirtualDom(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, problemsHighlightedRow, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize), ...getEditorCursorsVirtualDom(cursorInfos, focused), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos, textDecorationDom)];
|
|
18306
18443
|
};
|
|
18307
18444
|
|
|
18308
18445
|
const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
|
|
@@ -18385,6 +18522,7 @@ const getEditorContentVirtualDom = ({
|
|
|
18385
18522
|
scrollBarWidth = 0,
|
|
18386
18523
|
selectionInfos = [],
|
|
18387
18524
|
tabSize = 2,
|
|
18525
|
+
textDecorationDom = [],
|
|
18388
18526
|
textInfos,
|
|
18389
18527
|
unnecessaryDiagnostics = [],
|
|
18390
18528
|
visibleLineIndices = [],
|
|
@@ -18393,7 +18531,7 @@ const getEditorContentVirtualDom = ({
|
|
|
18393
18531
|
return [{
|
|
18394
18532
|
...editorContentNode,
|
|
18395
18533
|
className: breadcrumbsEnabled ? 'EditorContent EditorBreadcrumbsOffset' : 'EditorContent'
|
|
18396
|
-
}, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused, visibleViewLineIndices, problemsHighlightedRow, roundedSelection, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarWidth)];
|
|
18534
|
+
}, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused, visibleViewLineIndices, problemsHighlightedRow, roundedSelection, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize, textDecorationDom), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarWidth)];
|
|
18397
18535
|
};
|
|
18398
18536
|
|
|
18399
18537
|
const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
|
|
@@ -18565,6 +18703,7 @@ const getEditorVirtualDom = ({
|
|
|
18565
18703
|
selectionInfos = [],
|
|
18566
18704
|
selections = new Uint32Array(),
|
|
18567
18705
|
tabSize = 2,
|
|
18706
|
+
textDecorationDom = [],
|
|
18568
18707
|
textInfos,
|
|
18569
18708
|
uid,
|
|
18570
18709
|
unnecessaryDiagnostics = [],
|
|
@@ -18627,6 +18766,7 @@ const getEditorVirtualDom = ({
|
|
|
18627
18766
|
scrollBarWidth,
|
|
18628
18767
|
selectionInfos,
|
|
18629
18768
|
tabSize,
|
|
18769
|
+
textDecorationDom,
|
|
18630
18770
|
textInfos: combineWhitespaceTokens$1 ? textInfos.map(combineWhitespaceTokens) : textInfos,
|
|
18631
18771
|
unnecessaryDiagnostics,
|
|
18632
18772
|
visibleLineIndices: visibleLineIndices || [],
|
|
@@ -18731,7 +18871,7 @@ const canRenderPlainTextAppend = (oldState, newState) => {
|
|
|
18731
18871
|
if (oldState.initial || newState.initial || !oldState.focused || !newState.focused || oldState.uid !== newState.uid || oldTextInfos[0][1] !== newTextInfos[0][1] || oldState.cursorInfos.length !== 1 || newState.cursorInfos.length !== 1 || oldState.selectionInfos.length > 0 || newState.selectionInfos.length > 0 || oldState.selections.length !== 4 || newState.selections.length !== 4 || oldState.selections[0] !== 0 || oldState.selections[1] !== oldLine.length || oldState.selections[2] !== 0 || oldState.selections[3] !== oldLine.length || newState.selections[0] !== 0 || newState.selections[1] !== newLine.length || newState.selections[2] !== 0 || newState.selections[3] !== newLine.length) {
|
|
18732
18872
|
return false;
|
|
18733
18873
|
}
|
|
18734
|
-
if (oldState.breadcrumbsEnabled || newState.breadcrumbsEnabled || oldState.minimapEnabled || newState.minimapEnabled || oldState.lineNumbers !== newState.lineNumbers || oldState.highlightActiveLineNumber !== newState.highlightActiveLineNumber || oldState.highlightedLine !== newState.highlightedLine || oldState.problemsHighlightedRow !== newState.problemsHighlightedRow || oldState.focused !== newState.focused || oldState.roundedSelection !== newState.roundedSelection || oldState.width !== newState.width || oldState.height !== newState.height || oldState.minimumSliderSize !== newState.minimumSliderSize || getScrollBarSize(oldState.width, oldState.longestLineWidth, oldState.minimumSliderSize) !== getScrollBarSize(newState.width, newState.longestLineWidth, newState.minimumSliderSize) || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || !sameValues(oldState.visibleLineIndices, newState.visibleLineIndices) || !sameValues(oldState.visibleViewLineIndices, newState.visibleViewLineIndices) || oldState.differences !== newState.differences && !sameValues(oldState.differences, newState.differences) || oldState.scrollBarHeight !== newState.scrollBarHeight || oldState.uri !== newState.uri || oldState.workspaceUri !== newState.workspaceUri || oldState.assetDir !== newState.assetDir || oldState.loadError !== newState.loadError || oldState.combineWhitespaceTokens !== newState.combineWhitespaceTokens || oldState.widgets?.length > 0 || newState.widgets?.length > 0 || oldState.mergeConflicts.length > 0 || newState.mergeConflicts.length > 0 || !isEmpty(oldState.diagnostics) || !isEmpty(newState.diagnostics) || !isEmpty(oldState.visualDecorations) || !isEmpty(newState.visualDecorations) || !isEmpty(oldState.bracketMatchInfos) || !isEmpty(newState.bracketMatchInfos) || !isEmpty(oldState.endOfLineDecorations) || !isEmpty(newState.endOfLineDecorations) || !isEmpty(oldState.gutterDecorations) || !isEmpty(newState.gutterDecorations) || !isEmpty(oldState.breakPoints) || !isEmpty(newState.breakPoints)) {
|
|
18874
|
+
if (oldState.breadcrumbsEnabled || newState.breadcrumbsEnabled || oldState.minimapEnabled || newState.minimapEnabled || oldState.lineNumbers !== newState.lineNumbers || oldState.highlightActiveLineNumber !== newState.highlightActiveLineNumber || oldState.highlightedLine !== newState.highlightedLine || oldState.problemsHighlightedRow !== newState.problemsHighlightedRow || oldState.focused !== newState.focused || oldState.roundedSelection !== newState.roundedSelection || oldState.width !== newState.width || oldState.height !== newState.height || oldState.minimumSliderSize !== newState.minimumSliderSize || getScrollBarSize(oldState.width, oldState.longestLineWidth, oldState.minimumSliderSize) !== getScrollBarSize(newState.width, newState.longestLineWidth, newState.minimumSliderSize) || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || !sameValues(oldState.visibleLineIndices, newState.visibleLineIndices) || !sameValues(oldState.visibleViewLineIndices, newState.visibleViewLineIndices) || oldState.differences !== newState.differences && !sameValues(oldState.differences, newState.differences) || oldState.scrollBarHeight !== newState.scrollBarHeight || oldState.uri !== newState.uri || oldState.workspaceUri !== newState.workspaceUri || oldState.assetDir !== newState.assetDir || oldState.loadError !== newState.loadError || oldState.combineWhitespaceTokens !== newState.combineWhitespaceTokens || oldState.widgets?.length > 0 || newState.widgets?.length > 0 || oldState.mergeConflicts.length > 0 || newState.mergeConflicts.length > 0 || !isEmpty(oldState.diagnostics) || !isEmpty(newState.diagnostics) || !isEmpty(oldState.textDecorationDom) || !isEmpty(newState.textDecorationDom) || !isEmpty(oldState.visualDecorations) || !isEmpty(newState.visualDecorations) || !isEmpty(oldState.bracketMatchInfos) || !isEmpty(newState.bracketMatchInfos) || !isEmpty(oldState.endOfLineDecorations) || !isEmpty(newState.endOfLineDecorations) || !isEmpty(oldState.gutterDecorations) || !isEmpty(newState.gutterDecorations) || !isEmpty(oldState.breakPoints) || !isEmpty(newState.breakPoints)) {
|
|
18735
18875
|
return false;
|
|
18736
18876
|
}
|
|
18737
18877
|
return true;
|
|
@@ -19018,12 +19158,13 @@ const renderAdditionalFocusContext = {
|
|
|
19018
19158
|
};
|
|
19019
19159
|
const renderDecorations = {
|
|
19020
19160
|
apply(oldState, newState) {
|
|
19161
|
+
const textDecorationsDom = newState.textDecorationDom || [];
|
|
19021
19162
|
const diagnosticsDom = getDiagnosticsVirtualDom(newState.visualDecorations || []);
|
|
19022
19163
|
const bracketMatchesDom = getBracketMatchesVirtualDom(newState.bracketMatchInfos || []);
|
|
19023
|
-
const dom = [...diagnosticsDom, ...bracketMatchesDom];
|
|
19164
|
+
const dom = [...diagnosticsDom, ...bracketMatchesDom, ...textDecorationsDom];
|
|
19024
19165
|
return ['setDecorationsDom', dom];
|
|
19025
19166
|
},
|
|
19026
|
-
isEqual: (oldState, newState) => oldState.visualDecorations === newState.visualDecorations && oldState.bracketMatchInfos === newState.bracketMatchInfos
|
|
19167
|
+
isEqual: (oldState, newState) => oldState.visualDecorations === newState.visualDecorations && oldState.bracketMatchInfos === newState.bracketMatchInfos && oldState.textDecorationDom === newState.textDecorationDom
|
|
19027
19168
|
};
|
|
19028
19169
|
const renderGutterInfo = {
|
|
19029
19170
|
apply(oldState, newState) {
|
|
@@ -19529,6 +19670,7 @@ const commandMap = {
|
|
|
19529
19670
|
'Editor.redo': wrapCommand(redo),
|
|
19530
19671
|
'Editor.refreshGutterDecorations': wrapCommand(refreshGutterDecorations),
|
|
19531
19672
|
'Editor.refreshGutterDecorationsAll': refreshGutterDecorationsAll,
|
|
19673
|
+
'Editor.refreshTextDecorations': wrapCommand(refreshTextDecorations),
|
|
19532
19674
|
'Editor.render': renderEditor,
|
|
19533
19675
|
'Editor.render2': render2,
|
|
19534
19676
|
'Editor.renderEventListeners': renderEventListeners,
|