@lvce-editor/editor-worker 19.73.4 → 19.74.1
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 +169 -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
|
}
|
|
@@ -14801,7 +14943,7 @@ const toggleCompletion = async editor => {
|
|
|
14801
14943
|
};
|
|
14802
14944
|
|
|
14803
14945
|
const type = async (editor, text) => {
|
|
14804
|
-
const changes = editorReplaceSelections(editor,
|
|
14946
|
+
const changes = editorReplaceSelections(editor, splitLines(text), EditorType);
|
|
14805
14947
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
14806
14948
|
};
|
|
14807
14949
|
|
|
@@ -15336,15 +15478,6 @@ const HandleMouseOut = 38;
|
|
|
15336
15478
|
const HandleMouseOver = 39;
|
|
15337
15479
|
const HandleHoverMouseDown = 40;
|
|
15338
15480
|
|
|
15339
|
-
const Button$1 = 1;
|
|
15340
|
-
const Div = 4;
|
|
15341
|
-
const Input = 6;
|
|
15342
|
-
const Span = 8;
|
|
15343
|
-
const Text = 12;
|
|
15344
|
-
const Img = 17;
|
|
15345
|
-
const Nav = 40;
|
|
15346
|
-
const TextArea = 62;
|
|
15347
|
-
|
|
15348
15481
|
const text = data => {
|
|
15349
15482
|
return {
|
|
15350
15483
|
childCount: 0,
|
|
@@ -15635,10 +15768,6 @@ const getLineInfosVirtualDom = lineInfos => {
|
|
|
15635
15768
|
return dom;
|
|
15636
15769
|
};
|
|
15637
15770
|
|
|
15638
|
-
const mergeClassNames = (...classNames) => {
|
|
15639
|
-
return classNames.filter(Boolean).join(' ');
|
|
15640
|
-
};
|
|
15641
|
-
|
|
15642
15771
|
const Focusable = 0;
|
|
15643
15772
|
|
|
15644
15773
|
const hoverProblemMessage = {
|
|
@@ -17754,6 +17883,10 @@ ${editorSelector} .EditorGutterDecorationDeleted {
|
|
|
17754
17883
|
top: calc(50% - 1px);
|
|
17755
17884
|
}
|
|
17756
17885
|
${editorSelector} .R{background-color:#add6ff40}
|
|
17886
|
+
${editorSelector} .EditorTextDecoration {
|
|
17887
|
+
position: absolute;
|
|
17888
|
+
pointer-events: none;
|
|
17889
|
+
}
|
|
17757
17890
|
${editorSelector} .BracketMatch {
|
|
17758
17891
|
position: absolute;
|
|
17759
17892
|
box-sizing: border-box;
|
|
@@ -17791,7 +17924,10 @@ const renderCss$1 = (oldState, newState) => {
|
|
|
17791
17924
|
const scrollBarTop = getScrollBarY(deltaY, finalDeltaY, height, scrollBarHeight);
|
|
17792
17925
|
const scrollBarWidth = getScrollBarSize(width, longestLineWidth, minimumSliderSize);
|
|
17793
17926
|
const scrollBarLeft = getScrollBarOffset(deltaX, Math.max(0, longestLineWidth - width), width, scrollBarWidth);
|
|
17794
|
-
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);
|
|
17795
17931
|
return [SetCss$1, uid, gutterWidth ? `${css}\n.Editor[data-uid="${uid}"] .Gutter { width: ${gutterWidth}px; }\n` : css];
|
|
17796
17932
|
};
|
|
17797
17933
|
|
|
@@ -18050,14 +18186,14 @@ const getDiagnosticsVirtualDom = diagnostics => {
|
|
|
18050
18186
|
return dom;
|
|
18051
18187
|
};
|
|
18052
18188
|
|
|
18053
|
-
const getEditorDiagnosticsVirtualDom = (diagnostics, bracketMatchInfos = []) => {
|
|
18189
|
+
const getEditorDiagnosticsVirtualDom = (diagnostics, bracketMatchInfos = [], textDecorationDom = []) => {
|
|
18054
18190
|
const diagnosticsDom = getDiagnosticsVirtualDom([...diagnostics]);
|
|
18055
18191
|
const bracketMatchesDom = getBracketMatchesVirtualDom(bracketMatchInfos);
|
|
18056
18192
|
return [{
|
|
18057
|
-
childCount: diagnostics.length + bracketMatchInfos.length,
|
|
18193
|
+
childCount: diagnostics.length + bracketMatchInfos.length + textDecorationDom.length,
|
|
18058
18194
|
className: 'LayerDiagnostics',
|
|
18059
18195
|
type: Div
|
|
18060
|
-
}, ...diagnosticsDom, ...bracketMatchesDom];
|
|
18196
|
+
}, ...diagnosticsDom, ...bracketMatchesDom, ...textDecorationDom];
|
|
18061
18197
|
};
|
|
18062
18198
|
|
|
18063
18199
|
const DiagnosticTag = {
|
|
@@ -18302,8 +18438,8 @@ const editorLayersNode = {
|
|
|
18302
18438
|
className: 'EditorLayers',
|
|
18303
18439
|
type: Div
|
|
18304
18440
|
};
|
|
18305
|
-
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) => {
|
|
18306
|
-
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)];
|
|
18307
18443
|
};
|
|
18308
18444
|
|
|
18309
18445
|
const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
|
|
@@ -18386,6 +18522,7 @@ const getEditorContentVirtualDom = ({
|
|
|
18386
18522
|
scrollBarWidth = 0,
|
|
18387
18523
|
selectionInfos = [],
|
|
18388
18524
|
tabSize = 2,
|
|
18525
|
+
textDecorationDom = [],
|
|
18389
18526
|
textInfos,
|
|
18390
18527
|
unnecessaryDiagnostics = [],
|
|
18391
18528
|
visibleLineIndices = [],
|
|
@@ -18394,7 +18531,7 @@ const getEditorContentVirtualDom = ({
|
|
|
18394
18531
|
return [{
|
|
18395
18532
|
...editorContentNode,
|
|
18396
18533
|
className: breadcrumbsEnabled ? 'EditorContent EditorBreadcrumbsOffset' : 'EditorContent'
|
|
18397
|
-
}, ...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)];
|
|
18398
18535
|
};
|
|
18399
18536
|
|
|
18400
18537
|
const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
|
|
@@ -18566,6 +18703,7 @@ const getEditorVirtualDom = ({
|
|
|
18566
18703
|
selectionInfos = [],
|
|
18567
18704
|
selections = new Uint32Array(),
|
|
18568
18705
|
tabSize = 2,
|
|
18706
|
+
textDecorationDom = [],
|
|
18569
18707
|
textInfos,
|
|
18570
18708
|
uid,
|
|
18571
18709
|
unnecessaryDiagnostics = [],
|
|
@@ -18628,6 +18766,7 @@ const getEditorVirtualDom = ({
|
|
|
18628
18766
|
scrollBarWidth,
|
|
18629
18767
|
selectionInfos,
|
|
18630
18768
|
tabSize,
|
|
18769
|
+
textDecorationDom,
|
|
18631
18770
|
textInfos: combineWhitespaceTokens$1 ? textInfos.map(combineWhitespaceTokens) : textInfos,
|
|
18632
18771
|
unnecessaryDiagnostics,
|
|
18633
18772
|
visibleLineIndices: visibleLineIndices || [],
|
|
@@ -18732,7 +18871,7 @@ const canRenderPlainTextAppend = (oldState, newState) => {
|
|
|
18732
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) {
|
|
18733
18872
|
return false;
|
|
18734
18873
|
}
|
|
18735
|
-
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)) {
|
|
18736
18875
|
return false;
|
|
18737
18876
|
}
|
|
18738
18877
|
return true;
|
|
@@ -19019,12 +19158,13 @@ const renderAdditionalFocusContext = {
|
|
|
19019
19158
|
};
|
|
19020
19159
|
const renderDecorations = {
|
|
19021
19160
|
apply(oldState, newState) {
|
|
19161
|
+
const textDecorationsDom = newState.textDecorationDom || [];
|
|
19022
19162
|
const diagnosticsDom = getDiagnosticsVirtualDom(newState.visualDecorations || []);
|
|
19023
19163
|
const bracketMatchesDom = getBracketMatchesVirtualDom(newState.bracketMatchInfos || []);
|
|
19024
|
-
const dom = [...diagnosticsDom, ...bracketMatchesDom];
|
|
19164
|
+
const dom = [...diagnosticsDom, ...bracketMatchesDom, ...textDecorationsDom];
|
|
19025
19165
|
return ['setDecorationsDom', dom];
|
|
19026
19166
|
},
|
|
19027
|
-
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
|
|
19028
19168
|
};
|
|
19029
19169
|
const renderGutterInfo = {
|
|
19030
19170
|
apply(oldState, newState) {
|
|
@@ -19530,6 +19670,7 @@ const commandMap = {
|
|
|
19530
19670
|
'Editor.redo': wrapCommand(redo),
|
|
19531
19671
|
'Editor.refreshGutterDecorations': wrapCommand(refreshGutterDecorations),
|
|
19532
19672
|
'Editor.refreshGutterDecorationsAll': refreshGutterDecorationsAll,
|
|
19673
|
+
'Editor.refreshTextDecorations': wrapCommand(refreshTextDecorations),
|
|
19533
19674
|
'Editor.render': renderEditor,
|
|
19534
19675
|
'Editor.render2': render2,
|
|
19535
19676
|
'Editor.renderEventListeners': renderEventListeners,
|