@lvce-editor/editor-worker 19.49.0 → 19.50.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 +417 -71
- package/dist/settings.json +8 -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) => {
|
|
@@ -3064,6 +3176,34 @@ const getDifference = (start, averageCharWidth, deltaX) => {
|
|
|
3064
3176
|
const difference = beforeWidth - deltaX;
|
|
3065
3177
|
return difference;
|
|
3066
3178
|
};
|
|
3179
|
+
const appendTokenRange = (resultTokens, resultTokenMap, tokens, tokenMap, rangeStart, rangeEnd) => {
|
|
3180
|
+
let tokenStart = 0;
|
|
3181
|
+
for (let i = 0; i < tokens.length; i += 2) {
|
|
3182
|
+
const tokenType = tokens[i];
|
|
3183
|
+
const tokenEnd = tokenStart + tokens[i + 1];
|
|
3184
|
+
const start = Math.max(tokenStart, rangeStart);
|
|
3185
|
+
const end = Math.min(tokenEnd, rangeEnd);
|
|
3186
|
+
if (start < end) {
|
|
3187
|
+
const resultTokenType = resultTokens.length / 2;
|
|
3188
|
+
resultTokens.push(resultTokenType, end - start);
|
|
3189
|
+
resultTokenMap[resultTokenType] = tokenMap[tokenType] || 'Unknown';
|
|
3190
|
+
}
|
|
3191
|
+
tokenStart = tokenEnd;
|
|
3192
|
+
}
|
|
3193
|
+
};
|
|
3194
|
+
const mergeEmbeddedTokens = (line, tokenResults, embeddedResult, tokenMap) => {
|
|
3195
|
+
const embeddedStart = Math.max(0, Math.min(line.length, tokenResults.embeddedLanguageStart));
|
|
3196
|
+
const embeddedEnd = Math.max(embeddedStart, Math.min(line.length, tokenResults.embeddedLanguageEnd));
|
|
3197
|
+
const tokens = [];
|
|
3198
|
+
const mergedTokenMap = Object.create(null);
|
|
3199
|
+
appendTokenRange(tokens, mergedTokenMap, tokenResults.tokens, tokenMap, 0, embeddedStart);
|
|
3200
|
+
appendTokenRange(tokens, mergedTokenMap, embeddedResult.result.tokens, embeddedResult.TokenMap, 0, embeddedEnd - embeddedStart);
|
|
3201
|
+
appendTokenRange(tokens, mergedTokenMap, tokenResults.tokens, tokenMap, embeddedEnd, line.length);
|
|
3202
|
+
return {
|
|
3203
|
+
tokenMap: mergedTokenMap,
|
|
3204
|
+
tokens
|
|
3205
|
+
};
|
|
3206
|
+
};
|
|
3067
3207
|
const getLineInfoDefault = (line, tokenResults, embeddedResults, decorations, TokenMap, lineOffset, normalize, tabSize, width, deltaX, averageCharWidth, minOffset, maxOffset) => {
|
|
3068
3208
|
const lineInfo = [];
|
|
3069
3209
|
|
|
@@ -3163,6 +3303,10 @@ const getLineInfo$1 = (line, tokenResults, embeddedResults, decorations, TokenMa
|
|
|
3163
3303
|
if (embeddedResult?.isFull) {
|
|
3164
3304
|
return getLineInfoEmbeddedFull(embeddedResults, tokenResults, line, decorations, lineOffset, normalize, tabSize, width, deltaX, averageCharWidth, minOffset, maxOffset);
|
|
3165
3305
|
}
|
|
3306
|
+
if (embeddedResult?.result?.tokens) {
|
|
3307
|
+
const merged = mergeEmbeddedTokens(line, tokenResults, embeddedResult, TokenMap);
|
|
3308
|
+
return getLineInfoDefault(line, merged, embeddedResults, decorations, merged.tokenMap, lineOffset, normalize, tabSize, width, deltaX, averageCharWidth, minOffset, maxOffset);
|
|
3309
|
+
}
|
|
3166
3310
|
}
|
|
3167
3311
|
return getLineInfoDefault(line, tokenResults, embeddedResults, decorations, TokenMap, lineOffset, normalize, tabSize, width, deltaX, averageCharWidth, minOffset, maxOffset);
|
|
3168
3312
|
};
|
|
@@ -3288,22 +3432,20 @@ const setDeltaY$1 = async (state, value) => {
|
|
|
3288
3432
|
if (deltaY === newDeltaY) {
|
|
3289
3433
|
return state;
|
|
3290
3434
|
}
|
|
3291
|
-
const
|
|
3292
|
-
const
|
|
3293
|
-
const
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3435
|
+
const startVisualRow = Math.floor(newDeltaY / itemHeight);
|
|
3436
|
+
const hasMergeConflictRows = state.viewLineIndices?.length > 0;
|
|
3437
|
+
const visibleViewLineIndices = hasMergeConflictRows ? getVisibleViewLineIndices(state.viewLineIndices, startVisualRow, numberOfVisibleLines) : getViewportLineIndices(state.lines.length, state.foldingRanges || [], startVisualRow, numberOfVisibleLines);
|
|
3438
|
+
const visibleLineIndices = hasMergeConflictRows ? getVisibleLineIndices(visibleViewLineIndices) : visibleViewLineIndices;
|
|
3439
|
+
const minLineY = visibleLineIndices[0] ?? 0;
|
|
3440
|
+
const maxLineY = visibleLineIndices.length === 0 ? 0 : visibleLineIndices.at(-1) + 1;
|
|
3441
|
+
const newEditor1 = {
|
|
3297
3442
|
...state,
|
|
3298
3443
|
deltaY: newDeltaY,
|
|
3299
3444
|
maxLineY,
|
|
3300
3445
|
minLineY,
|
|
3301
3446
|
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
|
-
})
|
|
3447
|
+
visibleLineIndices,
|
|
3448
|
+
visibleViewLineIndices
|
|
3307
3449
|
};
|
|
3308
3450
|
const syncIncremental = getEnabled();
|
|
3309
3451
|
const {
|
|
@@ -3847,7 +3989,9 @@ const getVisible = async editor => {
|
|
|
3847
3989
|
rowHeight,
|
|
3848
3990
|
selections,
|
|
3849
3991
|
tabSize,
|
|
3992
|
+
viewLineIndices,
|
|
3850
3993
|
visibleLineIndices,
|
|
3994
|
+
visibleViewLineIndices,
|
|
3851
3995
|
width
|
|
3852
3996
|
} = editor;
|
|
3853
3997
|
const averageCharWidth = charWidth;
|
|
@@ -3855,18 +3999,20 @@ const getVisible = async editor => {
|
|
|
3855
3999
|
const actualVisibleLineIndices = visibleLineIndices || Array.from({
|
|
3856
4000
|
length: maxLineY - minLineY
|
|
3857
4001
|
}, (_, index) => minLineY + index);
|
|
3858
|
-
const
|
|
3859
|
-
const
|
|
3860
|
-
const
|
|
4002
|
+
const getVisualRow = rowIndex => viewLineIndices ? getVisualRowForDocumentRow$1(rowIndex, viewLineIndices) : getVisualRowForDocumentRow(rowIndex, foldingRanges);
|
|
4003
|
+
const startVisualRow = itemHeight ? Math.floor(deltaY / itemHeight) : getVisualRow(minLineY);
|
|
4004
|
+
const endVisualRow = startVisualRow + (visibleViewLineIndices?.length || actualVisibleLineIndices.length);
|
|
4005
|
+
const getRelativeRow = rowIndex => getVisualRow(rowIndex) - startVisualRow;
|
|
4006
|
+
const getDifference = rowIndex => differences[actualVisibleLineIndices.indexOf(rowIndex)];
|
|
3861
4007
|
for (let i = 0; i < selections.length; i += 4) {
|
|
3862
4008
|
const [selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn, reversed] = getSelectionPairs(selections, i);
|
|
3863
|
-
const selectionStartVisualRow =
|
|
3864
|
-
const selectionEndVisualRow =
|
|
4009
|
+
const selectionStartVisualRow = getVisualRow(selectionStartRow);
|
|
4010
|
+
const selectionEndVisualRow = getVisualRow(selectionEndRow);
|
|
3865
4011
|
if (selectionEndVisualRow < startVisualRow || selectionStartVisualRow >= endVisualRow) {
|
|
3866
4012
|
continue;
|
|
3867
4013
|
}
|
|
3868
4014
|
const relativeEndLineRow = getRelativeRow(selectionEndRow);
|
|
3869
|
-
const endLineDifference =
|
|
4015
|
+
const endLineDifference = getDifference(selectionEndRow);
|
|
3870
4016
|
const endLine = lines[selectionEndRow];
|
|
3871
4017
|
const endLineEndX = await getX(endLine, selectionEndColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, endLineDifference);
|
|
3872
4018
|
const endLineY = relativeEndLineRow * rowHeight;
|
|
@@ -3876,7 +4022,7 @@ const getVisible = async editor => {
|
|
|
3876
4022
|
}
|
|
3877
4023
|
const startLineYRelative = getRelativeRow(selectionStartRow);
|
|
3878
4024
|
const startLineY = startLineYRelative * rowHeight;
|
|
3879
|
-
const startLineDifference =
|
|
4025
|
+
const startLineDifference = getDifference(selectionStartRow);
|
|
3880
4026
|
if (selectionStartRow === selectionEndRow) {
|
|
3881
4027
|
const startX = await getX(endLine, selectionStartColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, startLineDifference);
|
|
3882
4028
|
if (reversed) {
|
|
@@ -3903,7 +4049,7 @@ const getVisible = async editor => {
|
|
|
3903
4049
|
const currentLine = lines[rowIndex];
|
|
3904
4050
|
const relativeLine = getRelativeRow(rowIndex);
|
|
3905
4051
|
const currentLineY = relativeLine * rowHeight;
|
|
3906
|
-
const difference =
|
|
4052
|
+
const difference = getDifference(rowIndex);
|
|
3907
4053
|
const selectionWidth = await getX(currentLine, currentLine.length, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, difference);
|
|
3908
4054
|
visibleSelections.push(0, currentLineY, selectionWidth, rowHeight);
|
|
3909
4055
|
}
|
|
@@ -3967,7 +4113,7 @@ const setSelections$2 = (editor, selections) => {
|
|
|
3967
4113
|
});
|
|
3968
4114
|
const previousActiveRowIndex = editor.selections[primarySelectionIndex + 2] ?? activeRowIndex;
|
|
3969
4115
|
const rowIndex = getUnhiddenRow(activeRowIndex, previousActiveRowIndex, editor.lines.length, foldingRanges);
|
|
3970
|
-
const visualRow = getVisualRowForDocumentRow(rowIndex, foldingRanges);
|
|
4116
|
+
const visualRow = editor.viewLineIndices ? getVisualRowForDocumentRow$1(rowIndex, editor.viewLineIndices) : getVisualRowForDocumentRow(rowIndex, foldingRanges);
|
|
3971
4117
|
const startVisualRow = Math.floor(editor.deltaY / editor.itemHeight);
|
|
3972
4118
|
const endVisualRow = startVisualRow + editor.numberOfVisibleLines;
|
|
3973
4119
|
if (visualRow >= startVisualRow && visualRow < endVisualRow) {
|
|
@@ -4718,9 +4864,9 @@ const getInfo = async (editor, position, visibleLineIndices, startVisualRow) =>
|
|
|
4718
4864
|
tabSize,
|
|
4719
4865
|
width
|
|
4720
4866
|
} = editor;
|
|
4721
|
-
const visualRow = getVisualRowForDocumentRow(position.rowIndex, foldingRanges);
|
|
4867
|
+
const visualRow = editor.viewLineIndices ? getVisualRowForDocumentRow$1(position.rowIndex, editor.viewLineIndices) : getVisualRowForDocumentRow(position.rowIndex, foldingRanges);
|
|
4722
4868
|
const relativeRow = visualRow - startVisualRow;
|
|
4723
|
-
const difference = differences[
|
|
4869
|
+
const difference = differences[visibleLineIndices.indexOf(position.rowIndex)] ?? 0;
|
|
4724
4870
|
const line = lines[position.rowIndex];
|
|
4725
4871
|
const x = await getX(line, position.columnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, 0, width, charWidth, difference);
|
|
4726
4872
|
const endX = await getX(line, position.columnIndex + 1, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, 0, width, charWidth, difference);
|
|
@@ -4740,12 +4886,13 @@ const getVisibleBracketMatches = async editor => {
|
|
|
4740
4886
|
maxLineY,
|
|
4741
4887
|
minLineY,
|
|
4742
4888
|
selections,
|
|
4889
|
+
viewLineIndices,
|
|
4743
4890
|
visibleLineIndices
|
|
4744
4891
|
} = editor;
|
|
4745
4892
|
const actualVisibleLineIndices = visibleLineIndices || Array.from({
|
|
4746
4893
|
length: maxLineY - minLineY
|
|
4747
4894
|
}, (_, index) => minLineY + index);
|
|
4748
|
-
const startVisualRow = itemHeight ? Math.floor(deltaY / itemHeight) : getVisualRowForDocumentRow(minLineY, foldingRanges);
|
|
4895
|
+
const startVisualRow = itemHeight ? Math.floor(deltaY / itemHeight) : viewLineIndices ? getVisualRowForDocumentRow$1(minLineY, viewLineIndices) : getVisualRowForDocumentRow(minLineY, foldingRanges);
|
|
4749
4896
|
const positions = new Map();
|
|
4750
4897
|
for (let i = 0; i < selections.length; i += 4) {
|
|
4751
4898
|
const startRowIndex = selections[i];
|
|
@@ -4770,25 +4917,24 @@ const getDiagnosticType = diagnostic => {
|
|
|
4770
4917
|
return diagnostic.type;
|
|
4771
4918
|
};
|
|
4772
4919
|
|
|
4773
|
-
const getY = (row, minLineY, rowHeight) => {
|
|
4774
|
-
return (row - minLineY) * rowHeight;
|
|
4775
|
-
};
|
|
4776
|
-
|
|
4777
4920
|
const getVisibleDiagnostics = async (editor, diagnostics) => {
|
|
4778
4921
|
const visibleDiagnostics = [];
|
|
4779
4922
|
const {
|
|
4780
4923
|
charWidth,
|
|
4924
|
+
deltaY,
|
|
4781
4925
|
fontFamily,
|
|
4782
4926
|
fontSize,
|
|
4783
4927
|
fontWeight,
|
|
4784
4928
|
isMonospaceFont,
|
|
4929
|
+
itemHeight,
|
|
4785
4930
|
letterSpacing,
|
|
4786
4931
|
lines,
|
|
4787
|
-
minLineY,
|
|
4788
4932
|
rowHeight,
|
|
4789
4933
|
tabSize,
|
|
4934
|
+
viewLineIndices,
|
|
4790
4935
|
width
|
|
4791
4936
|
} = editor;
|
|
4937
|
+
const startVisualRow = itemHeight ? Math.floor(deltaY / itemHeight) : editor.minLineY || 0;
|
|
4792
4938
|
for (const diagnostic of diagnostics) {
|
|
4793
4939
|
const {
|
|
4794
4940
|
columnIndex,
|
|
@@ -4800,7 +4946,8 @@ const getVisibleDiagnostics = async (editor, diagnostics) => {
|
|
|
4800
4946
|
const endLineDifference = 0;
|
|
4801
4947
|
const halfCursorWidth = 0;
|
|
4802
4948
|
const x = await getX(lines[rowIndex], columnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, charWidth, endLineDifference);
|
|
4803
|
-
const
|
|
4949
|
+
const visualRow = viewLineIndices ? getVisualRowForDocumentRow$1(rowIndex, viewLineIndices) : rowIndex;
|
|
4950
|
+
const y = (visualRow - startVisualRow) * rowHeight;
|
|
4804
4951
|
visibleDiagnostics.push({
|
|
4805
4952
|
height: rowHeight,
|
|
4806
4953
|
type: getDiagnosticType(diagnostic),
|
|
@@ -4816,26 +4963,41 @@ const shouldUpdateDiagnosticData = (oldState, newState) => {
|
|
|
4816
4963
|
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
4964
|
};
|
|
4818
4965
|
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;
|
|
4966
|
+
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
4967
|
};
|
|
4821
4968
|
const shouldUpdateBracketMatchData = (oldState, newState) => {
|
|
4822
4969
|
if (!('bracketMatchInfos' in newState)) {
|
|
4823
4970
|
return false;
|
|
4824
4971
|
}
|
|
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;
|
|
4972
|
+
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
4973
|
};
|
|
4827
4974
|
const shouldUpdateLightBulb = (oldState, newState) => oldState.diagnostics !== newState.diagnostics || oldState.languageId !== newState.languageId || oldState.selections !== newState.selections || oldState.uri !== newState.uri;
|
|
4828
4975
|
const shouldUpdateVisibleTextData = (oldState, newState) => {
|
|
4829
4976
|
if (oldState.textInfos !== newState.textInfos || oldState.differences !== newState.differences) {
|
|
4830
4977
|
return false;
|
|
4831
4978
|
}
|
|
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;
|
|
4979
|
+
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
4980
|
};
|
|
4834
4981
|
const shouldUpdateMinimapData = (oldState, newState) => {
|
|
4835
4982
|
return newState.minimapEnabled && (!oldState.minimapEnabled || oldState.lines !== newState.lines || oldState.tokenizerId !== newState.tokenizerId);
|
|
4836
4983
|
};
|
|
4984
|
+
const mergeConflictsEqual$1 = (oldState, newState) => {
|
|
4985
|
+
const oldConflicts = oldState.mergeConflicts || [];
|
|
4986
|
+
const newConflicts = newState.mergeConflicts || [];
|
|
4987
|
+
if (oldConflicts.length !== newConflicts.length) {
|
|
4988
|
+
return false;
|
|
4989
|
+
}
|
|
4990
|
+
return oldConflicts.every((conflict, index) => {
|
|
4991
|
+
const other = newConflicts[index];
|
|
4992
|
+
return conflict.startRowIndex === other.startRowIndex && conflict.endRowIndex === other.endRowIndex;
|
|
4993
|
+
});
|
|
4994
|
+
};
|
|
4837
4995
|
const updateDerivedState = async (oldState, newState) => {
|
|
4838
|
-
const
|
|
4996
|
+
const layoutState = oldState.lines !== newState.lines && 'foldingRanges' in newState ? updateLayout(newState, []) : newState;
|
|
4997
|
+
const nextState = mergeConflictsEqual$1(oldState, layoutState) ? layoutState : {
|
|
4998
|
+
...layoutState,
|
|
4999
|
+
incrementalEdits: emptyIncrementalEdits
|
|
5000
|
+
};
|
|
4839
5001
|
let finalState = nextState;
|
|
4840
5002
|
if (shouldUpdateVisibleTextData(oldState, nextState)) {
|
|
4841
5003
|
const syncIncremental = getEnabled();
|
|
@@ -5063,6 +5225,8 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
5063
5225
|
lines: [],
|
|
5064
5226
|
longestLineWidth: 0,
|
|
5065
5227
|
maxLineY: 0,
|
|
5228
|
+
mergeConflictActionsEnabled: false,
|
|
5229
|
+
mergeConflicts: [],
|
|
5066
5230
|
minimapEnabled: false,
|
|
5067
5231
|
minimapLines: [],
|
|
5068
5232
|
minimapRevision: 0,
|
|
@@ -5102,7 +5266,9 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
5102
5266
|
undoStack: [],
|
|
5103
5267
|
uri,
|
|
5104
5268
|
validLines: [],
|
|
5269
|
+
viewLineIndices: [],
|
|
5105
5270
|
visibleLineIndices: [],
|
|
5271
|
+
visibleViewLineIndices: [],
|
|
5106
5272
|
visualDecorations: [],
|
|
5107
5273
|
widgetRevision: 0,
|
|
5108
5274
|
widgets: [],
|
|
@@ -5145,6 +5311,8 @@ const emptyEditor = {
|
|
|
5145
5311
|
lines: [],
|
|
5146
5312
|
longestLineWidth: 0,
|
|
5147
5313
|
maxLineY: 0,
|
|
5314
|
+
mergeConflictActionsEnabled: false,
|
|
5315
|
+
mergeConflicts: [],
|
|
5148
5316
|
minimapEnabled: false,
|
|
5149
5317
|
minimapLines: [],
|
|
5150
5318
|
minimapRevision: 0,
|
|
@@ -5172,7 +5340,9 @@ const emptyEditor = {
|
|
|
5172
5340
|
tokenizerId: 0,
|
|
5173
5341
|
undoStack: [],
|
|
5174
5342
|
uri: '',
|
|
5343
|
+
viewLineIndices: [],
|
|
5175
5344
|
visibleLineIndices: [],
|
|
5345
|
+
visibleViewLineIndices: [],
|
|
5176
5346
|
width: 0,
|
|
5177
5347
|
workspaceUri: '',
|
|
5178
5348
|
x: 0,
|
|
@@ -5359,6 +5529,8 @@ const createEditor = async ({
|
|
|
5359
5529
|
lines: [],
|
|
5360
5530
|
longestLineWidth: 0,
|
|
5361
5531
|
maxLineY: 0,
|
|
5532
|
+
mergeConflictActionsEnabled: false,
|
|
5533
|
+
mergeConflicts: [],
|
|
5362
5534
|
minimumSliderSize: 20,
|
|
5363
5535
|
minLineY: 0,
|
|
5364
5536
|
modified: false,
|
|
@@ -5394,7 +5566,9 @@ const createEditor = async ({
|
|
|
5394
5566
|
uri,
|
|
5395
5567
|
useFunctionalRendering,
|
|
5396
5568
|
validLines: [],
|
|
5569
|
+
viewLineIndices: [],
|
|
5397
5570
|
visibleLineIndices: [],
|
|
5571
|
+
visibleViewLineIndices: [],
|
|
5398
5572
|
widgetRevision: 0,
|
|
5399
5573
|
widgets: [],
|
|
5400
5574
|
width,
|
|
@@ -5535,7 +5709,7 @@ const isEqual$3 = (oldState, newState) => {
|
|
|
5535
5709
|
};
|
|
5536
5710
|
|
|
5537
5711
|
const isEqual$2 = (oldState, newState) => {
|
|
5538
|
-
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.differences === newState.differences && oldState.initial === newState.initial && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
|
|
5712
|
+
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;
|
|
5539
5713
|
};
|
|
5540
5714
|
|
|
5541
5715
|
const isEqual$1 = (oldState, newState) => {
|
|
@@ -5749,6 +5923,58 @@ const disposeEditor = async editorUid => {
|
|
|
5749
5923
|
return commands;
|
|
5750
5924
|
};
|
|
5751
5925
|
|
|
5926
|
+
const getAcceptedLines = (lines, conflict, action) => {
|
|
5927
|
+
const current = lines.slice(conflict.currentStartRowIndex, conflict.currentEndRowIndex);
|
|
5928
|
+
const incoming = lines.slice(conflict.incomingStartRowIndex, conflict.incomingEndRowIndex);
|
|
5929
|
+
switch (action) {
|
|
5930
|
+
case 'both':
|
|
5931
|
+
return [...current, ...incoming];
|
|
5932
|
+
case 'current':
|
|
5933
|
+
return current;
|
|
5934
|
+
case 'incoming':
|
|
5935
|
+
return incoming;
|
|
5936
|
+
default:
|
|
5937
|
+
return undefined;
|
|
5938
|
+
}
|
|
5939
|
+
};
|
|
5940
|
+
const acceptMergeConflict = async (state, action, rowIndexValue) => {
|
|
5941
|
+
const rowIndex = Number(rowIndexValue);
|
|
5942
|
+
if (!Number.isSafeInteger(rowIndex)) {
|
|
5943
|
+
return state;
|
|
5944
|
+
}
|
|
5945
|
+
const conflict = getMergeConflicts(state.lines).find(candidate => candidate.startRowIndex === rowIndex);
|
|
5946
|
+
if (!conflict) {
|
|
5947
|
+
return state;
|
|
5948
|
+
}
|
|
5949
|
+
const acceptedLines = getAcceptedLines(state.lines, conflict, action);
|
|
5950
|
+
if (!acceptedLines) {
|
|
5951
|
+
return state;
|
|
5952
|
+
}
|
|
5953
|
+
const inserted = acceptedLines.length === 0 ? [''] : acceptedLines;
|
|
5954
|
+
const start = {
|
|
5955
|
+
columnIndex: 0,
|
|
5956
|
+
rowIndex: conflict.startRowIndex
|
|
5957
|
+
};
|
|
5958
|
+
const end = {
|
|
5959
|
+
columnIndex: state.lines[conflict.endRowIndex].length,
|
|
5960
|
+
rowIndex: conflict.endRowIndex
|
|
5961
|
+
};
|
|
5962
|
+
const deleted = state.lines.slice(conflict.startRowIndex, conflict.endRowIndex + 1);
|
|
5963
|
+
const selections = new Uint32Array([conflict.startRowIndex, 0, conflict.startRowIndex, 0]);
|
|
5964
|
+
const result = await scheduleDocumentAndCursorsSelections(state, [{
|
|
5965
|
+
deleted,
|
|
5966
|
+
end,
|
|
5967
|
+
inserted,
|
|
5968
|
+
origin: Unknown$2,
|
|
5969
|
+
start
|
|
5970
|
+
}], selections);
|
|
5971
|
+
return {
|
|
5972
|
+
...result,
|
|
5973
|
+
incrementalEdits: emptyIncrementalEdits
|
|
5974
|
+
};
|
|
5975
|
+
};
|
|
5976
|
+
const handleMergeConflictActionsMouseDown = state => state;
|
|
5977
|
+
|
|
5752
5978
|
// @ts-ignore
|
|
5753
5979
|
const getNewSelections$d = selections => {
|
|
5754
5980
|
const newSelections = [];
|
|
@@ -6089,6 +6315,7 @@ const at = async (editor, eventX, eventY) => {
|
|
|
6089
6315
|
lines,
|
|
6090
6316
|
rowHeight,
|
|
6091
6317
|
tabSize,
|
|
6318
|
+
viewLineIndices,
|
|
6092
6319
|
x,
|
|
6093
6320
|
y
|
|
6094
6321
|
} = editor;
|
|
@@ -6099,7 +6326,7 @@ const at = async (editor, eventX, eventY) => {
|
|
|
6099
6326
|
rowIndex: 0
|
|
6100
6327
|
};
|
|
6101
6328
|
}
|
|
6102
|
-
const rowIndex = getDocumentRowForVisualRow(visualRowIndex, foldingRanges);
|
|
6329
|
+
const rowIndex = viewLineIndices ? getDocumentRowForVisualRow$1(visualRowIndex, viewLineIndices) : getDocumentRowForVisualRow(visualRowIndex, foldingRanges);
|
|
6103
6330
|
const relativeX = eventX - x - gutterWidth + deltaX;
|
|
6104
6331
|
const clampedRowIndex = clamp(rowIndex, 0, lines.length - 1);
|
|
6105
6332
|
const line = lines[clampedRowIndex];
|
|
@@ -6934,6 +7161,7 @@ const getColorPickerBounds = editor => {
|
|
|
6934
7161
|
height: editorHeight,
|
|
6935
7162
|
rowHeight,
|
|
6936
7163
|
selections,
|
|
7164
|
+
viewLineIndices,
|
|
6937
7165
|
width: editorWidth,
|
|
6938
7166
|
x: editorX,
|
|
6939
7167
|
y: editorY
|
|
@@ -6945,7 +7173,7 @@ const getColorPickerBounds = editor => {
|
|
|
6945
7173
|
const editorRight = editorX + editorWidth;
|
|
6946
7174
|
const editorBottom = editorY + editorHeight;
|
|
6947
7175
|
const cursorX = editorX + columnIndex * columnWidth - deltaX;
|
|
6948
|
-
const visualRowIndex = getVisualRowForDocumentRow(rowIndex, foldingRanges);
|
|
7176
|
+
const visualRowIndex = viewLineIndices ? getVisualRowForDocumentRow$1(rowIndex, viewLineIndices) : getVisualRowForDocumentRow(rowIndex, foldingRanges);
|
|
6949
7177
|
const lineTop = editorY + visualRowIndex * rowHeight - deltaY;
|
|
6950
7178
|
const lineBottom = lineTop + rowHeight;
|
|
6951
7179
|
const yAbove = lineTop - height;
|
|
@@ -12583,7 +12811,10 @@ const HandleScrollBarVerticalPointerUp = 32;
|
|
|
12583
12811
|
const HandleWheel = 33;
|
|
12584
12812
|
const HandleKeyUp = 34;
|
|
12585
12813
|
const HandleLightBulbClick = 35;
|
|
12814
|
+
const HandleMergeConflictActionClick = 36;
|
|
12815
|
+
const HandleMergeConflictActionsMouseDown = 37;
|
|
12586
12816
|
|
|
12817
|
+
const Button$1 = 1;
|
|
12587
12818
|
const Div = 4;
|
|
12588
12819
|
const Input = 6;
|
|
12589
12820
|
const Span = 8;
|
|
@@ -13697,6 +13928,7 @@ const kAutoClosingBrackets = 'editor.autoclosingBrackets';
|
|
|
13697
13928
|
const kFontWeight = 'editor.fontWeight';
|
|
13698
13929
|
const kHover = 'editor.hover';
|
|
13699
13930
|
const kMinimapEnabled = 'editor.minimap.enabled';
|
|
13931
|
+
const kMergeConflictActions = 'editor.mergeConflictActions';
|
|
13700
13932
|
const kBreadcrumbsEnabled = 'breadcrumbs.enabled';
|
|
13701
13933
|
const kDragAndDropEnabled = 'editor.dragAndDrop';
|
|
13702
13934
|
const getDragAndDropEnabled = async () => {
|
|
@@ -13756,12 +13988,15 @@ const getFontWeight = async () => {
|
|
|
13756
13988
|
const getMinimapEnabled = async () => {
|
|
13757
13989
|
return (await get$3(kMinimapEnabled)) ?? false;
|
|
13758
13990
|
};
|
|
13991
|
+
const getMergeConflictActionsEnabled = async () => {
|
|
13992
|
+
return (await get$3(kMergeConflictActions)) ?? false;
|
|
13993
|
+
};
|
|
13759
13994
|
const getBreadcrumbsEnabled = async () => {
|
|
13760
13995
|
return (await get$3(kBreadcrumbsEnabled)) ?? false;
|
|
13761
13996
|
};
|
|
13762
13997
|
|
|
13763
13998
|
const getEditorPreferences = async () => {
|
|
13764
|
-
const [diagnosticsEnabled$1, fontFamily, fontSize, fontWeight, hoverEnabled, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, breadcrumbsEnabled, insertSpaces, dragAndDropEnabled] = await Promise.all([diagnosticsEnabled(), getFontFamily(), getFontSize(), getFontWeight(), getHoverEnabled(), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getHighlightActiveLineNumber(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters(), getMinimapEnabled(), getBreadcrumbsEnabled(), getInsertSpaces(), getDragAndDropEnabled()]);
|
|
13999
|
+
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()]);
|
|
13765
14000
|
return {
|
|
13766
14001
|
breadcrumbsEnabled,
|
|
13767
14002
|
completionTriggerCharacters,
|
|
@@ -13779,6 +14014,7 @@ const getEditorPreferences = async () => {
|
|
|
13779
14014
|
isQuickSuggestionsEnabled: isQuickSuggestionsEnabled$1,
|
|
13780
14015
|
letterSpacing,
|
|
13781
14016
|
lineNumbers,
|
|
14017
|
+
mergeConflictActionsEnabled,
|
|
13782
14018
|
minimapEnabled,
|
|
13783
14019
|
rowHeight,
|
|
13784
14020
|
tabSize
|
|
@@ -14120,6 +14356,7 @@ const loadContent = async (state, savedState) => {
|
|
|
14120
14356
|
isQuickSuggestionsEnabled,
|
|
14121
14357
|
letterSpacing,
|
|
14122
14358
|
lineNumbers,
|
|
14359
|
+
mergeConflictActionsEnabled,
|
|
14123
14360
|
minimapEnabled,
|
|
14124
14361
|
rowHeight,
|
|
14125
14362
|
tabSize
|
|
@@ -14155,6 +14392,7 @@ const loadContent = async (state, savedState) => {
|
|
|
14155
14392
|
letterSpacing,
|
|
14156
14393
|
lineNumbers,
|
|
14157
14394
|
loadError: '',
|
|
14395
|
+
mergeConflictActionsEnabled,
|
|
14158
14396
|
minimapEnabled,
|
|
14159
14397
|
rowHeight,
|
|
14160
14398
|
tabSize,
|
|
@@ -14366,6 +14604,34 @@ ${editorSelector} .EditorRow {
|
|
|
14366
14604
|
height: var(--EditorRowHeight);
|
|
14367
14605
|
line-height: var(--EditorRowHeight);
|
|
14368
14606
|
}
|
|
14607
|
+
${editorSelector} .MergeConflictActions,
|
|
14608
|
+
${editorSelector} .MergeConflictActionsGutter {
|
|
14609
|
+
box-sizing: border-box;
|
|
14610
|
+
height: var(--EditorRowHeight);
|
|
14611
|
+
line-height: var(--EditorRowHeight);
|
|
14612
|
+
}
|
|
14613
|
+
${editorSelector} .MergeConflictActions {
|
|
14614
|
+
align-items: center;
|
|
14615
|
+
display: flex;
|
|
14616
|
+
gap: 12px;
|
|
14617
|
+
padding-left: 4px;
|
|
14618
|
+
user-select: none;
|
|
14619
|
+
}
|
|
14620
|
+
${editorSelector} .MergeConflictAction {
|
|
14621
|
+
appearance: none;
|
|
14622
|
+
background: none;
|
|
14623
|
+
border: 0;
|
|
14624
|
+
color: var(--TextLinkForeground, #3794ff);
|
|
14625
|
+
cursor: pointer;
|
|
14626
|
+
font: inherit;
|
|
14627
|
+
padding: 0;
|
|
14628
|
+
}
|
|
14629
|
+
${editorSelector} .MergeConflictAction:hover,
|
|
14630
|
+
${editorSelector} .MergeConflictAction:focus-visible {
|
|
14631
|
+
color: var(--TextLinkActiveForeground, #4daafc);
|
|
14632
|
+
outline: none;
|
|
14633
|
+
text-decoration: underline;
|
|
14634
|
+
}
|
|
14369
14635
|
${editorSelector} .EditorLineDecoration {
|
|
14370
14636
|
color: var(--EditorInlineBlameForeground, rgba(255, 255, 255, 0.5));
|
|
14371
14637
|
font-style: italic;
|
|
@@ -14928,15 +15194,57 @@ const editorLineDecorationNode = {
|
|
|
14928
15194
|
className: EditorLineDecoration,
|
|
14929
15195
|
type: Span
|
|
14930
15196
|
};
|
|
14931
|
-
const
|
|
15197
|
+
const mergeConflictActions = [{
|
|
15198
|
+
action: 'current',
|
|
15199
|
+
label: 'Accept Current Change'
|
|
15200
|
+
}, {
|
|
15201
|
+
action: 'incoming',
|
|
15202
|
+
label: 'Accept Incoming Change'
|
|
15203
|
+
}, {
|
|
15204
|
+
action: 'both',
|
|
15205
|
+
label: 'Accept Both Changes'
|
|
15206
|
+
}];
|
|
15207
|
+
const addMergeConflictActions = (dom, rowIndex) => {
|
|
15208
|
+
dom.push({
|
|
15209
|
+
childCount: mergeConflictActions.length,
|
|
15210
|
+
className: 'MergeConflictActions',
|
|
15211
|
+
'data-rowIndex': rowIndex,
|
|
15212
|
+
onMouseDown: HandleMergeConflictActionsMouseDown,
|
|
15213
|
+
type: Div
|
|
15214
|
+
});
|
|
15215
|
+
for (const {
|
|
15216
|
+
action,
|
|
15217
|
+
label
|
|
15218
|
+
} of mergeConflictActions) {
|
|
15219
|
+
dom.push({
|
|
15220
|
+
ariaLabel: `${label} at line ${rowIndex + 1}`,
|
|
15221
|
+
childCount: 1,
|
|
15222
|
+
className: 'MergeConflictAction',
|
|
15223
|
+
'data-action': action,
|
|
15224
|
+
'data-rowIndex': rowIndex,
|
|
15225
|
+
onClick: HandleMergeConflictActionClick,
|
|
15226
|
+
title: label,
|
|
15227
|
+
type: Button$1
|
|
15228
|
+
}, text(label));
|
|
15229
|
+
}
|
|
15230
|
+
};
|
|
15231
|
+
const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = []) => {
|
|
14932
15232
|
const dom = [];
|
|
14933
|
-
|
|
14934
|
-
|
|
14935
|
-
|
|
14936
|
-
|
|
15233
|
+
const actualViewRows = visibleViewLineIndices.length === 0 ? Array.from({
|
|
15234
|
+
length: textInfos.length
|
|
15235
|
+
}, (_, index) => visibleLineIndices[index] ?? index) : visibleViewLineIndices;
|
|
15236
|
+
let textInfoIndex = 0;
|
|
15237
|
+
for (const viewRow of actualViewRows) {
|
|
15238
|
+
if (isMergeConflictActionsRow(viewRow)) {
|
|
15239
|
+
addMergeConflictActions(dom, getMergeConflictRowIndex(viewRow));
|
|
15240
|
+
continue;
|
|
15241
|
+
}
|
|
15242
|
+
const textInfo = textInfos[textInfoIndex];
|
|
15243
|
+
const difference = differences[textInfoIndex];
|
|
15244
|
+
const rowIndex = viewRow;
|
|
14937
15245
|
const rowDecorations = endOfLineDecorations.filter(decoration => decoration.rowIndex === rowIndex);
|
|
14938
15246
|
let className = EditorRow;
|
|
14939
|
-
if (
|
|
15247
|
+
if (rowIndex === highlightedLine) {
|
|
14940
15248
|
className = mergeClassNames(className, EditorRowHighlighted);
|
|
14941
15249
|
}
|
|
14942
15250
|
dom.push({
|
|
@@ -14957,14 +15265,15 @@ const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, h
|
|
|
14957
15265
|
for (const decoration of rowDecorations) {
|
|
14958
15266
|
dom.push(editorLineDecorationNode, text(decoration.text));
|
|
14959
15267
|
}
|
|
15268
|
+
textInfoIndex++;
|
|
14960
15269
|
}
|
|
14961
15270
|
return dom;
|
|
14962
15271
|
};
|
|
14963
15272
|
|
|
14964
|
-
const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = []) => {
|
|
14965
|
-
const rowsDom = getEditorRowsVirtualDom$1(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations);
|
|
15273
|
+
const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = []) => {
|
|
15274
|
+
const rowsDom = getEditorRowsVirtualDom$1(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices);
|
|
14966
15275
|
return [{
|
|
14967
|
-
childCount: textInfos.length,
|
|
15276
|
+
childCount: visibleViewLineIndices.length || textInfos.length,
|
|
14968
15277
|
className: 'EditorRows',
|
|
14969
15278
|
onMouseDown: HandleMouseDown,
|
|
14970
15279
|
onPointerDown: HandlePointerDown,
|
|
@@ -15007,8 +15316,8 @@ const editorLayersNode = {
|
|
|
15007
15316
|
className: 'EditorLayers',
|
|
15008
15317
|
type: Div
|
|
15009
15318
|
};
|
|
15010
|
-
const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineNumbers = true, highlightedLine = -1, cursorInfos = [], diagnostics = [], visibleLineIndices = [], endOfLineDecorations = [], bracketMatchInfos = [], focused = true) => {
|
|
15011
|
-
return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused), ...getEditorRowsVirtualDom(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations), ...getEditorCursorsVirtualDom(cursorInfos), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos)];
|
|
15319
|
+
const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineNumbers = true, highlightedLine = -1, cursorInfos = [], diagnostics = [], visibleLineIndices = [], endOfLineDecorations = [], bracketMatchInfos = [], focused = true, visibleViewLineIndices = []) => {
|
|
15320
|
+
return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused), ...getEditorRowsVirtualDom(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices), ...getEditorCursorsVirtualDom(cursorInfos), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos)];
|
|
15012
15321
|
};
|
|
15013
15322
|
|
|
15014
15323
|
const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
|
|
@@ -15076,20 +15385,24 @@ const getEditorContentVirtualDom = ({
|
|
|
15076
15385
|
scrollBarDiagnostics = [],
|
|
15077
15386
|
selectionInfos = [],
|
|
15078
15387
|
textInfos,
|
|
15079
|
-
visibleLineIndices = []
|
|
15388
|
+
visibleLineIndices = [],
|
|
15389
|
+
visibleViewLineIndices = []
|
|
15080
15390
|
}) => {
|
|
15081
|
-
return [editorContentNode, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom()];
|
|
15391
|
+
return [editorContentNode, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused, visibleViewLineIndices), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom()];
|
|
15082
15392
|
};
|
|
15083
15393
|
|
|
15084
15394
|
const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
|
|
15085
15395
|
const isBreakpoint = typeof gutterInfo === 'object' && gutterInfo.isBreakpoint;
|
|
15086
15396
|
const isLightBulb = typeof gutterInfo === 'object' && gutterInfo.isLightBulb;
|
|
15397
|
+
const isMergeConflictActions = typeof gutterInfo === 'object' && gutterInfo.isMergeConflictActions;
|
|
15087
15398
|
const lineNumber = typeof gutterInfo === 'object' ? gutterInfo.lineNumber : gutterInfo;
|
|
15088
15399
|
const gutterDecorations = typeof gutterInfo === 'object' ? gutterInfo.gutterDecorations || [] : [];
|
|
15089
15400
|
const showLineNumber = typeof gutterInfo !== 'object' || gutterInfo.showLineNumber !== false;
|
|
15090
15401
|
const label = isLightBulb ? `Show Code Actions on line ${lineNumber}` : `Breakpoint on line ${lineNumber}`;
|
|
15091
15402
|
let className = lineNumber === activeLineNumber ? 'LineNumber LineNumberActive' : 'LineNumber';
|
|
15092
|
-
if (
|
|
15403
|
+
if (isMergeConflictActions) {
|
|
15404
|
+
className += ' MergeConflictActionsGutter';
|
|
15405
|
+
} else if (isLightBulb) {
|
|
15093
15406
|
className += ' LineNumberLightBulb MaskIconLightBulb';
|
|
15094
15407
|
} else if (isBreakpoint) {
|
|
15095
15408
|
className += ' LineNumberBreakpoint';
|
|
@@ -15115,7 +15428,7 @@ const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
|
|
|
15115
15428
|
className: mergeClassNames('EditorGutterDecoration', `EditorGutterDecoration${decoration.type[0].toUpperCase()}${decoration.type.slice(1)}`),
|
|
15116
15429
|
title: `${decoration.type[0].toUpperCase()}${decoration.type.slice(1)} line ${lineNumber}`,
|
|
15117
15430
|
type: Span
|
|
15118
|
-
})), text(isLightBulb ? '' : isBreakpoint ? '●' : showLineNumber ? lineNumber : '')];
|
|
15431
|
+
})), text(isMergeConflictActions || isLightBulb ? '' : isBreakpoint ? '●' : showLineNumber ? lineNumber : '')];
|
|
15119
15432
|
};
|
|
15120
15433
|
const getEditorGutterVirtualDom$1 = (gutterInfos, activeLineNumber = -1) => {
|
|
15121
15434
|
const dom = gutterInfos.flatMap(gutterInfo => getGutterInfoVirtualDom(gutterInfo, activeLineNumber));
|
|
@@ -15137,6 +15450,14 @@ const getGutterInfos = (minLineY, maxLineY, breakPoints, showLineNumbers = true,
|
|
|
15137
15450
|
length: maxLineY - minLineY
|
|
15138
15451
|
}, (_, index) => minLineY + index);
|
|
15139
15452
|
for (const rowIndex of rows) {
|
|
15453
|
+
if (rowIndex < 0) {
|
|
15454
|
+
gutterInfos.push({
|
|
15455
|
+
isMergeConflictActions: true,
|
|
15456
|
+
lineNumber: 0,
|
|
15457
|
+
showLineNumber: false
|
|
15458
|
+
});
|
|
15459
|
+
continue;
|
|
15460
|
+
}
|
|
15140
15461
|
const lineNumber = rowIndex + 1;
|
|
15141
15462
|
const isBreakpoint = breakPoints.includes(rowIndex);
|
|
15142
15463
|
const isLightBulb = rowIndex === lightBulbRowIndex;
|
|
@@ -15228,6 +15549,7 @@ const getEditorVirtualDom = ({
|
|
|
15228
15549
|
uid,
|
|
15229
15550
|
uri = '',
|
|
15230
15551
|
visibleLineIndices,
|
|
15552
|
+
visibleViewLineIndices = [],
|
|
15231
15553
|
workspaceUri = ''
|
|
15232
15554
|
}) => {
|
|
15233
15555
|
if (loadError) {
|
|
@@ -15239,7 +15561,8 @@ const getEditorVirtualDom = ({
|
|
|
15239
15561
|
type: Div
|
|
15240
15562
|
}, textEditorErrorIconNode, textEditorErrorMessageNode, text(loadError)];
|
|
15241
15563
|
}
|
|
15242
|
-
const
|
|
15564
|
+
const gutterLineIndices = visibleViewLineIndices.length > 0 ? visibleViewLineIndices : visibleLineIndices;
|
|
15565
|
+
const visibleGutterInfos = breakPoints.length > 0 || gutterDecorations.length > 0 || visibleLineIndices ? getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, gutterLineIndices, lightBulbRowIndex, gutterDecorations) : gutterInfos;
|
|
15243
15566
|
const showGutter = lineNumbers || breakPoints.length > 0 || lightBulbRowIndex >= 0 || gutterDecorations.length > 0;
|
|
15244
15567
|
const primaryCursorRowIndex = getPrimaryCursorRowIndex(selections, primarySelectionIndex);
|
|
15245
15568
|
const activeLineNumber = highlightActiveLineNumber ? primaryCursorRowIndex + 1 : -1;
|
|
@@ -15273,17 +15596,18 @@ const getEditorVirtualDom = ({
|
|
|
15273
15596
|
scrollBarDiagnostics,
|
|
15274
15597
|
selectionInfos,
|
|
15275
15598
|
textInfos,
|
|
15276
|
-
visibleLineIndices: visibleLineIndices || []
|
|
15599
|
+
visibleLineIndices: visibleLineIndices || [],
|
|
15600
|
+
visibleViewLineIndices
|
|
15277
15601
|
}), ...minimapDom];
|
|
15278
15602
|
};
|
|
15279
15603
|
|
|
15280
15604
|
const getScrollBarDiagnostics = (editor, diagnostics) => {
|
|
15281
15605
|
const height = editor.height || 0;
|
|
15282
|
-
const lineCount = Math.max(editor.lines?.length || 0, 1);
|
|
15606
|
+
const lineCount = Math.max(editor.viewLineIndices?.length || editor.lines?.length || 0, 1);
|
|
15283
15607
|
const markerHeight = 3;
|
|
15284
15608
|
const scrollBarDecorations = Array.from(diagnostics, diagnostic => ({
|
|
15285
15609
|
height: markerHeight,
|
|
15286
|
-
top: Math.min(Math.round(diagnostic.rowIndex / lineCount * height), Math.max(height - markerHeight, 0)),
|
|
15610
|
+
top: Math.min(Math.round((editor.viewLineIndices ? getVisualRowForDocumentRow$1(diagnostic.rowIndex, editor.viewLineIndices) : diagnostic.rowIndex) / lineCount * height), Math.max(height - markerHeight, 0)),
|
|
15287
15611
|
type: diagnostic.type
|
|
15288
15612
|
}));
|
|
15289
15613
|
return scrollBarDecorations;
|
|
@@ -15313,8 +15637,16 @@ const getDom = state => {
|
|
|
15313
15637
|
scrollBarDiagnostics: getScrollBarDiagnostics(state, diagnostics)
|
|
15314
15638
|
});
|
|
15315
15639
|
};
|
|
15640
|
+
const mergeConflictsEqual = (oldState, newState) => {
|
|
15641
|
+
const oldConflicts = oldState.mergeConflicts || [];
|
|
15642
|
+
const newConflicts = newState.mergeConflicts || [];
|
|
15643
|
+
return oldConflicts.length === newConflicts.length && oldConflicts.every((conflict, index) => {
|
|
15644
|
+
const other = newConflicts[index];
|
|
15645
|
+
return conflict.startRowIndex === other.startRowIndex && conflict.endRowIndex === other.endRowIndex;
|
|
15646
|
+
});
|
|
15647
|
+
};
|
|
15316
15648
|
const renderIncremental = (oldState, newState) => {
|
|
15317
|
-
const oldDom = oldState.initial ? getDom(oldState) : get(newState.uid) || getDom(oldState);
|
|
15649
|
+
const oldDom = oldState.initial || !mergeConflictsEqual(oldState, newState) ? getDom(oldState) : get(newState.uid) || getDom(oldState);
|
|
15318
15650
|
const newDom = getDom(newState);
|
|
15319
15651
|
const patches = diffTree(oldDom, newDom);
|
|
15320
15652
|
if (patches.length === 0) {
|
|
@@ -15459,13 +15791,13 @@ const renderLines = {
|
|
|
15459
15791
|
newState.differences = differences;
|
|
15460
15792
|
const {
|
|
15461
15793
|
highlightedLine,
|
|
15462
|
-
visibleLineIndices
|
|
15794
|
+
visibleLineIndices,
|
|
15795
|
+
visibleViewLineIndices
|
|
15463
15796
|
} = newState;
|
|
15464
|
-
const
|
|
15465
|
-
const dom = getEditorRowsVirtualDom$1(textInfos, differences, true, relativeLine, visibleLineIndices, endOfLineDecorations);
|
|
15797
|
+
const dom = getEditorRowsVirtualDom$1(textInfos, differences, true, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices);
|
|
15466
15798
|
return [/* method */'setText', dom];
|
|
15467
15799
|
},
|
|
15468
|
-
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
|
|
15800
|
+
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
|
|
15469
15801
|
};
|
|
15470
15802
|
const renderSelections = {
|
|
15471
15803
|
apply: (oldState, newState) => {
|
|
@@ -15516,18 +15848,20 @@ const renderGutterInfo = {
|
|
|
15516
15848
|
minLineY,
|
|
15517
15849
|
primarySelectionIndex,
|
|
15518
15850
|
selections,
|
|
15519
|
-
visibleLineIndices
|
|
15851
|
+
visibleLineIndices,
|
|
15852
|
+
visibleViewLineIndices = []
|
|
15520
15853
|
} = newState;
|
|
15521
15854
|
if (!lineNumbers && breakPoints.length === 0 && lightBulbRowIndex === -1 && gutterDecorations.length === 0) {
|
|
15522
15855
|
return ['renderGutter', []];
|
|
15523
15856
|
}
|
|
15524
|
-
const
|
|
15857
|
+
const gutterLineIndices = visibleViewLineIndices.length > 0 ? visibleViewLineIndices : visibleLineIndices;
|
|
15858
|
+
const gutterInfos = getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, gutterLineIndices, lightBulbRowIndex, gutterDecorations);
|
|
15525
15859
|
const primaryCursorRowIndex = getPrimaryCursorRowIndex(selections, primarySelectionIndex);
|
|
15526
15860
|
const activeLineNumber = highlightActiveLineNumber ? primaryCursorRowIndex + 1 : -1;
|
|
15527
15861
|
const dom = getEditorGutterVirtualDom$1(gutterInfos, activeLineNumber);
|
|
15528
15862
|
return ['renderGutter', dom];
|
|
15529
15863
|
},
|
|
15530
|
-
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 && (!newState.highlightActiveLineNumber || getPrimaryCursorRowIndex(oldState.selections, oldState.primarySelectionIndex) === getPrimaryCursorRowIndex(newState.selections, newState.primarySelectionIndex))
|
|
15864
|
+
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))
|
|
15531
15865
|
};
|
|
15532
15866
|
const renderWidgets = {
|
|
15533
15867
|
apply: renderWidgets$1,
|
|
@@ -15566,6 +15900,16 @@ const renderEventListeners = () => {
|
|
|
15566
15900
|
name: HandleLightBulbClick,
|
|
15567
15901
|
params: ['showSourceActions3'],
|
|
15568
15902
|
preventDefault: true
|
|
15903
|
+
}, {
|
|
15904
|
+
name: HandleMergeConflictActionClick,
|
|
15905
|
+
params: ['acceptMergeConflict', 'event.target.dataset.action', 'event.target.dataset.rowIndex'],
|
|
15906
|
+
preventDefault: true,
|
|
15907
|
+
stopPropagation: true
|
|
15908
|
+
}, {
|
|
15909
|
+
name: HandleMergeConflictActionsMouseDown,
|
|
15910
|
+
params: ['handleMergeConflictActionsMouseDown'],
|
|
15911
|
+
preventDefault: true,
|
|
15912
|
+
stopPropagation: true
|
|
15569
15913
|
}, {
|
|
15570
15914
|
name: HandleFocus,
|
|
15571
15915
|
params: ['handleFocus']
|
|
@@ -15618,7 +15962,7 @@ const renderEventListeners = () => {
|
|
|
15618
15962
|
passive: true
|
|
15619
15963
|
}, {
|
|
15620
15964
|
name: HandleContextMenu,
|
|
15621
|
-
params: ['handleContextMenu', Button$
|
|
15965
|
+
params: ['handleContextMenu', Button$2, ClientX, ClientY],
|
|
15622
15966
|
preventDefault: true
|
|
15623
15967
|
}, {
|
|
15624
15968
|
name: HandleScrollBarVerticalPointerDown,
|
|
@@ -15973,6 +16317,7 @@ const commandMap = {
|
|
|
15973
16317
|
'ActivateByEvent.activateByEvent': activateByEvent,
|
|
15974
16318
|
'CodeGenerator.accept': codeGeneratorAccept,
|
|
15975
16319
|
'ColorPicker.loadContent': loadContent$3,
|
|
16320
|
+
'Editor.acceptMergeConflict': wrapCommand(acceptMergeConflict),
|
|
15976
16321
|
'Editor.addCursorAbove': wrapCommand(addCursorAbove),
|
|
15977
16322
|
'Editor.addCursorBelow': wrapCommand(addCursorBelow),
|
|
15978
16323
|
'Editor.applyDocumentEdits': wrapCommand(applyDocumentEdits$1),
|
|
@@ -16074,6 +16419,7 @@ const commandMap = {
|
|
|
16074
16419
|
'Editor.handleDoubleClick': wrapCommand(handleDoubleClick),
|
|
16075
16420
|
'Editor.handleFocus': wrapCommand(handleFocus$1),
|
|
16076
16421
|
'Editor.handleKeyUp': wrapCommand(handleKeyUp, true),
|
|
16422
|
+
'Editor.handleMergeConflictActionsMouseDown': wrapCommand(handleMergeConflictActionsMouseDown),
|
|
16077
16423
|
'Editor.handleMouseDown': wrapCommand(handleMouseDown),
|
|
16078
16424
|
'Editor.handleMouseMove': wrapCommand(handleMouseMove),
|
|
16079
16425
|
'Editor.handleMouseMoveWithAltKey': wrapCommand(handleMouseMoveWithAltKey),
|
package/dist/settings.json
CHANGED
|
@@ -53,6 +53,14 @@
|
|
|
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
|
+
},
|
|
56
64
|
{
|
|
57
65
|
"category": "text-editor",
|
|
58
66
|
"description": "Controls whether the primary cursor line number is highlighted",
|