@lvce-editor/editor-worker 19.48.0 → 19.50.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 +401 -73
- package/dist/settings.json +16 -0
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1199,7 +1199,7 @@ const create$a = rpcId => {
|
|
|
1199
1199
|
};
|
|
1200
1200
|
|
|
1201
1201
|
const Audio = 0;
|
|
1202
|
-
const Button$
|
|
1202
|
+
const Button$3 = 1;
|
|
1203
1203
|
const Col = 2;
|
|
1204
1204
|
const ColGroup = 3;
|
|
1205
1205
|
const Div$1 = 4;
|
|
@@ -1290,7 +1290,7 @@ const VirtualDomElements = {
|
|
|
1290
1290
|
Audio,
|
|
1291
1291
|
BlockQuote,
|
|
1292
1292
|
Br,
|
|
1293
|
-
Button: Button$
|
|
1293
|
+
Button: Button$3,
|
|
1294
1294
|
Canvas,
|
|
1295
1295
|
Circle,
|
|
1296
1296
|
Cite,
|
|
@@ -1368,7 +1368,7 @@ const VirtualDomElements = {
|
|
|
1368
1368
|
};
|
|
1369
1369
|
|
|
1370
1370
|
const AltKey = 'event.altKey';
|
|
1371
|
-
const Button$
|
|
1371
|
+
const Button$2 = 'event.button';
|
|
1372
1372
|
const ClientX = 'event.clientX';
|
|
1373
1373
|
const ClientY = 'event.clientY';
|
|
1374
1374
|
const DeltaMode = 'event.deltaMode';
|
|
@@ -2008,6 +2008,103 @@ const clamp = (num, min, max) => {
|
|
|
2008
2008
|
return Math.min(Math.max(num, min), max);
|
|
2009
2009
|
};
|
|
2010
2010
|
|
|
2011
|
+
const toMergeConflictActionsRow = rowIndex => ~rowIndex;
|
|
2012
|
+
const isMergeConflictActionsRow = viewRow => viewRow < 0;
|
|
2013
|
+
const getMergeConflictRowIndex = viewRow => ~viewRow;
|
|
2014
|
+
const getViewLineIndices = (lineCount, isRowHidden, mergeConflicts) => {
|
|
2015
|
+
const conflictStartRows = new Set(mergeConflicts.map(conflict => conflict.startRowIndex));
|
|
2016
|
+
const result = [];
|
|
2017
|
+
for (let rowIndex = 0; rowIndex < lineCount; rowIndex++) {
|
|
2018
|
+
if (isRowHidden(rowIndex)) {
|
|
2019
|
+
continue;
|
|
2020
|
+
}
|
|
2021
|
+
if (conflictStartRows.has(rowIndex)) {
|
|
2022
|
+
result.push(toMergeConflictActionsRow(rowIndex));
|
|
2023
|
+
}
|
|
2024
|
+
result.push(rowIndex);
|
|
2025
|
+
}
|
|
2026
|
+
return result;
|
|
2027
|
+
};
|
|
2028
|
+
const getVisibleViewLineIndices = (viewLineIndices, startVisualRow, numberOfVisibleLines) => {
|
|
2029
|
+
return viewLineIndices.slice(startVisualRow, startVisualRow + numberOfVisibleLines);
|
|
2030
|
+
};
|
|
2031
|
+
const getVisibleLineIndices = visibleViewLineIndices => {
|
|
2032
|
+
return visibleViewLineIndices.filter(viewRow => !isMergeConflictActionsRow(viewRow));
|
|
2033
|
+
};
|
|
2034
|
+
const getVisualRowForDocumentRow$1 = (rowIndex, viewLineIndices) => {
|
|
2035
|
+
const visualRow = viewLineIndices.indexOf(rowIndex);
|
|
2036
|
+
return visualRow === -1 ? rowIndex : visualRow;
|
|
2037
|
+
};
|
|
2038
|
+
const getDocumentRowForVisualRow$1 = (visualRow, viewLineIndices) => {
|
|
2039
|
+
if (visualRow < 0 || visualRow >= viewLineIndices.length) {
|
|
2040
|
+
return visualRow;
|
|
2041
|
+
}
|
|
2042
|
+
const viewRow = viewLineIndices[visualRow];
|
|
2043
|
+
return isMergeConflictActionsRow(viewRow) ? getMergeConflictRowIndex(viewRow) : viewRow;
|
|
2044
|
+
};
|
|
2045
|
+
|
|
2046
|
+
const isStartMarker = line => /^<{7}(?: .*)?$/.test(line);
|
|
2047
|
+
const isBaseMarker = line => /^\|{7}(?: .*)?$/.test(line);
|
|
2048
|
+
const isSeparatorMarker = line => /^={7}$/.test(line);
|
|
2049
|
+
const isEndMarker = line => /^>{7}(?: .*)?$/.test(line);
|
|
2050
|
+
const getMergeConflict = (lines, startRowIndex) => {
|
|
2051
|
+
let baseMarkerRowIndex = -1;
|
|
2052
|
+
let separatorRowIndex = -1;
|
|
2053
|
+
let endRowIndex = -1;
|
|
2054
|
+
for (let rowIndex = startRowIndex + 1; rowIndex < lines.length; rowIndex++) {
|
|
2055
|
+
const line = lines[rowIndex];
|
|
2056
|
+
if (isStartMarker(line)) {
|
|
2057
|
+
return undefined;
|
|
2058
|
+
}
|
|
2059
|
+
if (separatorRowIndex === -1 && baseMarkerRowIndex === -1 && isBaseMarker(line)) {
|
|
2060
|
+
baseMarkerRowIndex = rowIndex;
|
|
2061
|
+
continue;
|
|
2062
|
+
}
|
|
2063
|
+
if (separatorRowIndex === -1 && isSeparatorMarker(line)) {
|
|
2064
|
+
separatorRowIndex = rowIndex;
|
|
2065
|
+
continue;
|
|
2066
|
+
}
|
|
2067
|
+
if (isEndMarker(line)) {
|
|
2068
|
+
endRowIndex = rowIndex;
|
|
2069
|
+
break;
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
if (separatorRowIndex === -1 || endRowIndex === -1 || baseMarkerRowIndex > separatorRowIndex) {
|
|
2073
|
+
return undefined;
|
|
2074
|
+
}
|
|
2075
|
+
const currentEndRowIndex = baseMarkerRowIndex === -1 ? separatorRowIndex : baseMarkerRowIndex;
|
|
2076
|
+
return {
|
|
2077
|
+
baseEndRowIndex: separatorRowIndex,
|
|
2078
|
+
baseStartRowIndex: baseMarkerRowIndex === -1 ? separatorRowIndex : baseMarkerRowIndex + 1,
|
|
2079
|
+
currentEndRowIndex,
|
|
2080
|
+
currentStartRowIndex: startRowIndex + 1,
|
|
2081
|
+
endRowIndex,
|
|
2082
|
+
incomingEndRowIndex: endRowIndex,
|
|
2083
|
+
incomingStartRowIndex: separatorRowIndex + 1,
|
|
2084
|
+
separatorRowIndex,
|
|
2085
|
+
startRowIndex
|
|
2086
|
+
};
|
|
2087
|
+
};
|
|
2088
|
+
const getMergeConflicts = lines => {
|
|
2089
|
+
const conflicts = [];
|
|
2090
|
+
let rowIndex = 0;
|
|
2091
|
+
while (rowIndex < lines.length) {
|
|
2092
|
+
if (!isStartMarker(lines[rowIndex])) {
|
|
2093
|
+
rowIndex++;
|
|
2094
|
+
continue;
|
|
2095
|
+
}
|
|
2096
|
+
const conflict = getMergeConflict(lines, rowIndex);
|
|
2097
|
+
if (conflict) {
|
|
2098
|
+
conflicts.push(conflict);
|
|
2099
|
+
rowIndex = conflict.endRowIndex + 1;
|
|
2100
|
+
continue;
|
|
2101
|
+
}
|
|
2102
|
+
const nextEndMarker = lines.findIndex((line, index) => index > rowIndex && isEndMarker(line));
|
|
2103
|
+
rowIndex = (nextEndMarker === -1 ? rowIndex : nextEndMarker) + 1;
|
|
2104
|
+
}
|
|
2105
|
+
return conflicts;
|
|
2106
|
+
};
|
|
2107
|
+
|
|
2011
2108
|
const getScrollBarOffset = (delta, finalDelta, size, scrollBarSize) => {
|
|
2012
2109
|
const scrollBarOffset = delta / finalDelta * (size - scrollBarSize);
|
|
2013
2110
|
if (!Number.isFinite(scrollBarOffset)) {
|
|
@@ -2057,6 +2154,14 @@ const getNewDeltaPercent = (height, scrollBarHeight, relativeY) => {
|
|
|
2057
2154
|
const getSortedRanges = ranges => {
|
|
2058
2155
|
return ranges.toSorted((a, b) => a.start - b.start || b.end - a.end);
|
|
2059
2156
|
};
|
|
2157
|
+
const isRowHidden = (rowIndex, ranges) => {
|
|
2158
|
+
for (const range of ranges) {
|
|
2159
|
+
if (rowIndex > range.start && rowIndex <= range.end) {
|
|
2160
|
+
return true;
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
return false;
|
|
2164
|
+
};
|
|
2060
2165
|
const getUnhiddenRow = (rowIndex, previousRowIndex, lineCount, ranges) => {
|
|
2061
2166
|
for (const range of ranges) {
|
|
2062
2167
|
if (rowIndex > range.start && rowIndex <= range.end) {
|
|
@@ -2123,12 +2228,16 @@ const updateLayout = (editor, foldingRanges) => {
|
|
|
2123
2228
|
numberOfVisibleLines,
|
|
2124
2229
|
rowHeight
|
|
2125
2230
|
} = editor;
|
|
2126
|
-
const
|
|
2231
|
+
const mergeConflicts = editor.mergeConflictActionsEnabled ? getMergeConflicts(lines) : [];
|
|
2232
|
+
const hasMergeConflictRows = mergeConflicts.length > 0;
|
|
2233
|
+
const viewLineIndices = hasMergeConflictRows ? getViewLineIndices(lines.length, rowIndex => isRowHidden(rowIndex, foldingRanges), mergeConflicts) : [];
|
|
2234
|
+
const visibleLineCount = hasMergeConflictRows ? viewLineIndices.length : getVisibleLineCount(lines.length, foldingRanges);
|
|
2127
2235
|
const finalY = Math.max(visibleLineCount - numberOfVisibleLines, 0);
|
|
2128
2236
|
const finalDeltaY = finalY * itemHeight;
|
|
2129
2237
|
const deltaY = clamp(editor.deltaY, 0, finalDeltaY);
|
|
2130
2238
|
const startVisualRow = Math.floor(deltaY / itemHeight);
|
|
2131
|
-
const
|
|
2239
|
+
const visibleViewLineIndices = hasMergeConflictRows ? getVisibleViewLineIndices(viewLineIndices, startVisualRow, numberOfVisibleLines) : getViewportLineIndices(lines.length, foldingRanges, startVisualRow, numberOfVisibleLines);
|
|
2240
|
+
const visibleLineIndices = hasMergeConflictRows ? getVisibleLineIndices(visibleViewLineIndices) : visibleViewLineIndices;
|
|
2132
2241
|
const minLineY = visibleLineIndices[0] ?? 0;
|
|
2133
2242
|
const maxLineY = visibleLineIndices.length === 0 ? 0 : visibleLineIndices.at(-1) + 1;
|
|
2134
2243
|
const contentHeight = visibleLineCount * rowHeight;
|
|
@@ -2141,10 +2250,13 @@ const updateLayout = (editor, foldingRanges) => {
|
|
|
2141
2250
|
finalY,
|
|
2142
2251
|
foldingRanges,
|
|
2143
2252
|
maxLineY,
|
|
2253
|
+
mergeConflicts,
|
|
2144
2254
|
minLineY,
|
|
2145
2255
|
scrollBarHeight,
|
|
2146
2256
|
scrollBarY,
|
|
2147
|
-
|
|
2257
|
+
viewLineIndices,
|
|
2258
|
+
visibleLineIndices,
|
|
2259
|
+
visibleViewLineIndices
|
|
2148
2260
|
};
|
|
2149
2261
|
};
|
|
2150
2262
|
const addRange = (ranges, range) => {
|
|
@@ -3288,22 +3400,20 @@ const setDeltaY$1 = async (state, value) => {
|
|
|
3288
3400
|
if (deltaY === newDeltaY) {
|
|
3289
3401
|
return state;
|
|
3290
3402
|
}
|
|
3291
|
-
const
|
|
3292
|
-
const
|
|
3293
|
-
const
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3403
|
+
const startVisualRow = Math.floor(newDeltaY / itemHeight);
|
|
3404
|
+
const hasMergeConflictRows = state.viewLineIndices?.length > 0;
|
|
3405
|
+
const visibleViewLineIndices = hasMergeConflictRows ? getVisibleViewLineIndices(state.viewLineIndices, startVisualRow, numberOfVisibleLines) : getViewportLineIndices(state.lines.length, state.foldingRanges || [], startVisualRow, numberOfVisibleLines);
|
|
3406
|
+
const visibleLineIndices = hasMergeConflictRows ? getVisibleLineIndices(visibleViewLineIndices) : visibleViewLineIndices;
|
|
3407
|
+
const minLineY = visibleLineIndices[0] ?? 0;
|
|
3408
|
+
const maxLineY = visibleLineIndices.length === 0 ? 0 : visibleLineIndices.at(-1) + 1;
|
|
3409
|
+
const newEditor1 = {
|
|
3297
3410
|
...state,
|
|
3298
3411
|
deltaY: newDeltaY,
|
|
3299
3412
|
maxLineY,
|
|
3300
3413
|
minLineY,
|
|
3301
3414
|
scrollBarY: getScrollBarY(newDeltaY, finalDeltaY, height, scrollBarHeight),
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
length: Math.max(Math.min(maxLineY, state.lines.length) - minLineY, 0)
|
|
3305
|
-
}, (_, index) => minLineY + index)
|
|
3306
|
-
})
|
|
3415
|
+
visibleLineIndices,
|
|
3416
|
+
visibleViewLineIndices
|
|
3307
3417
|
};
|
|
3308
3418
|
const syncIncremental = getEnabled();
|
|
3309
3419
|
const {
|
|
@@ -3847,7 +3957,9 @@ const getVisible = async editor => {
|
|
|
3847
3957
|
rowHeight,
|
|
3848
3958
|
selections,
|
|
3849
3959
|
tabSize,
|
|
3960
|
+
viewLineIndices,
|
|
3850
3961
|
visibleLineIndices,
|
|
3962
|
+
visibleViewLineIndices,
|
|
3851
3963
|
width
|
|
3852
3964
|
} = editor;
|
|
3853
3965
|
const averageCharWidth = charWidth;
|
|
@@ -3855,18 +3967,20 @@ const getVisible = async editor => {
|
|
|
3855
3967
|
const actualVisibleLineIndices = visibleLineIndices || Array.from({
|
|
3856
3968
|
length: maxLineY - minLineY
|
|
3857
3969
|
}, (_, index) => minLineY + index);
|
|
3858
|
-
const
|
|
3859
|
-
const
|
|
3860
|
-
const
|
|
3970
|
+
const getVisualRow = rowIndex => viewLineIndices ? getVisualRowForDocumentRow$1(rowIndex, viewLineIndices) : getVisualRowForDocumentRow(rowIndex, foldingRanges);
|
|
3971
|
+
const startVisualRow = itemHeight ? Math.floor(deltaY / itemHeight) : getVisualRow(minLineY);
|
|
3972
|
+
const endVisualRow = startVisualRow + (visibleViewLineIndices?.length || actualVisibleLineIndices.length);
|
|
3973
|
+
const getRelativeRow = rowIndex => getVisualRow(rowIndex) - startVisualRow;
|
|
3974
|
+
const getDifference = rowIndex => differences[actualVisibleLineIndices.indexOf(rowIndex)];
|
|
3861
3975
|
for (let i = 0; i < selections.length; i += 4) {
|
|
3862
3976
|
const [selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn, reversed] = getSelectionPairs(selections, i);
|
|
3863
|
-
const selectionStartVisualRow =
|
|
3864
|
-
const selectionEndVisualRow =
|
|
3977
|
+
const selectionStartVisualRow = getVisualRow(selectionStartRow);
|
|
3978
|
+
const selectionEndVisualRow = getVisualRow(selectionEndRow);
|
|
3865
3979
|
if (selectionEndVisualRow < startVisualRow || selectionStartVisualRow >= endVisualRow) {
|
|
3866
3980
|
continue;
|
|
3867
3981
|
}
|
|
3868
3982
|
const relativeEndLineRow = getRelativeRow(selectionEndRow);
|
|
3869
|
-
const endLineDifference =
|
|
3983
|
+
const endLineDifference = getDifference(selectionEndRow);
|
|
3870
3984
|
const endLine = lines[selectionEndRow];
|
|
3871
3985
|
const endLineEndX = await getX(endLine, selectionEndColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, endLineDifference);
|
|
3872
3986
|
const endLineY = relativeEndLineRow * rowHeight;
|
|
@@ -3876,7 +3990,7 @@ const getVisible = async editor => {
|
|
|
3876
3990
|
}
|
|
3877
3991
|
const startLineYRelative = getRelativeRow(selectionStartRow);
|
|
3878
3992
|
const startLineY = startLineYRelative * rowHeight;
|
|
3879
|
-
const startLineDifference =
|
|
3993
|
+
const startLineDifference = getDifference(selectionStartRow);
|
|
3880
3994
|
if (selectionStartRow === selectionEndRow) {
|
|
3881
3995
|
const startX = await getX(endLine, selectionStartColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, startLineDifference);
|
|
3882
3996
|
if (reversed) {
|
|
@@ -3903,7 +4017,7 @@ const getVisible = async editor => {
|
|
|
3903
4017
|
const currentLine = lines[rowIndex];
|
|
3904
4018
|
const relativeLine = getRelativeRow(rowIndex);
|
|
3905
4019
|
const currentLineY = relativeLine * rowHeight;
|
|
3906
|
-
const difference =
|
|
4020
|
+
const difference = getDifference(rowIndex);
|
|
3907
4021
|
const selectionWidth = await getX(currentLine, currentLine.length, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, difference);
|
|
3908
4022
|
visibleSelections.push(0, currentLineY, selectionWidth, rowHeight);
|
|
3909
4023
|
}
|
|
@@ -3967,7 +4081,7 @@ const setSelections$2 = (editor, selections) => {
|
|
|
3967
4081
|
});
|
|
3968
4082
|
const previousActiveRowIndex = editor.selections[primarySelectionIndex + 2] ?? activeRowIndex;
|
|
3969
4083
|
const rowIndex = getUnhiddenRow(activeRowIndex, previousActiveRowIndex, editor.lines.length, foldingRanges);
|
|
3970
|
-
const visualRow = getVisualRowForDocumentRow(rowIndex, foldingRanges);
|
|
4084
|
+
const visualRow = editor.viewLineIndices ? getVisualRowForDocumentRow$1(rowIndex, editor.viewLineIndices) : getVisualRowForDocumentRow(rowIndex, foldingRanges);
|
|
3971
4085
|
const startVisualRow = Math.floor(editor.deltaY / editor.itemHeight);
|
|
3972
4086
|
const endVisualRow = startVisualRow + editor.numberOfVisibleLines;
|
|
3973
4087
|
if (visualRow >= startVisualRow && visualRow < endVisualRow) {
|
|
@@ -4718,9 +4832,9 @@ const getInfo = async (editor, position, visibleLineIndices, startVisualRow) =>
|
|
|
4718
4832
|
tabSize,
|
|
4719
4833
|
width
|
|
4720
4834
|
} = editor;
|
|
4721
|
-
const visualRow = getVisualRowForDocumentRow(position.rowIndex, foldingRanges);
|
|
4835
|
+
const visualRow = editor.viewLineIndices ? getVisualRowForDocumentRow$1(position.rowIndex, editor.viewLineIndices) : getVisualRowForDocumentRow(position.rowIndex, foldingRanges);
|
|
4722
4836
|
const relativeRow = visualRow - startVisualRow;
|
|
4723
|
-
const difference = differences[
|
|
4837
|
+
const difference = differences[visibleLineIndices.indexOf(position.rowIndex)] ?? 0;
|
|
4724
4838
|
const line = lines[position.rowIndex];
|
|
4725
4839
|
const x = await getX(line, position.columnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, 0, width, charWidth, difference);
|
|
4726
4840
|
const endX = await getX(line, position.columnIndex + 1, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, 0, width, charWidth, difference);
|
|
@@ -4740,12 +4854,13 @@ const getVisibleBracketMatches = async editor => {
|
|
|
4740
4854
|
maxLineY,
|
|
4741
4855
|
minLineY,
|
|
4742
4856
|
selections,
|
|
4857
|
+
viewLineIndices,
|
|
4743
4858
|
visibleLineIndices
|
|
4744
4859
|
} = editor;
|
|
4745
4860
|
const actualVisibleLineIndices = visibleLineIndices || Array.from({
|
|
4746
4861
|
length: maxLineY - minLineY
|
|
4747
4862
|
}, (_, index) => minLineY + index);
|
|
4748
|
-
const startVisualRow = itemHeight ? Math.floor(deltaY / itemHeight) : getVisualRowForDocumentRow(minLineY, foldingRanges);
|
|
4863
|
+
const startVisualRow = itemHeight ? Math.floor(deltaY / itemHeight) : viewLineIndices ? getVisualRowForDocumentRow$1(minLineY, viewLineIndices) : getVisualRowForDocumentRow(minLineY, foldingRanges);
|
|
4749
4864
|
const positions = new Map();
|
|
4750
4865
|
for (let i = 0; i < selections.length; i += 4) {
|
|
4751
4866
|
const startRowIndex = selections[i];
|
|
@@ -4770,25 +4885,24 @@ const getDiagnosticType = diagnostic => {
|
|
|
4770
4885
|
return diagnostic.type;
|
|
4771
4886
|
};
|
|
4772
4887
|
|
|
4773
|
-
const getY = (row, minLineY, rowHeight) => {
|
|
4774
|
-
return (row - minLineY) * rowHeight;
|
|
4775
|
-
};
|
|
4776
|
-
|
|
4777
4888
|
const getVisibleDiagnostics = async (editor, diagnostics) => {
|
|
4778
4889
|
const visibleDiagnostics = [];
|
|
4779
4890
|
const {
|
|
4780
4891
|
charWidth,
|
|
4892
|
+
deltaY,
|
|
4781
4893
|
fontFamily,
|
|
4782
4894
|
fontSize,
|
|
4783
4895
|
fontWeight,
|
|
4784
4896
|
isMonospaceFont,
|
|
4897
|
+
itemHeight,
|
|
4785
4898
|
letterSpacing,
|
|
4786
4899
|
lines,
|
|
4787
|
-
minLineY,
|
|
4788
4900
|
rowHeight,
|
|
4789
4901
|
tabSize,
|
|
4902
|
+
viewLineIndices,
|
|
4790
4903
|
width
|
|
4791
4904
|
} = editor;
|
|
4905
|
+
const startVisualRow = itemHeight ? Math.floor(deltaY / itemHeight) : editor.minLineY || 0;
|
|
4792
4906
|
for (const diagnostic of diagnostics) {
|
|
4793
4907
|
const {
|
|
4794
4908
|
columnIndex,
|
|
@@ -4800,7 +4914,8 @@ const getVisibleDiagnostics = async (editor, diagnostics) => {
|
|
|
4800
4914
|
const endLineDifference = 0;
|
|
4801
4915
|
const halfCursorWidth = 0;
|
|
4802
4916
|
const x = await getX(lines[rowIndex], columnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, charWidth, endLineDifference);
|
|
4803
|
-
const
|
|
4917
|
+
const visualRow = viewLineIndices ? getVisualRowForDocumentRow$1(rowIndex, viewLineIndices) : rowIndex;
|
|
4918
|
+
const y = (visualRow - startVisualRow) * rowHeight;
|
|
4804
4919
|
visibleDiagnostics.push({
|
|
4805
4920
|
height: rowHeight,
|
|
4806
4921
|
type: getDiagnosticType(diagnostic),
|
|
@@ -4816,26 +4931,41 @@ const shouldUpdateDiagnosticData = (oldState, newState) => {
|
|
|
4816
4931
|
return oldState.diagnostics !== newState.diagnostics || (newState.diagnostics?.length ?? 0) > 0 && (oldState.minLineY !== newState.minLineY || oldState.charWidth !== newState.charWidth || oldState.fontFamily !== newState.fontFamily || oldState.fontSize !== newState.fontSize || oldState.fontWeight !== newState.fontWeight || oldState.isMonospaceFont !== newState.isMonospaceFont || oldState.letterSpacing !== newState.letterSpacing || oldState.lines !== newState.lines || oldState.rowHeight !== newState.rowHeight || oldState.tabSize !== newState.tabSize || oldState.width !== newState.width);
|
|
4817
4932
|
};
|
|
4818
4933
|
const shouldUpdateSelectionData = (oldState, newState) => {
|
|
4819
|
-
return oldState.selections !== newState.selections || oldState.focused !== newState.focused || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.foldingRanges !== newState.foldingRanges || oldState.differences !== newState.differences || oldState.charWidth !== newState.charWidth || oldState.cursorWidth !== newState.cursorWidth || oldState.fontFamily !== newState.fontFamily || oldState.fontSize !== newState.fontSize || oldState.fontWeight !== newState.fontWeight || oldState.isMonospaceFont !== newState.isMonospaceFont || oldState.letterSpacing !== newState.letterSpacing || oldState.lines !== newState.lines || oldState.rowHeight !== newState.rowHeight || oldState.tabSize !== newState.tabSize || oldState.width !== newState.width;
|
|
4934
|
+
return oldState.selections !== newState.selections || oldState.focused !== newState.focused || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.visibleViewLineIndices !== newState.visibleViewLineIndices || oldState.foldingRanges !== newState.foldingRanges || oldState.differences !== newState.differences || oldState.charWidth !== newState.charWidth || oldState.cursorWidth !== newState.cursorWidth || oldState.fontFamily !== newState.fontFamily || oldState.fontSize !== newState.fontSize || oldState.fontWeight !== newState.fontWeight || oldState.isMonospaceFont !== newState.isMonospaceFont || oldState.letterSpacing !== newState.letterSpacing || oldState.lines !== newState.lines || oldState.rowHeight !== newState.rowHeight || oldState.tabSize !== newState.tabSize || oldState.width !== newState.width;
|
|
4820
4935
|
};
|
|
4821
4936
|
const shouldUpdateBracketMatchData = (oldState, newState) => {
|
|
4822
4937
|
if (!('bracketMatchInfos' in newState)) {
|
|
4823
4938
|
return false;
|
|
4824
4939
|
}
|
|
4825
|
-
return oldState.selections !== newState.selections || oldState.lines !== newState.lines || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.visibleLineIndices !== newState.visibleLineIndices || oldState.foldingRanges !== newState.foldingRanges || oldState.differences !== newState.differences || oldState.charWidth !== newState.charWidth || oldState.fontFamily !== newState.fontFamily || oldState.fontSize !== newState.fontSize || oldState.fontWeight !== newState.fontWeight || oldState.isMonospaceFont !== newState.isMonospaceFont || oldState.letterSpacing !== newState.letterSpacing || oldState.rowHeight !== newState.rowHeight || oldState.tabSize !== newState.tabSize || oldState.width !== newState.width;
|
|
4940
|
+
return oldState.selections !== newState.selections || oldState.lines !== newState.lines || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.visibleLineIndices !== newState.visibleLineIndices || oldState.visibleViewLineIndices !== newState.visibleViewLineIndices || oldState.foldingRanges !== newState.foldingRanges || oldState.differences !== newState.differences || oldState.charWidth !== newState.charWidth || oldState.fontFamily !== newState.fontFamily || oldState.fontSize !== newState.fontSize || oldState.fontWeight !== newState.fontWeight || oldState.isMonospaceFont !== newState.isMonospaceFont || oldState.letterSpacing !== newState.letterSpacing || oldState.rowHeight !== newState.rowHeight || oldState.tabSize !== newState.tabSize || oldState.width !== newState.width;
|
|
4826
4941
|
};
|
|
4827
4942
|
const shouldUpdateLightBulb = (oldState, newState) => oldState.diagnostics !== newState.diagnostics || oldState.languageId !== newState.languageId || oldState.selections !== newState.selections || oldState.uri !== newState.uri;
|
|
4828
4943
|
const shouldUpdateVisibleTextData = (oldState, newState) => {
|
|
4829
4944
|
if (oldState.textInfos !== newState.textInfos || oldState.differences !== newState.differences) {
|
|
4830
4945
|
return false;
|
|
4831
4946
|
}
|
|
4832
|
-
return oldState.lines !== newState.lines || oldState.tokenizerId !== newState.tokenizerId || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.decorations !== newState.decorations || oldState.embeds !== newState.embeds || oldState.deltaX !== newState.deltaX || oldState.width !== newState.width || oldState.highlightedLine !== newState.highlightedLine || oldState.foldingRanges !== newState.foldingRanges || oldState.debugEnabled !== newState.debugEnabled;
|
|
4947
|
+
return oldState.lines !== newState.lines || oldState.tokenizerId !== newState.tokenizerId || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.visibleLineIndices !== newState.visibleLineIndices || oldState.visibleViewLineIndices !== newState.visibleViewLineIndices || oldState.decorations !== newState.decorations || oldState.embeds !== newState.embeds || oldState.deltaX !== newState.deltaX || oldState.width !== newState.width || oldState.highlightedLine !== newState.highlightedLine || oldState.foldingRanges !== newState.foldingRanges || oldState.debugEnabled !== newState.debugEnabled;
|
|
4833
4948
|
};
|
|
4834
4949
|
const shouldUpdateMinimapData = (oldState, newState) => {
|
|
4835
4950
|
return newState.minimapEnabled && (!oldState.minimapEnabled || oldState.lines !== newState.lines || oldState.tokenizerId !== newState.tokenizerId);
|
|
4836
4951
|
};
|
|
4952
|
+
const mergeConflictsEqual$1 = (oldState, newState) => {
|
|
4953
|
+
const oldConflicts = oldState.mergeConflicts || [];
|
|
4954
|
+
const newConflicts = newState.mergeConflicts || [];
|
|
4955
|
+
if (oldConflicts.length !== newConflicts.length) {
|
|
4956
|
+
return false;
|
|
4957
|
+
}
|
|
4958
|
+
return oldConflicts.every((conflict, index) => {
|
|
4959
|
+
const other = newConflicts[index];
|
|
4960
|
+
return conflict.startRowIndex === other.startRowIndex && conflict.endRowIndex === other.endRowIndex;
|
|
4961
|
+
});
|
|
4962
|
+
};
|
|
4837
4963
|
const updateDerivedState = async (oldState, newState) => {
|
|
4838
|
-
const
|
|
4964
|
+
const layoutState = oldState.lines !== newState.lines && 'foldingRanges' in newState ? updateLayout(newState, []) : newState;
|
|
4965
|
+
const nextState = mergeConflictsEqual$1(oldState, layoutState) ? layoutState : {
|
|
4966
|
+
...layoutState,
|
|
4967
|
+
incrementalEdits: emptyIncrementalEdits
|
|
4968
|
+
};
|
|
4839
4969
|
let finalState = nextState;
|
|
4840
4970
|
if (shouldUpdateVisibleTextData(oldState, nextState)) {
|
|
4841
4971
|
const syncIncremental = getEnabled();
|
|
@@ -5040,6 +5170,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
5040
5170
|
handleOffsetX: 0,
|
|
5041
5171
|
hasListener: false,
|
|
5042
5172
|
height,
|
|
5173
|
+
highlightActiveLineNumber: true,
|
|
5043
5174
|
highlightedLine: -1,
|
|
5044
5175
|
hoverEnabled: false,
|
|
5045
5176
|
id,
|
|
@@ -5062,6 +5193,8 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
5062
5193
|
lines: [],
|
|
5063
5194
|
longestLineWidth: 0,
|
|
5064
5195
|
maxLineY: 0,
|
|
5196
|
+
mergeConflictActionsEnabled: false,
|
|
5197
|
+
mergeConflicts: [],
|
|
5065
5198
|
minimapEnabled: false,
|
|
5066
5199
|
minimapLines: [],
|
|
5067
5200
|
minimapRevision: 0,
|
|
@@ -5101,7 +5234,9 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
5101
5234
|
undoStack: [],
|
|
5102
5235
|
uri,
|
|
5103
5236
|
validLines: [],
|
|
5237
|
+
viewLineIndices: [],
|
|
5104
5238
|
visibleLineIndices: [],
|
|
5239
|
+
visibleViewLineIndices: [],
|
|
5105
5240
|
visualDecorations: [],
|
|
5106
5241
|
widgetRevision: 0,
|
|
5107
5242
|
widgets: [],
|
|
@@ -5144,6 +5279,8 @@ const emptyEditor = {
|
|
|
5144
5279
|
lines: [],
|
|
5145
5280
|
longestLineWidth: 0,
|
|
5146
5281
|
maxLineY: 0,
|
|
5282
|
+
mergeConflictActionsEnabled: false,
|
|
5283
|
+
mergeConflicts: [],
|
|
5147
5284
|
minimapEnabled: false,
|
|
5148
5285
|
minimapLines: [],
|
|
5149
5286
|
minimapRevision: 0,
|
|
@@ -5171,7 +5308,9 @@ const emptyEditor = {
|
|
|
5171
5308
|
tokenizerId: 0,
|
|
5172
5309
|
undoStack: [],
|
|
5173
5310
|
uri: '',
|
|
5311
|
+
viewLineIndices: [],
|
|
5174
5312
|
visibleLineIndices: [],
|
|
5313
|
+
visibleViewLineIndices: [],
|
|
5175
5314
|
width: 0,
|
|
5176
5315
|
workspaceUri: '',
|
|
5177
5316
|
x: 0,
|
|
@@ -5275,6 +5414,7 @@ const createEditor = async ({
|
|
|
5275
5414
|
fontWeight,
|
|
5276
5415
|
formatOnSave,
|
|
5277
5416
|
height,
|
|
5417
|
+
highlightActiveLineNumber = true,
|
|
5278
5418
|
hoverEnabled,
|
|
5279
5419
|
id,
|
|
5280
5420
|
isAutoClosingBracketsEnabled,
|
|
@@ -5338,6 +5478,7 @@ const createEditor = async ({
|
|
|
5338
5478
|
handleOffsetX: 0,
|
|
5339
5479
|
hasListener: false,
|
|
5340
5480
|
height,
|
|
5481
|
+
highlightActiveLineNumber,
|
|
5341
5482
|
id,
|
|
5342
5483
|
incrementalEdits: emptyIncrementalEdits,
|
|
5343
5484
|
insertSpaces: true,
|
|
@@ -5356,6 +5497,8 @@ const createEditor = async ({
|
|
|
5356
5497
|
lines: [],
|
|
5357
5498
|
longestLineWidth: 0,
|
|
5358
5499
|
maxLineY: 0,
|
|
5500
|
+
mergeConflictActionsEnabled: false,
|
|
5501
|
+
mergeConflicts: [],
|
|
5359
5502
|
minimumSliderSize: 20,
|
|
5360
5503
|
minLineY: 0,
|
|
5361
5504
|
modified: false,
|
|
@@ -5391,7 +5534,9 @@ const createEditor = async ({
|
|
|
5391
5534
|
uri,
|
|
5392
5535
|
useFunctionalRendering,
|
|
5393
5536
|
validLines: [],
|
|
5537
|
+
viewLineIndices: [],
|
|
5394
5538
|
visibleLineIndices: [],
|
|
5539
|
+
visibleViewLineIndices: [],
|
|
5395
5540
|
widgetRevision: 0,
|
|
5396
5541
|
widgets: [],
|
|
5397
5542
|
width,
|
|
@@ -5532,7 +5677,7 @@ const isEqual$3 = (oldState, newState) => {
|
|
|
5532
5677
|
};
|
|
5533
5678
|
|
|
5534
5679
|
const isEqual$2 = (oldState, newState) => {
|
|
5535
|
-
return 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.highlightedLine === newState.highlightedLine && oldState.lineNumbers === newState.lineNumbers && oldState.loadError === newState.loadError && oldState.textInfos === newState.textInfos && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
|
|
5680
|
+
return 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.lineNumbers === newState.lineNumbers && oldState.loadError === newState.loadError && oldState.textInfos === newState.textInfos && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
|
|
5536
5681
|
};
|
|
5537
5682
|
|
|
5538
5683
|
const isEqual$1 = (oldState, newState) => {
|
|
@@ -5746,6 +5891,58 @@ const disposeEditor = async editorUid => {
|
|
|
5746
5891
|
return commands;
|
|
5747
5892
|
};
|
|
5748
5893
|
|
|
5894
|
+
const getAcceptedLines = (lines, conflict, action) => {
|
|
5895
|
+
const current = lines.slice(conflict.currentStartRowIndex, conflict.currentEndRowIndex);
|
|
5896
|
+
const incoming = lines.slice(conflict.incomingStartRowIndex, conflict.incomingEndRowIndex);
|
|
5897
|
+
switch (action) {
|
|
5898
|
+
case 'both':
|
|
5899
|
+
return [...current, ...incoming];
|
|
5900
|
+
case 'current':
|
|
5901
|
+
return current;
|
|
5902
|
+
case 'incoming':
|
|
5903
|
+
return incoming;
|
|
5904
|
+
default:
|
|
5905
|
+
return undefined;
|
|
5906
|
+
}
|
|
5907
|
+
};
|
|
5908
|
+
const acceptMergeConflict = async (state, action, rowIndexValue) => {
|
|
5909
|
+
const rowIndex = Number(rowIndexValue);
|
|
5910
|
+
if (!Number.isSafeInteger(rowIndex)) {
|
|
5911
|
+
return state;
|
|
5912
|
+
}
|
|
5913
|
+
const conflict = getMergeConflicts(state.lines).find(candidate => candidate.startRowIndex === rowIndex);
|
|
5914
|
+
if (!conflict) {
|
|
5915
|
+
return state;
|
|
5916
|
+
}
|
|
5917
|
+
const acceptedLines = getAcceptedLines(state.lines, conflict, action);
|
|
5918
|
+
if (!acceptedLines) {
|
|
5919
|
+
return state;
|
|
5920
|
+
}
|
|
5921
|
+
const inserted = acceptedLines.length === 0 ? [''] : acceptedLines;
|
|
5922
|
+
const start = {
|
|
5923
|
+
columnIndex: 0,
|
|
5924
|
+
rowIndex: conflict.startRowIndex
|
|
5925
|
+
};
|
|
5926
|
+
const end = {
|
|
5927
|
+
columnIndex: state.lines[conflict.endRowIndex].length,
|
|
5928
|
+
rowIndex: conflict.endRowIndex
|
|
5929
|
+
};
|
|
5930
|
+
const deleted = state.lines.slice(conflict.startRowIndex, conflict.endRowIndex + 1);
|
|
5931
|
+
const selections = new Uint32Array([conflict.startRowIndex, 0, conflict.startRowIndex, 0]);
|
|
5932
|
+
const result = await scheduleDocumentAndCursorsSelections(state, [{
|
|
5933
|
+
deleted,
|
|
5934
|
+
end,
|
|
5935
|
+
inserted,
|
|
5936
|
+
origin: Unknown$2,
|
|
5937
|
+
start
|
|
5938
|
+
}], selections);
|
|
5939
|
+
return {
|
|
5940
|
+
...result,
|
|
5941
|
+
incrementalEdits: emptyIncrementalEdits
|
|
5942
|
+
};
|
|
5943
|
+
};
|
|
5944
|
+
const handleMergeConflictActionsMouseDown = state => state;
|
|
5945
|
+
|
|
5749
5946
|
// @ts-ignore
|
|
5750
5947
|
const getNewSelections$d = selections => {
|
|
5751
5948
|
const newSelections = [];
|
|
@@ -6086,6 +6283,7 @@ const at = async (editor, eventX, eventY) => {
|
|
|
6086
6283
|
lines,
|
|
6087
6284
|
rowHeight,
|
|
6088
6285
|
tabSize,
|
|
6286
|
+
viewLineIndices,
|
|
6089
6287
|
x,
|
|
6090
6288
|
y
|
|
6091
6289
|
} = editor;
|
|
@@ -6096,7 +6294,7 @@ const at = async (editor, eventX, eventY) => {
|
|
|
6096
6294
|
rowIndex: 0
|
|
6097
6295
|
};
|
|
6098
6296
|
}
|
|
6099
|
-
const rowIndex = getDocumentRowForVisualRow(visualRowIndex, foldingRanges);
|
|
6297
|
+
const rowIndex = viewLineIndices ? getDocumentRowForVisualRow$1(visualRowIndex, viewLineIndices) : getDocumentRowForVisualRow(visualRowIndex, foldingRanges);
|
|
6100
6298
|
const relativeX = eventX - x - gutterWidth + deltaX;
|
|
6101
6299
|
const clampedRowIndex = clamp(rowIndex, 0, lines.length - 1);
|
|
6102
6300
|
const line = lines[clampedRowIndex];
|
|
@@ -6931,6 +7129,7 @@ const getColorPickerBounds = editor => {
|
|
|
6931
7129
|
height: editorHeight,
|
|
6932
7130
|
rowHeight,
|
|
6933
7131
|
selections,
|
|
7132
|
+
viewLineIndices,
|
|
6934
7133
|
width: editorWidth,
|
|
6935
7134
|
x: editorX,
|
|
6936
7135
|
y: editorY
|
|
@@ -6942,7 +7141,7 @@ const getColorPickerBounds = editor => {
|
|
|
6942
7141
|
const editorRight = editorX + editorWidth;
|
|
6943
7142
|
const editorBottom = editorY + editorHeight;
|
|
6944
7143
|
const cursorX = editorX + columnIndex * columnWidth - deltaX;
|
|
6945
|
-
const visualRowIndex = getVisualRowForDocumentRow(rowIndex, foldingRanges);
|
|
7144
|
+
const visualRowIndex = viewLineIndices ? getVisualRowForDocumentRow$1(rowIndex, viewLineIndices) : getVisualRowForDocumentRow(rowIndex, foldingRanges);
|
|
6946
7145
|
const lineTop = editorY + visualRowIndex * rowHeight - deltaY;
|
|
6947
7146
|
const lineBottom = lineTop + rowHeight;
|
|
6948
7147
|
const yAbove = lineTop - height;
|
|
@@ -12580,7 +12779,10 @@ const HandleScrollBarVerticalPointerUp = 32;
|
|
|
12580
12779
|
const HandleWheel = 33;
|
|
12581
12780
|
const HandleKeyUp = 34;
|
|
12582
12781
|
const HandleLightBulbClick = 35;
|
|
12782
|
+
const HandleMergeConflictActionClick = 36;
|
|
12783
|
+
const HandleMergeConflictActionsMouseDown = 37;
|
|
12583
12784
|
|
|
12785
|
+
const Button$1 = 1;
|
|
12584
12786
|
const Div = 4;
|
|
12585
12787
|
const Input = 6;
|
|
12586
12788
|
const Span = 8;
|
|
@@ -13686,6 +13888,7 @@ const kLetterSpacing = 'editor.letterSpacing';
|
|
|
13686
13888
|
const kTabSize = 'editor.tabSize';
|
|
13687
13889
|
const kInsertSpaces = 'editor.insertSpaces';
|
|
13688
13890
|
const kLineNumbers = 'editor.lineNumbers';
|
|
13891
|
+
const kHighlightActiveLineNumber = 'editor.highlightActiveLineNumber';
|
|
13689
13892
|
const kDiagnostics = 'editor.diagnostics';
|
|
13690
13893
|
const kQuickSuggestions = 'editor.quickSuggestions';
|
|
13691
13894
|
const kAutoClosingQuotes = 'editor.autoClosingQuotes';
|
|
@@ -13693,6 +13896,7 @@ const kAutoClosingBrackets = 'editor.autoclosingBrackets';
|
|
|
13693
13896
|
const kFontWeight = 'editor.fontWeight';
|
|
13694
13897
|
const kHover = 'editor.hover';
|
|
13695
13898
|
const kMinimapEnabled = 'editor.minimap.enabled';
|
|
13899
|
+
const kMergeConflictActions = 'editor.mergeConflictActions';
|
|
13696
13900
|
const kBreadcrumbsEnabled = 'breadcrumbs.enabled';
|
|
13697
13901
|
const kDragAndDropEnabled = 'editor.dragAndDrop';
|
|
13698
13902
|
const getDragAndDropEnabled = async () => {
|
|
@@ -13737,6 +13941,9 @@ const getInsertSpaces = async () => {
|
|
|
13737
13941
|
const getLineNumbers = async () => {
|
|
13738
13942
|
return (await get$3(kLineNumbers)) ?? false;
|
|
13739
13943
|
};
|
|
13944
|
+
const getHighlightActiveLineNumber = async () => {
|
|
13945
|
+
return (await get$3(kHighlightActiveLineNumber)) ?? true;
|
|
13946
|
+
};
|
|
13740
13947
|
const getCompletionTriggerCharacters = async () => {
|
|
13741
13948
|
return ['.', '/'];
|
|
13742
13949
|
};
|
|
@@ -13749,12 +13956,15 @@ const getFontWeight = async () => {
|
|
|
13749
13956
|
const getMinimapEnabled = async () => {
|
|
13750
13957
|
return (await get$3(kMinimapEnabled)) ?? false;
|
|
13751
13958
|
};
|
|
13959
|
+
const getMergeConflictActionsEnabled = async () => {
|
|
13960
|
+
return (await get$3(kMergeConflictActions)) ?? false;
|
|
13961
|
+
};
|
|
13752
13962
|
const getBreadcrumbsEnabled = async () => {
|
|
13753
13963
|
return (await get$3(kBreadcrumbsEnabled)) ?? false;
|
|
13754
13964
|
};
|
|
13755
13965
|
|
|
13756
13966
|
const getEditorPreferences = async () => {
|
|
13757
|
-
const [diagnosticsEnabled$1, fontFamily, fontSize, fontWeight, hoverEnabled, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, breadcrumbsEnabled, insertSpaces, dragAndDropEnabled] = await Promise.all([diagnosticsEnabled(), getFontFamily(), getFontSize(), getFontWeight(), getHoverEnabled(), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters(), getMinimapEnabled(), getBreadcrumbsEnabled(), getInsertSpaces(), getDragAndDropEnabled()]);
|
|
13967
|
+
const [diagnosticsEnabled$1, fontFamily, fontSize, fontWeight, hoverEnabled, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, breadcrumbsEnabled, insertSpaces, dragAndDropEnabled] = await Promise.all([diagnosticsEnabled(), getFontFamily(), getFontSize(), getFontWeight(), getHoverEnabled(), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getHighlightActiveLineNumber(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters(), getMinimapEnabled(), getMergeConflictActionsEnabled(), getBreadcrumbsEnabled(), getInsertSpaces(), getDragAndDropEnabled()]);
|
|
13758
13968
|
return {
|
|
13759
13969
|
breadcrumbsEnabled,
|
|
13760
13970
|
completionTriggerCharacters,
|
|
@@ -13763,6 +13973,7 @@ const getEditorPreferences = async () => {
|
|
|
13763
13973
|
fontFamily,
|
|
13764
13974
|
fontSize,
|
|
13765
13975
|
fontWeight,
|
|
13976
|
+
highlightActiveLineNumber,
|
|
13766
13977
|
hoverEnabled,
|
|
13767
13978
|
insertSpaces,
|
|
13768
13979
|
isAutoClosingBracketsEnabled: isAutoClosingBracketsEnabled$1,
|
|
@@ -13771,6 +13982,7 @@ const getEditorPreferences = async () => {
|
|
|
13771
13982
|
isQuickSuggestionsEnabled: isQuickSuggestionsEnabled$1,
|
|
13772
13983
|
letterSpacing,
|
|
13773
13984
|
lineNumbers,
|
|
13985
|
+
mergeConflictActionsEnabled,
|
|
13774
13986
|
minimapEnabled,
|
|
13775
13987
|
rowHeight,
|
|
13776
13988
|
tabSize
|
|
@@ -14103,6 +14315,7 @@ const loadContent = async (state, savedState) => {
|
|
|
14103
14315
|
fontFamily,
|
|
14104
14316
|
fontSize,
|
|
14105
14317
|
fontWeight,
|
|
14318
|
+
highlightActiveLineNumber,
|
|
14106
14319
|
hoverEnabled,
|
|
14107
14320
|
insertSpaces,
|
|
14108
14321
|
isAutoClosingBracketsEnabled,
|
|
@@ -14111,6 +14324,7 @@ const loadContent = async (state, savedState) => {
|
|
|
14111
14324
|
isQuickSuggestionsEnabled,
|
|
14112
14325
|
letterSpacing,
|
|
14113
14326
|
lineNumbers,
|
|
14327
|
+
mergeConflictActionsEnabled,
|
|
14114
14328
|
minimapEnabled,
|
|
14115
14329
|
rowHeight,
|
|
14116
14330
|
tabSize
|
|
@@ -14135,6 +14349,7 @@ const loadContent = async (state, savedState) => {
|
|
|
14135
14349
|
fontFamily,
|
|
14136
14350
|
fontSize,
|
|
14137
14351
|
fontWeight,
|
|
14352
|
+
highlightActiveLineNumber,
|
|
14138
14353
|
hoverEnabled,
|
|
14139
14354
|
insertSpaces,
|
|
14140
14355
|
isAutoClosingBracketsEnabled,
|
|
@@ -14145,6 +14360,7 @@ const loadContent = async (state, savedState) => {
|
|
|
14145
14360
|
letterSpacing,
|
|
14146
14361
|
lineNumbers,
|
|
14147
14362
|
loadError: '',
|
|
14363
|
+
mergeConflictActionsEnabled,
|
|
14148
14364
|
minimapEnabled,
|
|
14149
14365
|
rowHeight,
|
|
14150
14366
|
tabSize,
|
|
@@ -14356,6 +14572,34 @@ ${editorSelector} .EditorRow {
|
|
|
14356
14572
|
height: var(--EditorRowHeight);
|
|
14357
14573
|
line-height: var(--EditorRowHeight);
|
|
14358
14574
|
}
|
|
14575
|
+
${editorSelector} .MergeConflictActions,
|
|
14576
|
+
${editorSelector} .MergeConflictActionsGutter {
|
|
14577
|
+
box-sizing: border-box;
|
|
14578
|
+
height: var(--EditorRowHeight);
|
|
14579
|
+
line-height: var(--EditorRowHeight);
|
|
14580
|
+
}
|
|
14581
|
+
${editorSelector} .MergeConflictActions {
|
|
14582
|
+
align-items: center;
|
|
14583
|
+
display: flex;
|
|
14584
|
+
gap: 12px;
|
|
14585
|
+
padding-left: 4px;
|
|
14586
|
+
user-select: none;
|
|
14587
|
+
}
|
|
14588
|
+
${editorSelector} .MergeConflictAction {
|
|
14589
|
+
appearance: none;
|
|
14590
|
+
background: none;
|
|
14591
|
+
border: 0;
|
|
14592
|
+
color: var(--TextLinkForeground, #3794ff);
|
|
14593
|
+
cursor: pointer;
|
|
14594
|
+
font: inherit;
|
|
14595
|
+
padding: 0;
|
|
14596
|
+
}
|
|
14597
|
+
${editorSelector} .MergeConflictAction:hover,
|
|
14598
|
+
${editorSelector} .MergeConflictAction:focus-visible {
|
|
14599
|
+
color: var(--TextLinkActiveForeground, #4daafc);
|
|
14600
|
+
outline: none;
|
|
14601
|
+
text-decoration: underline;
|
|
14602
|
+
}
|
|
14359
14603
|
${editorSelector} .EditorLineDecoration {
|
|
14360
14604
|
color: var(--EditorInlineBlameForeground, rgba(255, 255, 255, 0.5));
|
|
14361
14605
|
font-style: italic;
|
|
@@ -14918,15 +15162,57 @@ const editorLineDecorationNode = {
|
|
|
14918
15162
|
className: EditorLineDecoration,
|
|
14919
15163
|
type: Span
|
|
14920
15164
|
};
|
|
14921
|
-
const
|
|
15165
|
+
const mergeConflictActions = [{
|
|
15166
|
+
action: 'current',
|
|
15167
|
+
label: 'Accept Current Change'
|
|
15168
|
+
}, {
|
|
15169
|
+
action: 'incoming',
|
|
15170
|
+
label: 'Accept Incoming Change'
|
|
15171
|
+
}, {
|
|
15172
|
+
action: 'both',
|
|
15173
|
+
label: 'Accept Both Changes'
|
|
15174
|
+
}];
|
|
15175
|
+
const addMergeConflictActions = (dom, rowIndex) => {
|
|
15176
|
+
dom.push({
|
|
15177
|
+
childCount: mergeConflictActions.length,
|
|
15178
|
+
className: 'MergeConflictActions',
|
|
15179
|
+
'data-rowIndex': rowIndex,
|
|
15180
|
+
onMouseDown: HandleMergeConflictActionsMouseDown,
|
|
15181
|
+
type: Div
|
|
15182
|
+
});
|
|
15183
|
+
for (const {
|
|
15184
|
+
action,
|
|
15185
|
+
label
|
|
15186
|
+
} of mergeConflictActions) {
|
|
15187
|
+
dom.push({
|
|
15188
|
+
ariaLabel: `${label} at line ${rowIndex + 1}`,
|
|
15189
|
+
childCount: 1,
|
|
15190
|
+
className: 'MergeConflictAction',
|
|
15191
|
+
'data-action': action,
|
|
15192
|
+
'data-rowIndex': rowIndex,
|
|
15193
|
+
onClick: HandleMergeConflictActionClick,
|
|
15194
|
+
title: label,
|
|
15195
|
+
type: Button$1
|
|
15196
|
+
}, text(label));
|
|
15197
|
+
}
|
|
15198
|
+
};
|
|
15199
|
+
const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = []) => {
|
|
14922
15200
|
const dom = [];
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
15201
|
+
const actualViewRows = visibleViewLineIndices.length === 0 ? Array.from({
|
|
15202
|
+
length: textInfos.length
|
|
15203
|
+
}, (_, index) => visibleLineIndices[index] ?? index) : visibleViewLineIndices;
|
|
15204
|
+
let textInfoIndex = 0;
|
|
15205
|
+
for (const viewRow of actualViewRows) {
|
|
15206
|
+
if (isMergeConflictActionsRow(viewRow)) {
|
|
15207
|
+
addMergeConflictActions(dom, getMergeConflictRowIndex(viewRow));
|
|
15208
|
+
continue;
|
|
15209
|
+
}
|
|
15210
|
+
const textInfo = textInfos[textInfoIndex];
|
|
15211
|
+
const difference = differences[textInfoIndex];
|
|
15212
|
+
const rowIndex = viewRow;
|
|
14927
15213
|
const rowDecorations = endOfLineDecorations.filter(decoration => decoration.rowIndex === rowIndex);
|
|
14928
15214
|
let className = EditorRow;
|
|
14929
|
-
if (
|
|
15215
|
+
if (rowIndex === highlightedLine) {
|
|
14930
15216
|
className = mergeClassNames(className, EditorRowHighlighted);
|
|
14931
15217
|
}
|
|
14932
15218
|
dom.push({
|
|
@@ -14947,14 +15233,15 @@ const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, h
|
|
|
14947
15233
|
for (const decoration of rowDecorations) {
|
|
14948
15234
|
dom.push(editorLineDecorationNode, text(decoration.text));
|
|
14949
15235
|
}
|
|
15236
|
+
textInfoIndex++;
|
|
14950
15237
|
}
|
|
14951
15238
|
return dom;
|
|
14952
15239
|
};
|
|
14953
15240
|
|
|
14954
|
-
const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = []) => {
|
|
14955
|
-
const rowsDom = getEditorRowsVirtualDom$1(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations);
|
|
15241
|
+
const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = []) => {
|
|
15242
|
+
const rowsDom = getEditorRowsVirtualDom$1(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices);
|
|
14956
15243
|
return [{
|
|
14957
|
-
childCount: textInfos.length,
|
|
15244
|
+
childCount: visibleViewLineIndices.length || textInfos.length,
|
|
14958
15245
|
className: 'EditorRows',
|
|
14959
15246
|
onMouseDown: HandleMouseDown,
|
|
14960
15247
|
onPointerDown: HandlePointerDown,
|
|
@@ -14997,8 +15284,8 @@ const editorLayersNode = {
|
|
|
14997
15284
|
className: 'EditorLayers',
|
|
14998
15285
|
type: Div
|
|
14999
15286
|
};
|
|
15000
|
-
const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineNumbers = true, highlightedLine = -1, cursorInfos = [], diagnostics = [], visibleLineIndices = [], endOfLineDecorations = [], bracketMatchInfos = [], focused = true) => {
|
|
15001
|
-
return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused), ...getEditorRowsVirtualDom(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations), ...getEditorCursorsVirtualDom(cursorInfos), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos)];
|
|
15287
|
+
const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineNumbers = true, highlightedLine = -1, cursorInfos = [], diagnostics = [], visibleLineIndices = [], endOfLineDecorations = [], bracketMatchInfos = [], focused = true, visibleViewLineIndices = []) => {
|
|
15288
|
+
return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused), ...getEditorRowsVirtualDom(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices), ...getEditorCursorsVirtualDom(cursorInfos), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos)];
|
|
15002
15289
|
};
|
|
15003
15290
|
|
|
15004
15291
|
const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
|
|
@@ -15066,20 +15353,24 @@ const getEditorContentVirtualDom = ({
|
|
|
15066
15353
|
scrollBarDiagnostics = [],
|
|
15067
15354
|
selectionInfos = [],
|
|
15068
15355
|
textInfos,
|
|
15069
|
-
visibleLineIndices = []
|
|
15356
|
+
visibleLineIndices = [],
|
|
15357
|
+
visibleViewLineIndices = []
|
|
15070
15358
|
}) => {
|
|
15071
|
-
return [editorContentNode, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom()];
|
|
15359
|
+
return [editorContentNode, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused, visibleViewLineIndices), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom()];
|
|
15072
15360
|
};
|
|
15073
15361
|
|
|
15074
15362
|
const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
|
|
15075
15363
|
const isBreakpoint = typeof gutterInfo === 'object' && gutterInfo.isBreakpoint;
|
|
15076
15364
|
const isLightBulb = typeof gutterInfo === 'object' && gutterInfo.isLightBulb;
|
|
15365
|
+
const isMergeConflictActions = typeof gutterInfo === 'object' && gutterInfo.isMergeConflictActions;
|
|
15077
15366
|
const lineNumber = typeof gutterInfo === 'object' ? gutterInfo.lineNumber : gutterInfo;
|
|
15078
15367
|
const gutterDecorations = typeof gutterInfo === 'object' ? gutterInfo.gutterDecorations || [] : [];
|
|
15079
15368
|
const showLineNumber = typeof gutterInfo !== 'object' || gutterInfo.showLineNumber !== false;
|
|
15080
15369
|
const label = isLightBulb ? `Show Code Actions on line ${lineNumber}` : `Breakpoint on line ${lineNumber}`;
|
|
15081
15370
|
let className = lineNumber === activeLineNumber ? 'LineNumber LineNumberActive' : 'LineNumber';
|
|
15082
|
-
if (
|
|
15371
|
+
if (isMergeConflictActions) {
|
|
15372
|
+
className += ' MergeConflictActionsGutter';
|
|
15373
|
+
} else if (isLightBulb) {
|
|
15083
15374
|
className += ' LineNumberLightBulb MaskIconLightBulb';
|
|
15084
15375
|
} else if (isBreakpoint) {
|
|
15085
15376
|
className += ' LineNumberBreakpoint';
|
|
@@ -15105,7 +15396,7 @@ const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
|
|
|
15105
15396
|
className: mergeClassNames('EditorGutterDecoration', `EditorGutterDecoration${decoration.type[0].toUpperCase()}${decoration.type.slice(1)}`),
|
|
15106
15397
|
title: `${decoration.type[0].toUpperCase()}${decoration.type.slice(1)} line ${lineNumber}`,
|
|
15107
15398
|
type: Span
|
|
15108
|
-
})), text(isLightBulb ? '' : isBreakpoint ? '●' : showLineNumber ? lineNumber : '')];
|
|
15399
|
+
})), text(isMergeConflictActions || isLightBulb ? '' : isBreakpoint ? '●' : showLineNumber ? lineNumber : '')];
|
|
15109
15400
|
};
|
|
15110
15401
|
const getEditorGutterVirtualDom$1 = (gutterInfos, activeLineNumber = -1) => {
|
|
15111
15402
|
const dom = gutterInfos.flatMap(gutterInfo => getGutterInfoVirtualDom(gutterInfo, activeLineNumber));
|
|
@@ -15127,6 +15418,14 @@ const getGutterInfos = (minLineY, maxLineY, breakPoints, showLineNumbers = true,
|
|
|
15127
15418
|
length: maxLineY - minLineY
|
|
15128
15419
|
}, (_, index) => minLineY + index);
|
|
15129
15420
|
for (const rowIndex of rows) {
|
|
15421
|
+
if (rowIndex < 0) {
|
|
15422
|
+
gutterInfos.push({
|
|
15423
|
+
isMergeConflictActions: true,
|
|
15424
|
+
lineNumber: 0,
|
|
15425
|
+
showLineNumber: false
|
|
15426
|
+
});
|
|
15427
|
+
continue;
|
|
15428
|
+
}
|
|
15130
15429
|
const lineNumber = rowIndex + 1;
|
|
15131
15430
|
const isBreakpoint = breakPoints.includes(rowIndex);
|
|
15132
15431
|
const isLightBulb = rowIndex === lightBulbRowIndex;
|
|
@@ -15200,6 +15499,7 @@ const getEditorVirtualDom = ({
|
|
|
15200
15499
|
focused = true,
|
|
15201
15500
|
gutterDecorations = [],
|
|
15202
15501
|
gutterInfos = [],
|
|
15502
|
+
highlightActiveLineNumber = true,
|
|
15203
15503
|
highlightedLine = -1,
|
|
15204
15504
|
lightBulbRowIndex = -1,
|
|
15205
15505
|
lineNumbers = true,
|
|
@@ -15217,6 +15517,7 @@ const getEditorVirtualDom = ({
|
|
|
15217
15517
|
uid,
|
|
15218
15518
|
uri = '',
|
|
15219
15519
|
visibleLineIndices,
|
|
15520
|
+
visibleViewLineIndices = [],
|
|
15220
15521
|
workspaceUri = ''
|
|
15221
15522
|
}) => {
|
|
15222
15523
|
if (loadError) {
|
|
@@ -15228,10 +15529,12 @@ const getEditorVirtualDom = ({
|
|
|
15228
15529
|
type: Div
|
|
15229
15530
|
}, textEditorErrorIconNode, textEditorErrorMessageNode, text(loadError)];
|
|
15230
15531
|
}
|
|
15231
|
-
const
|
|
15532
|
+
const gutterLineIndices = visibleViewLineIndices.length > 0 ? visibleViewLineIndices : visibleLineIndices;
|
|
15533
|
+
const visibleGutterInfos = breakPoints.length > 0 || gutterDecorations.length > 0 || visibleLineIndices ? getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, gutterLineIndices, lightBulbRowIndex, gutterDecorations) : gutterInfos;
|
|
15232
15534
|
const showGutter = lineNumbers || breakPoints.length > 0 || lightBulbRowIndex >= 0 || gutterDecorations.length > 0;
|
|
15233
15535
|
const primaryCursorRowIndex = getPrimaryCursorRowIndex(selections, primarySelectionIndex);
|
|
15234
|
-
const
|
|
15536
|
+
const activeLineNumber = highlightActiveLineNumber ? primaryCursorRowIndex + 1 : -1;
|
|
15537
|
+
const gutterDom = showGutter ? getEditorGutterVirtualDom(visibleGutterInfos, activeLineNumber) : [];
|
|
15235
15538
|
const minimapDom = getMinimapVirtualDom(minimapEnabled, minimapLines, minLineY);
|
|
15236
15539
|
const breadcrumbsDom = breadcrumbsEnabled ? getEditorBreadcrumbsVirtualDom({
|
|
15237
15540
|
breadcrumbsEnabled,
|
|
@@ -15261,17 +15564,18 @@ const getEditorVirtualDom = ({
|
|
|
15261
15564
|
scrollBarDiagnostics,
|
|
15262
15565
|
selectionInfos,
|
|
15263
15566
|
textInfos,
|
|
15264
|
-
visibleLineIndices: visibleLineIndices || []
|
|
15567
|
+
visibleLineIndices: visibleLineIndices || [],
|
|
15568
|
+
visibleViewLineIndices
|
|
15265
15569
|
}), ...minimapDom];
|
|
15266
15570
|
};
|
|
15267
15571
|
|
|
15268
15572
|
const getScrollBarDiagnostics = (editor, diagnostics) => {
|
|
15269
15573
|
const height = editor.height || 0;
|
|
15270
|
-
const lineCount = Math.max(editor.lines?.length || 0, 1);
|
|
15574
|
+
const lineCount = Math.max(editor.viewLineIndices?.length || editor.lines?.length || 0, 1);
|
|
15271
15575
|
const markerHeight = 3;
|
|
15272
15576
|
const scrollBarDecorations = Array.from(diagnostics, diagnostic => ({
|
|
15273
15577
|
height: markerHeight,
|
|
15274
|
-
top: Math.min(Math.round(diagnostic.rowIndex / lineCount * height), Math.max(height - markerHeight, 0)),
|
|
15578
|
+
top: Math.min(Math.round((editor.viewLineIndices ? getVisualRowForDocumentRow$1(diagnostic.rowIndex, editor.viewLineIndices) : diagnostic.rowIndex) / lineCount * height), Math.max(height - markerHeight, 0)),
|
|
15275
15579
|
type: diagnostic.type
|
|
15276
15580
|
}));
|
|
15277
15581
|
return scrollBarDecorations;
|
|
@@ -15301,8 +15605,16 @@ const getDom = state => {
|
|
|
15301
15605
|
scrollBarDiagnostics: getScrollBarDiagnostics(state, diagnostics)
|
|
15302
15606
|
});
|
|
15303
15607
|
};
|
|
15608
|
+
const mergeConflictsEqual = (oldState, newState) => {
|
|
15609
|
+
const oldConflicts = oldState.mergeConflicts || [];
|
|
15610
|
+
const newConflicts = newState.mergeConflicts || [];
|
|
15611
|
+
return oldConflicts.length === newConflicts.length && oldConflicts.every((conflict, index) => {
|
|
15612
|
+
const other = newConflicts[index];
|
|
15613
|
+
return conflict.startRowIndex === other.startRowIndex && conflict.endRowIndex === other.endRowIndex;
|
|
15614
|
+
});
|
|
15615
|
+
};
|
|
15304
15616
|
const renderIncremental = (oldState, newState) => {
|
|
15305
|
-
const oldDom = oldState.initial ? getDom(oldState) : get(newState.uid) || getDom(oldState);
|
|
15617
|
+
const oldDom = oldState.initial || !mergeConflictsEqual(oldState, newState) ? getDom(oldState) : get(newState.uid) || getDom(oldState);
|
|
15306
15618
|
const newDom = getDom(newState);
|
|
15307
15619
|
const patches = diffTree(oldDom, newDom);
|
|
15308
15620
|
if (patches.length === 0) {
|
|
@@ -15447,13 +15759,13 @@ const renderLines = {
|
|
|
15447
15759
|
newState.differences = differences;
|
|
15448
15760
|
const {
|
|
15449
15761
|
highlightedLine,
|
|
15450
|
-
visibleLineIndices
|
|
15762
|
+
visibleLineIndices,
|
|
15763
|
+
visibleViewLineIndices
|
|
15451
15764
|
} = newState;
|
|
15452
|
-
const
|
|
15453
|
-
const dom = getEditorRowsVirtualDom$1(textInfos, differences, true, relativeLine, visibleLineIndices, endOfLineDecorations);
|
|
15765
|
+
const dom = getEditorRowsVirtualDom$1(textInfos, differences, true, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices);
|
|
15454
15766
|
return [/* method */'setText', dom];
|
|
15455
15767
|
},
|
|
15456
|
-
isEqual: (oldState, newState) => oldState.lines === newState.lines && oldState.foldingRanges === newState.foldingRanges && oldState.tokenizerId === newState.tokenizerId && oldState.minLineY === newState.minLineY && oldState.decorations === newState.decorations && oldState.embeds === newState.embeds && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.deltaX === newState.deltaX && oldState.width === newState.width && oldState.highlightedLine === newState.highlightedLine && oldState.debugEnabled === newState.debugEnabled
|
|
15768
|
+
isEqual: (oldState, newState) => oldState.lines === newState.lines && oldState.foldingRanges === newState.foldingRanges && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.tokenizerId === newState.tokenizerId && oldState.minLineY === newState.minLineY && oldState.decorations === newState.decorations && oldState.embeds === newState.embeds && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.deltaX === newState.deltaX && oldState.width === newState.width && oldState.highlightedLine === newState.highlightedLine && oldState.debugEnabled === newState.debugEnabled
|
|
15457
15769
|
};
|
|
15458
15770
|
const renderSelections = {
|
|
15459
15771
|
apply: (oldState, newState) => {
|
|
@@ -15497,23 +15809,27 @@ const renderGutterInfo = {
|
|
|
15497
15809
|
const {
|
|
15498
15810
|
breakPoints,
|
|
15499
15811
|
gutterDecorations,
|
|
15812
|
+
highlightActiveLineNumber,
|
|
15500
15813
|
lightBulbRowIndex,
|
|
15501
15814
|
lineNumbers,
|
|
15502
15815
|
maxLineY,
|
|
15503
15816
|
minLineY,
|
|
15504
15817
|
primarySelectionIndex,
|
|
15505
15818
|
selections,
|
|
15506
|
-
visibleLineIndices
|
|
15819
|
+
visibleLineIndices,
|
|
15820
|
+
visibleViewLineIndices = []
|
|
15507
15821
|
} = newState;
|
|
15508
15822
|
if (!lineNumbers && breakPoints.length === 0 && lightBulbRowIndex === -1 && gutterDecorations.length === 0) {
|
|
15509
15823
|
return ['renderGutter', []];
|
|
15510
15824
|
}
|
|
15511
|
-
const
|
|
15825
|
+
const gutterLineIndices = visibleViewLineIndices.length > 0 ? visibleViewLineIndices : visibleLineIndices;
|
|
15826
|
+
const gutterInfos = getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, gutterLineIndices, lightBulbRowIndex, gutterDecorations);
|
|
15512
15827
|
const primaryCursorRowIndex = getPrimaryCursorRowIndex(selections, primarySelectionIndex);
|
|
15513
|
-
const
|
|
15828
|
+
const activeLineNumber = highlightActiveLineNumber ? primaryCursorRowIndex + 1 : -1;
|
|
15829
|
+
const dom = getEditorGutterVirtualDom$1(gutterInfos, activeLineNumber);
|
|
15514
15830
|
return ['renderGutter', dom];
|
|
15515
15831
|
},
|
|
15516
|
-
isEqual: (oldState, newState) => oldState.breakPoints === newState.breakPoints && oldState.gutterDecorations === newState.gutterDecorations && oldState.lightBulbRowIndex === newState.lightBulbRowIndex && oldState.foldingRanges === newState.foldingRanges && oldState.lineNumbers === newState.lineNumbers && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && getPrimaryCursorRowIndex(oldState.selections, oldState.primarySelectionIndex) === getPrimaryCursorRowIndex(newState.selections, newState.primarySelectionIndex)
|
|
15832
|
+
isEqual: (oldState, newState) => oldState.breakPoints === newState.breakPoints && oldState.gutterDecorations === newState.gutterDecorations && oldState.lightBulbRowIndex === newState.lightBulbRowIndex && oldState.foldingRanges === newState.foldingRanges && oldState.highlightActiveLineNumber === newState.highlightActiveLineNumber && oldState.lineNumbers === newState.lineNumbers && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && (!newState.highlightActiveLineNumber || getPrimaryCursorRowIndex(oldState.selections, oldState.primarySelectionIndex) === getPrimaryCursorRowIndex(newState.selections, newState.primarySelectionIndex))
|
|
15517
15833
|
};
|
|
15518
15834
|
const renderWidgets = {
|
|
15519
15835
|
apply: renderWidgets$1,
|
|
@@ -15552,6 +15868,16 @@ const renderEventListeners = () => {
|
|
|
15552
15868
|
name: HandleLightBulbClick,
|
|
15553
15869
|
params: ['showSourceActions3'],
|
|
15554
15870
|
preventDefault: true
|
|
15871
|
+
}, {
|
|
15872
|
+
name: HandleMergeConflictActionClick,
|
|
15873
|
+
params: ['acceptMergeConflict', 'event.target.dataset.action', 'event.target.dataset.rowIndex'],
|
|
15874
|
+
preventDefault: true,
|
|
15875
|
+
stopPropagation: true
|
|
15876
|
+
}, {
|
|
15877
|
+
name: HandleMergeConflictActionsMouseDown,
|
|
15878
|
+
params: ['handleMergeConflictActionsMouseDown'],
|
|
15879
|
+
preventDefault: true,
|
|
15880
|
+
stopPropagation: true
|
|
15555
15881
|
}, {
|
|
15556
15882
|
name: HandleFocus,
|
|
15557
15883
|
params: ['handleFocus']
|
|
@@ -15604,7 +15930,7 @@ const renderEventListeners = () => {
|
|
|
15604
15930
|
passive: true
|
|
15605
15931
|
}, {
|
|
15606
15932
|
name: HandleContextMenu,
|
|
15607
|
-
params: ['handleContextMenu', Button$
|
|
15933
|
+
params: ['handleContextMenu', Button$2, ClientX, ClientY],
|
|
15608
15934
|
preventDefault: true
|
|
15609
15935
|
}, {
|
|
15610
15936
|
name: HandleScrollBarVerticalPointerDown,
|
|
@@ -15959,6 +16285,7 @@ const commandMap = {
|
|
|
15959
16285
|
'ActivateByEvent.activateByEvent': activateByEvent,
|
|
15960
16286
|
'CodeGenerator.accept': codeGeneratorAccept,
|
|
15961
16287
|
'ColorPicker.loadContent': loadContent$3,
|
|
16288
|
+
'Editor.acceptMergeConflict': wrapCommand(acceptMergeConflict),
|
|
15962
16289
|
'Editor.addCursorAbove': wrapCommand(addCursorAbove),
|
|
15963
16290
|
'Editor.addCursorBelow': wrapCommand(addCursorBelow),
|
|
15964
16291
|
'Editor.applyDocumentEdits': wrapCommand(applyDocumentEdits$1),
|
|
@@ -16060,6 +16387,7 @@ const commandMap = {
|
|
|
16060
16387
|
'Editor.handleDoubleClick': wrapCommand(handleDoubleClick),
|
|
16061
16388
|
'Editor.handleFocus': wrapCommand(handleFocus$1),
|
|
16062
16389
|
'Editor.handleKeyUp': wrapCommand(handleKeyUp, true),
|
|
16390
|
+
'Editor.handleMergeConflictActionsMouseDown': wrapCommand(handleMergeConflictActionsMouseDown),
|
|
16063
16391
|
'Editor.handleMouseDown': wrapCommand(handleMouseDown),
|
|
16064
16392
|
'Editor.handleMouseMove': wrapCommand(handleMouseMove),
|
|
16065
16393
|
'Editor.handleMouseMoveWithAltKey': wrapCommand(handleMouseMoveWithAltKey),
|
package/dist/settings.json
CHANGED
|
@@ -53,6 +53,22 @@
|
|
|
53
53
|
"type": 1,
|
|
54
54
|
"value": "on"
|
|
55
55
|
},
|
|
56
|
+
{
|
|
57
|
+
"category": "text-editor",
|
|
58
|
+
"description": "Controls whether actions for accepting merge conflict changes are shown in the editor",
|
|
59
|
+
"heading": "Merge Conflict Actions",
|
|
60
|
+
"id": "editor.mergeConflictActions",
|
|
61
|
+
"type": 3,
|
|
62
|
+
"value": false
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"category": "text-editor",
|
|
66
|
+
"description": "Controls whether the primary cursor line number is highlighted",
|
|
67
|
+
"heading": "Highlight Active Line Number",
|
|
68
|
+
"id": "editor.highlightActiveLineNumber",
|
|
69
|
+
"type": 3,
|
|
70
|
+
"value": true
|
|
71
|
+
},
|
|
56
72
|
{
|
|
57
73
|
"category": "text-editor",
|
|
58
74
|
"description": "Controls whether the minimap is shown",
|