@lvce-editor/editor-worker 19.81.0 → 19.81.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/diff-sdk.d.ts +7 -5
- package/dist/diff-sdk.js +558 -373
- package/dist/editorWorkerMain.js +575 -369
- package/dist/settings.json +2 -10
- package/package.json +1 -1
package/dist/diff-sdk.js
CHANGED
|
@@ -757,10 +757,12 @@ const getVisibleLineCount = (lineCount, ranges) => {
|
|
|
757
757
|
for (const range of getSortedRanges(ranges)) {
|
|
758
758
|
const start = Math.max(range.start + 1, hiddenUntil + 1);
|
|
759
759
|
const end = Math.min(range.end, lineCount - 1);
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
760
|
+
const hasVisibleRange = start <= end;
|
|
761
|
+
if (!hasVisibleRange) {
|
|
762
|
+
continue;
|
|
763
763
|
}
|
|
764
|
+
hidden += end - start + 1;
|
|
765
|
+
hiddenUntil = end;
|
|
764
766
|
}
|
|
765
767
|
return lineCount - hidden;
|
|
766
768
|
};
|
|
@@ -867,10 +869,11 @@ const removeRangeAt = (ranges, rowIndex) => {
|
|
|
867
869
|
break;
|
|
868
870
|
}
|
|
869
871
|
const range = ranges[i];
|
|
870
|
-
if (rowIndex >= range.start && rowIndex <= range.end && range.end - range.start < bestSize) {
|
|
871
|
-
|
|
872
|
-
bestSize = range.end - range.start;
|
|
872
|
+
if (!(rowIndex >= range.start && rowIndex <= range.end && range.end - range.start < bestSize)) {
|
|
873
|
+
continue;
|
|
873
874
|
}
|
|
875
|
+
bestIndex = i;
|
|
876
|
+
bestSize = range.end - range.start;
|
|
874
877
|
}
|
|
875
878
|
return bestIndex === -1 ? ranges : ranges.filter((_, index) => index !== bestIndex);
|
|
876
879
|
};
|
|
@@ -911,20 +914,22 @@ const scanLine = (line, row, stack, ranges, state) => {
|
|
|
911
914
|
stack.push(row);
|
|
912
915
|
continue;
|
|
913
916
|
}
|
|
914
|
-
if (character
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
917
|
+
if (character !== '}') {
|
|
918
|
+
continue;
|
|
919
|
+
}
|
|
920
|
+
const start = stack.pop();
|
|
921
|
+
if (start !== undefined && start < row) {
|
|
922
|
+
ranges.push({
|
|
923
|
+
end: row,
|
|
924
|
+
start
|
|
925
|
+
});
|
|
922
926
|
}
|
|
923
927
|
}
|
|
924
|
-
if (state.quote
|
|
925
|
-
|
|
926
|
-
state.escaped = false;
|
|
928
|
+
if (state.quote === '`') {
|
|
929
|
+
return;
|
|
927
930
|
}
|
|
931
|
+
state.quote = '';
|
|
932
|
+
state.escaped = false;
|
|
928
933
|
};
|
|
929
934
|
const findRanges = lines => {
|
|
930
935
|
const stack = [];
|
|
@@ -2085,7 +2090,10 @@ const getVisualColumns = line => {
|
|
|
2085
2090
|
}
|
|
2086
2091
|
return columns;
|
|
2087
2092
|
};
|
|
2088
|
-
const getPosition = async (line, column, measure,
|
|
2093
|
+
const getPosition = async (line, column, measure, {
|
|
2094
|
+
runs = getRuns(line),
|
|
2095
|
+
selectedRun = getCaretRun(runs, column)
|
|
2096
|
+
} = {}) => {
|
|
2089
2097
|
let x = 0;
|
|
2090
2098
|
for (const run of runs) {
|
|
2091
2099
|
const text = line.slice(run.start, run.end);
|
|
@@ -2111,8 +2119,12 @@ const getColumn = async (line, x, measure) => {
|
|
|
2111
2119
|
let high = columns.length - 1;
|
|
2112
2120
|
while (low < high) {
|
|
2113
2121
|
const middle = Math.floor((low + high) / 2);
|
|
2114
|
-
const left = await getPosition(line, columns[middle], measure,
|
|
2115
|
-
|
|
2122
|
+
const left = await getPosition(line, columns[middle], measure, {
|
|
2123
|
+
runs
|
|
2124
|
+
});
|
|
2125
|
+
const right = await getPosition(line, columns[middle + 1], measure, {
|
|
2126
|
+
runs
|
|
2127
|
+
});
|
|
2116
2128
|
if (x < (left + right) / 2) {
|
|
2117
2129
|
high = middle;
|
|
2118
2130
|
} else {
|
|
@@ -2642,15 +2654,15 @@ const safeTokenizeLine = (languageId, tokenizeLine, line, lineStateAtStart, hasA
|
|
|
2642
2654
|
};
|
|
2643
2655
|
|
|
2644
2656
|
/**
|
|
2645
|
-
|
|
2646
|
-
|
|
2657
|
+
@enum number
|
|
2658
|
+
*/
|
|
2647
2659
|
const State = {
|
|
2648
2660
|
TopLevelContent: 1
|
|
2649
2661
|
};
|
|
2650
2662
|
|
|
2651
2663
|
/**
|
|
2652
|
-
|
|
2653
|
-
|
|
2664
|
+
@enum number
|
|
2665
|
+
*/
|
|
2654
2666
|
const TokenType = {
|
|
2655
2667
|
Text: 1
|
|
2656
2668
|
};
|
|
@@ -2788,7 +2800,7 @@ const register$1 = tokenizer => {
|
|
|
2788
2800
|
|
|
2789
2801
|
const getEmbeddedTokenization = (langageId, line, embeddedLanguage, embeddedLanguageStart, embeddedLanguageEnd, topContexts, tokenizersToLoad) => {
|
|
2790
2802
|
const embeddedTokenizer = getTokenizer(embeddedLanguage);
|
|
2791
|
-
if (
|
|
2803
|
+
if (embeddedTokenizer && embeddedTokenizer !== TokenizePlainText && embeddedLanguageStart !== line.length) {
|
|
2792
2804
|
const isFull = embeddedLanguageStart === 0 && embeddedLanguageEnd === line.length;
|
|
2793
2805
|
const partialLine = line.slice(embeddedLanguageStart, embeddedLanguageEnd);
|
|
2794
2806
|
const embedResult = safeTokenizeLine(langageId, embeddedTokenizer.tokenizeLine, partialLine, topContexts[embeddedLanguage] || getInitialLineState(embeddedTokenizer.initialLineState), embeddedTokenizer.hasArrayReturn);
|
|
@@ -2864,12 +2876,11 @@ const getTokensViewport = (editor, startLineIndex, endLineIndex) => {
|
|
|
2864
2876
|
lines,
|
|
2865
2877
|
tokenizerId
|
|
2866
2878
|
} = editor;
|
|
2867
|
-
const tokenizer = get$6(tokenizerId);
|
|
2868
2879
|
const {
|
|
2869
2880
|
hasArrayReturn,
|
|
2870
2881
|
initialLineState,
|
|
2871
2882
|
tokenizeLine
|
|
2872
|
-
} =
|
|
2883
|
+
} = get$6(tokenizerId);
|
|
2873
2884
|
const tokenizeStartIndex = invalidStartIndex;
|
|
2874
2885
|
const tokenizeEndIndex = getTokenizeEndIndex(invalidStartIndex, endLineIndex, tokenizeStartIndex);
|
|
2875
2886
|
const tokenizersToLoad = [];
|
|
@@ -2881,10 +2892,11 @@ const getTokensViewport = (editor, startLineIndex, endLineIndex) => {
|
|
|
2881
2892
|
const result = safeTokenizeLine(languageId, tokenizeLine, line, lineState, hasArrayReturn);
|
|
2882
2893
|
// TODO if lineCacheEnd matches the one before, skip tokenizing lines after
|
|
2883
2894
|
lineCache[i + 1] = result;
|
|
2884
|
-
if (result.embeddedLanguage) {
|
|
2885
|
-
|
|
2886
|
-
linesWithEmbed.push(i);
|
|
2895
|
+
if (!result.embeddedLanguage) {
|
|
2896
|
+
continue;
|
|
2887
2897
|
}
|
|
2898
|
+
result.embeddedResultIndex = linesWithEmbed.length;
|
|
2899
|
+
linesWithEmbed.push(i);
|
|
2888
2900
|
}
|
|
2889
2901
|
const visibleLines = lineCache.slice(startLineIndex + 1, endLineIndex + 1);
|
|
2890
2902
|
if (linesWithEmbed.length > 0) {
|
|
@@ -11015,12 +11027,12 @@ const measureTextWidthFast = async (text, charWidth) => {
|
|
|
11015
11027
|
};
|
|
11016
11028
|
|
|
11017
11029
|
const measureTextWidthSlow = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
11018
|
-
const width = await TextMeasurementWorker.
|
|
11030
|
+
const width = await TextMeasurementWorker.measureTextWidth(text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
|
|
11019
11031
|
return width;
|
|
11020
11032
|
};
|
|
11021
11033
|
|
|
11022
11034
|
const measureTextWidthsSlow = async (texts, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
11023
|
-
return await TextMeasurementWorker.
|
|
11035
|
+
return await TextMeasurementWorker.measureTextWidths(texts, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
|
|
11024
11036
|
};
|
|
11025
11037
|
|
|
11026
11038
|
const measureTextWidth = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
@@ -11091,9 +11103,9 @@ const insertInto = (array, start, newItems) => {
|
|
|
11091
11103
|
};
|
|
11092
11104
|
|
|
11093
11105
|
/**
|
|
11094
|
-
|
|
11095
|
-
|
|
11096
|
-
|
|
11106
|
+
Alternative to the native Array.splice method, it
|
|
11107
|
+
can only support limited number of items due to the maximum call stack size limit.
|
|
11108
|
+
*/
|
|
11097
11109
|
// @ts-ignore
|
|
11098
11110
|
const spliceLargeArray = (array, start, deleteCount, newItems) => {
|
|
11099
11111
|
const result = array.splice(start, deleteCount);
|
|
@@ -11109,7 +11121,7 @@ const RE_WHITESPACE = /^\s+/;
|
|
|
11109
11121
|
|
|
11110
11122
|
// TODO this doesn't belong here
|
|
11111
11123
|
const getIndent = line => {
|
|
11112
|
-
const whitespaceMatch =
|
|
11124
|
+
const whitespaceMatch = RE_WHITESPACE.exec(line);
|
|
11113
11125
|
if (!whitespaceMatch) {
|
|
11114
11126
|
return '';
|
|
11115
11127
|
}
|
|
@@ -11360,14 +11372,16 @@ const getLineInfoEmbeddedFull = (embeddedResults, tokenResults, line, decoration
|
|
|
11360
11372
|
const relativeEnd = relativeStart + decorationLength;
|
|
11361
11373
|
|
|
11362
11374
|
// Only include decorations that overlap with this line
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
|
|
11367
|
-
|
|
11368
|
-
|
|
11369
|
-
|
|
11370
|
-
|
|
11375
|
+
const overlapsLine = relativeStart < line.length && relativeEnd > 0;
|
|
11376
|
+
if (!overlapsLine) {
|
|
11377
|
+
continue;
|
|
11378
|
+
}
|
|
11379
|
+
const decorationClassName = getDecorationClassName(decorationType);
|
|
11380
|
+
if (decorationClassName) {
|
|
11381
|
+
decorationMap.set(Math.max(0, relativeStart), {
|
|
11382
|
+
className: decorationClassName,
|
|
11383
|
+
end: Math.min(line.length, relativeEnd)
|
|
11384
|
+
});
|
|
11371
11385
|
}
|
|
11372
11386
|
}
|
|
11373
11387
|
const embeddedResult = embeddedResults[tokenResults.embeddedResultIndex];
|
|
@@ -11480,14 +11494,16 @@ const getLineInfoDefault = (line, tokenResults, embeddedResults, decorations, To
|
|
|
11480
11494
|
const relativeEnd = relativeStart + decorationLength;
|
|
11481
11495
|
|
|
11482
11496
|
// Only include decorations that overlap with this line
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11497
|
+
const overlapsLine = relativeStart < line.length && relativeEnd > 0;
|
|
11498
|
+
if (!overlapsLine) {
|
|
11499
|
+
continue;
|
|
11500
|
+
}
|
|
11501
|
+
const decorationClassName = getDecorationClassName(decorationType);
|
|
11502
|
+
if (decorationClassName) {
|
|
11503
|
+
decorationMap.set(Math.max(0, relativeStart), {
|
|
11504
|
+
className: decorationClassName,
|
|
11505
|
+
end: Math.min(line.length, relativeEnd)
|
|
11506
|
+
});
|
|
11491
11507
|
}
|
|
11492
11508
|
}
|
|
11493
11509
|
const {
|
|
@@ -11785,10 +11801,7 @@ const setDeltaY$1 = async (state, value) => {
|
|
|
11785
11801
|
const emptyIncrementalEdits = [];
|
|
11786
11802
|
|
|
11787
11803
|
const getIncrementalEdits = async (oldState, newState) => {
|
|
11788
|
-
if (newState.lifecycle?.disposed || !newState.undoStack) {
|
|
11789
|
-
return emptyIncrementalEdits;
|
|
11790
|
-
}
|
|
11791
|
-
if (oldState.undoStack === newState.undoStack) {
|
|
11804
|
+
if (newState.lifecycle?.disposed || !newState.undoStack || oldState.undoStack === newState.undoStack) {
|
|
11792
11805
|
return emptyIncrementalEdits;
|
|
11793
11806
|
}
|
|
11794
11807
|
const lastChanges = newState.undoStack.at(-1);
|
|
@@ -11839,11 +11852,11 @@ const getIncrementalEdits = async (oldState, newState) => {
|
|
|
11839
11852
|
};
|
|
11840
11853
|
|
|
11841
11854
|
/**
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
11846
|
-
|
|
11855
|
+
Gets all regex matches for a given text and regex pattern
|
|
11856
|
+
@param text The text to match against
|
|
11857
|
+
@param regex The regex pattern to use (should have global flag)
|
|
11858
|
+
@returns Array of regex matches
|
|
11859
|
+
*/
|
|
11847
11860
|
const getRegexMatches = (text, regex) => {
|
|
11848
11861
|
return text.matchAll(regex).toArray();
|
|
11849
11862
|
};
|
|
@@ -11900,10 +11913,10 @@ const trimTrailingPunctuation = url => {
|
|
|
11900
11913
|
};
|
|
11901
11914
|
|
|
11902
11915
|
/**
|
|
11903
|
-
|
|
11904
|
-
|
|
11905
|
-
|
|
11906
|
-
|
|
11916
|
+
Detects links in a given text and returns their positions
|
|
11917
|
+
@param text The text to scan for links
|
|
11918
|
+
@returns Array of links with their start position and length
|
|
11919
|
+
*/
|
|
11907
11920
|
const detectLinks = text => {
|
|
11908
11921
|
const matches = getRegexMatches(text, URL_PATTERN);
|
|
11909
11922
|
const links = [];
|
|
@@ -11922,8 +11935,8 @@ const detectLinks = text => {
|
|
|
11922
11935
|
const isValidPosition = (lines, rowIndex, columnIndex) => rowIndex >= 0 && rowIndex < lines.length && columnIndex >= 0 && columnIndex <= lines[rowIndex].length;
|
|
11923
11936
|
|
|
11924
11937
|
/**
|
|
11925
|
-
|
|
11926
|
-
|
|
11938
|
+
Converts the provider links stored on the editor into document offset ranges.
|
|
11939
|
+
*/
|
|
11927
11940
|
const getProviderLinkRanges = editor => {
|
|
11928
11941
|
const {
|
|
11929
11942
|
documentLinks,
|
|
@@ -11958,11 +11971,11 @@ const getProviderLinkRanges = editor => {
|
|
|
11958
11971
|
const overlapsAny = (offset, length, ranges) => ranges.some(range => offset < range.offset + range.length && range.offset < offset + length);
|
|
11959
11972
|
|
|
11960
11973
|
/**
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
11965
|
-
|
|
11974
|
+
Detects all links in an editor and returns them as decorations.
|
|
11975
|
+
Links from document link providers take precedence over overlapping regex-detected links.
|
|
11976
|
+
@param editor The editor containing lines to scan
|
|
11977
|
+
@returns Flat array of decorations in format [offset, length, type, modifiers, ...]
|
|
11978
|
+
*/
|
|
11966
11979
|
const detectAllLinksAsDecorations = editor => {
|
|
11967
11980
|
const decorations = [];
|
|
11968
11981
|
if (editor.largeFile) {
|
|
@@ -11978,12 +11991,13 @@ const detectAllLinksAsDecorations = editor => {
|
|
|
11978
11991
|
const links = detectLinks(line);
|
|
11979
11992
|
for (const link of links) {
|
|
11980
11993
|
const linkOffset = offset + link.start;
|
|
11981
|
-
if (providerRanges.length
|
|
11982
|
-
|
|
11983
|
-
length: link.length,
|
|
11984
|
-
offset: linkOffset
|
|
11985
|
-
});
|
|
11994
|
+
if (providerRanges.length > 0 && overlapsAny(linkOffset, link.length, providerRanges)) {
|
|
11995
|
+
continue;
|
|
11986
11996
|
}
|
|
11997
|
+
ranges.push({
|
|
11998
|
+
length: link.length,
|
|
11999
|
+
offset: linkOffset
|
|
12000
|
+
});
|
|
11987
12001
|
}
|
|
11988
12002
|
offset += line.length + 1; // +1 for newline
|
|
11989
12003
|
}
|
|
@@ -11998,11 +12012,11 @@ const detectAllLinksAsDecorations = editor => {
|
|
|
11998
12012
|
};
|
|
11999
12013
|
|
|
12000
12014
|
/**
|
|
12001
|
-
|
|
12002
|
-
|
|
12003
|
-
|
|
12004
|
-
|
|
12005
|
-
|
|
12015
|
+
Gets the document link from a document link provider at a given offset
|
|
12016
|
+
@param editor The editor
|
|
12017
|
+
@param offset The offset in the document
|
|
12018
|
+
@returns The provider link at the offset, or undefined
|
|
12019
|
+
*/
|
|
12006
12020
|
const getDocumentLinkAtOffset = (editor, offset) => {
|
|
12007
12021
|
if (editor.largeFile) {
|
|
12008
12022
|
return undefined;
|
|
@@ -12016,11 +12030,11 @@ const getDocumentLinkAtOffset = (editor, offset) => {
|
|
|
12016
12030
|
};
|
|
12017
12031
|
|
|
12018
12032
|
/**
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12033
|
+
Gets the URL text at a given offset in the editor if it's a link
|
|
12034
|
+
@param editor The editor
|
|
12035
|
+
@param offset The offset in the document
|
|
12036
|
+
@returns The URL string if the offset is on a link, or undefined
|
|
12037
|
+
*/
|
|
12024
12038
|
const getUrlAtOffset = (editor, offset) => {
|
|
12025
12039
|
const {
|
|
12026
12040
|
decorations,
|
|
@@ -12034,19 +12048,21 @@ const getUrlAtOffset = (editor, offset) => {
|
|
|
12034
12048
|
const decorationType = decorations[i + 2];
|
|
12035
12049
|
|
|
12036
12050
|
// Check if this decoration is a link and if the offset falls within it
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
|
|
12041
|
-
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12047
|
-
|
|
12048
|
-
|
|
12051
|
+
const isLinkAtOffset = decorationType === Link && offset >= decorationOffset && offset < decorationOffset + decorationLength;
|
|
12052
|
+
if (!isLinkAtOffset) {
|
|
12053
|
+
continue;
|
|
12054
|
+
}
|
|
12055
|
+
// Extract the URL text from the editor content
|
|
12056
|
+
let currentOffset = 0;
|
|
12057
|
+
for (const line of lines) {
|
|
12058
|
+
const lineLength = line.length + 1; // +1 for newline
|
|
12059
|
+
if (currentOffset + lineLength > decorationOffset) {
|
|
12060
|
+
// The link starts in this line
|
|
12061
|
+
const linkStartInLine = decorationOffset - currentOffset;
|
|
12062
|
+
const url = line.slice(linkStartInLine, linkStartInLine + decorationLength);
|
|
12063
|
+
return url;
|
|
12049
12064
|
}
|
|
12065
|
+
currentOffset += lineLength;
|
|
12050
12066
|
}
|
|
12051
12067
|
}
|
|
12052
12068
|
return undefined;
|
|
@@ -12143,7 +12159,7 @@ const getX = async (line, column, fontWeight, fontSize, fontFamily, isMonospaceF
|
|
|
12143
12159
|
const normalizedLine = normalizeText(line, normalize, tabSize);
|
|
12144
12160
|
const tabCount = getTabCount(line.slice(0, column));
|
|
12145
12161
|
const partialText = normalizedLine.slice(0, column + tabCount * (tabSize - 1));
|
|
12146
|
-
const textWidth = column === line.length
|
|
12162
|
+
const textWidth = measuredLineWidth !== undefined && column === line.length ? measuredLineWidth : await measureTextWidth(partialText, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, averageCharWidth);
|
|
12147
12163
|
return Math.min(width, textWidth - halfCursorWidth + difference);
|
|
12148
12164
|
};
|
|
12149
12165
|
|
|
@@ -12709,9 +12725,9 @@ const matchesWordPattern = (value, wordPattern) => {
|
|
|
12709
12725
|
const compareRanges = (a, b) => a.rowIndex - b.rowIndex || a.startColumnIndex - b.startColumnIndex;
|
|
12710
12726
|
|
|
12711
12727
|
/**
|
|
12712
|
-
|
|
12713
|
-
|
|
12714
|
-
|
|
12728
|
+
Converts provider ranges (document offsets) to sorted single line ranges. Returns undefined
|
|
12729
|
+
when the ranges are invalid or don't contain the given offset.
|
|
12730
|
+
*/
|
|
12715
12731
|
const toLinkedEditingRanges = (lines, ranges, offset) => {
|
|
12716
12732
|
if (!Array.isArray(ranges) || ranges.length === 0 || lines.length === 0) {
|
|
12717
12733
|
return undefined;
|
|
@@ -12767,15 +12783,15 @@ const getActiveLinkedEditing = editor => {
|
|
|
12767
12783
|
linkedEditing,
|
|
12768
12784
|
selections
|
|
12769
12785
|
} = editor;
|
|
12770
|
-
if (!linkedEditing || !editor.linkedEditingEnabled ||
|
|
12786
|
+
if (!selections || !linkedEditing || !editor.linkedEditingEnabled || selections.length !== 4 || linkedEditing.lines !== lines) {
|
|
12771
12787
|
return undefined;
|
|
12772
12788
|
}
|
|
12773
12789
|
return linkedEditing;
|
|
12774
12790
|
};
|
|
12775
12791
|
|
|
12776
12792
|
/**
|
|
12777
|
-
|
|
12778
|
-
|
|
12793
|
+
Returns the linked ranges when they are still current and the single cursor (or selection) is inside one of them.
|
|
12794
|
+
*/
|
|
12779
12795
|
const getActiveRanges = editor => {
|
|
12780
12796
|
const linkedEditing = getActiveLinkedEditing(editor);
|
|
12781
12797
|
if (!linkedEditing) {
|
|
@@ -12790,9 +12806,9 @@ const getActiveRanges = editor => {
|
|
|
12790
12806
|
const isTypingChange = change => change.origin === EditorType && change.deleted.length === 1 && change.deleted[0] === '' && change.inserted[0].length > 0;
|
|
12791
12807
|
|
|
12792
12808
|
/**
|
|
12793
|
-
|
|
12794
|
-
|
|
12795
|
-
|
|
12809
|
+
Applies a single line edit inside one linked range to all other linked ranges.
|
|
12810
|
+
Returns undefined when the edit can't be mirrored, which ends linked editing.
|
|
12811
|
+
*/
|
|
12796
12812
|
const getLinkedEdit = (editor, changes, selectionChanges) => {
|
|
12797
12813
|
const linkedEditing = getActiveLinkedEditing(editor);
|
|
12798
12814
|
if (!linkedEditing || changes.length !== 1) {
|
|
@@ -12885,8 +12901,8 @@ const getLinkedEdit = (editor, changes, selectionChanges) => {
|
|
|
12885
12901
|
};
|
|
12886
12902
|
|
|
12887
12903
|
/**
|
|
12888
|
-
|
|
12889
|
-
|
|
12904
|
+
Merges consecutive linked typing edits into one undo step, like single cursor typing.
|
|
12905
|
+
*/
|
|
12890
12906
|
const mergeTypingGroups = (previous, changes) => {
|
|
12891
12907
|
if (!previous || previous.length !== changes.length || previous.length < 2) {
|
|
12892
12908
|
return undefined;
|
|
@@ -12942,10 +12958,10 @@ const flush = async delivery => {
|
|
|
12942
12958
|
}
|
|
12943
12959
|
let update = status;
|
|
12944
12960
|
if (delivery.hasBaseline) {
|
|
12945
|
-
if (!
|
|
12961
|
+
if (!status && !delivery.baseline) {
|
|
12946
12962
|
continue;
|
|
12947
12963
|
}
|
|
12948
|
-
if (delivery.baseline
|
|
12964
|
+
if (status && delivery.baseline) {
|
|
12949
12965
|
const delta = getDelta(delivery.baseline, status);
|
|
12950
12966
|
if (Object.keys(delta).length === 0) {
|
|
12951
12967
|
continue;
|
|
@@ -12983,10 +12999,11 @@ const start = delivery => {
|
|
|
12983
12999
|
};
|
|
12984
13000
|
const dispose$5 = rpcId => {
|
|
12985
13001
|
const delivery = deliveries.get(rpcId);
|
|
12986
|
-
if (delivery) {
|
|
12987
|
-
|
|
12988
|
-
deliveries.delete(rpcId);
|
|
13002
|
+
if (!delivery) {
|
|
13003
|
+
return;
|
|
12989
13004
|
}
|
|
13005
|
+
delivery.disposed = true;
|
|
13006
|
+
deliveries.delete(rpcId);
|
|
12990
13007
|
};
|
|
12991
13008
|
const send = (rpcId, rpc, status) => {
|
|
12992
13009
|
let delivery = deliveries.get(rpcId);
|
|
@@ -13012,10 +13029,10 @@ const send = (rpcId, rpc, status) => {
|
|
|
13012
13029
|
const state$9 = Object.create(null);
|
|
13013
13030
|
|
|
13014
13031
|
/**
|
|
13015
|
-
|
|
13016
|
-
|
|
13017
|
-
|
|
13018
|
-
|
|
13032
|
+
Register a listener for a specific event type
|
|
13033
|
+
@param listenerType - The type of event to listen for
|
|
13034
|
+
@param rpcId - The RPC ID of the listener
|
|
13035
|
+
*/
|
|
13019
13036
|
const registerListener$1 = (listenerType, rpcId) => {
|
|
13020
13037
|
number(listenerType);
|
|
13021
13038
|
number(rpcId);
|
|
@@ -13030,40 +13047,41 @@ const registerListener$1 = (listenerType, rpcId) => {
|
|
|
13030
13047
|
};
|
|
13031
13048
|
|
|
13032
13049
|
/**
|
|
13033
|
-
|
|
13034
|
-
|
|
13035
|
-
|
|
13036
|
-
|
|
13050
|
+
Unregister a listener for a specific event type
|
|
13051
|
+
@param listenerType - The type of event to listen for
|
|
13052
|
+
@param rpcId - The RPC ID of the listener
|
|
13053
|
+
*/
|
|
13037
13054
|
const unregisterListener$1 = (listenerType, rpcId) => {
|
|
13038
13055
|
number(listenerType);
|
|
13039
13056
|
number(rpcId);
|
|
13040
13057
|
if (listenerType === EditorSelection$1) {
|
|
13041
13058
|
dispose$5(rpcId);
|
|
13042
13059
|
}
|
|
13043
|
-
if (Object.hasOwn(state$9, listenerType)) {
|
|
13044
|
-
|
|
13045
|
-
|
|
13046
|
-
|
|
13047
|
-
|
|
13060
|
+
if (!Object.hasOwn(state$9, listenerType)) {
|
|
13061
|
+
return;
|
|
13062
|
+
}
|
|
13063
|
+
const index = state$9[listenerType].indexOf(rpcId);
|
|
13064
|
+
if (index !== -1) {
|
|
13065
|
+
state$9[listenerType].splice(index, 1);
|
|
13048
13066
|
}
|
|
13049
13067
|
};
|
|
13050
13068
|
|
|
13051
13069
|
/**
|
|
13052
|
-
|
|
13053
|
-
|
|
13054
|
-
|
|
13055
|
-
|
|
13070
|
+
Get all registered listeners for a specific event type
|
|
13071
|
+
@param listenerType - The type of event
|
|
13072
|
+
@returns Array of RPC IDs
|
|
13073
|
+
*/
|
|
13056
13074
|
const getListeners = listenerType => {
|
|
13057
13075
|
number(listenerType);
|
|
13058
13076
|
return state$9[listenerType] || [];
|
|
13059
13077
|
};
|
|
13060
13078
|
|
|
13061
13079
|
/**
|
|
13062
|
-
|
|
13063
|
-
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
|
|
13080
|
+
Notify all registered listeners of a specific event type
|
|
13081
|
+
@param listenerType - The type of event that occurred
|
|
13082
|
+
@param method - The method name to invoke on the listener
|
|
13083
|
+
@param params - Parameters to pass to the listener method
|
|
13084
|
+
*/
|
|
13067
13085
|
const notifyListeners = async (listenerType, method, ...params) => {
|
|
13068
13086
|
number(listenerType);
|
|
13069
13087
|
string(method);
|
|
@@ -13290,7 +13308,7 @@ const enqueue = async (uid, callback) => {
|
|
|
13290
13308
|
};
|
|
13291
13309
|
|
|
13292
13310
|
const logError = async (error, prefix) => {
|
|
13293
|
-
const prettyError = await ErrorWorker.
|
|
13311
|
+
const prettyError = await ErrorWorker.prepare(error);
|
|
13294
13312
|
await ErrorWorker.invoke('Errors.print', prettyError, prefix);
|
|
13295
13313
|
};
|
|
13296
13314
|
const logFallback = (error, prefix) => {
|
|
@@ -13381,9 +13399,9 @@ const getVisibleDiagnostics = async (editor, diagnostics) => {
|
|
|
13381
13399
|
const invoke$7 = (...args) => RendererWorker.invoke(...args);
|
|
13382
13400
|
|
|
13383
13401
|
/**
|
|
13384
|
-
|
|
13385
|
-
|
|
13386
|
-
|
|
13402
|
+
Merges link decorations with diagnostic decorations
|
|
13403
|
+
Links should always be present, but we also need to include any diagnostic decorations
|
|
13404
|
+
*/
|
|
13387
13405
|
const mergeLinksWithDiagnosticDecorations = (editor, diagnosticDecorations) => {
|
|
13388
13406
|
// Get link decorations
|
|
13389
13407
|
const linkDecorations = detectAllLinksAsDecorations(editor);
|
|
@@ -13623,18 +13641,19 @@ const updateDiagnostics = async (editor, timeoutMs = 0) => {
|
|
|
13623
13641
|
if (finished) {
|
|
13624
13642
|
return;
|
|
13625
13643
|
}
|
|
13626
|
-
if (
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
diagnostics: response,
|
|
13632
|
-
providerIndex: 0
|
|
13633
|
-
});
|
|
13634
|
-
await commitDiagnostics(editor, generation, response, () => saveProviderResults(editor, providers));
|
|
13635
|
-
port1.close();
|
|
13636
|
-
completed.resolve();
|
|
13644
|
+
if (!(providerCount === -1 && Array.isArray(response))) {
|
|
13645
|
+
return;
|
|
13646
|
+
}
|
|
13647
|
+
if (strict) {
|
|
13648
|
+
throw new Error('Diagnostic provider does not support completion and error reporting');
|
|
13637
13649
|
}
|
|
13650
|
+
providers.set('legacy', {
|
|
13651
|
+
diagnostics: response,
|
|
13652
|
+
providerIndex: 0
|
|
13653
|
+
});
|
|
13654
|
+
await commitDiagnostics(editor, generation, response, () => saveProviderResults(editor, providers));
|
|
13655
|
+
port1.close();
|
|
13656
|
+
completed.resolve();
|
|
13638
13657
|
};
|
|
13639
13658
|
try {
|
|
13640
13659
|
await Promise.all([request(), completed.promise]);
|
|
@@ -13735,7 +13754,7 @@ const applyAutoClosingRangesEdit = (editor, changes) => {
|
|
|
13735
13754
|
const autoStartColumnIndex = autoClosingRanges[i + 1];
|
|
13736
13755
|
const autoEndRowIndex = autoClosingRanges[i + 2];
|
|
13737
13756
|
const autoEndColumnIndex = autoClosingRanges[i + 3];
|
|
13738
|
-
if (changeEndRowIndex === autoEndRowIndex && changeEndColumnIndex === autoEndColumnIndex || changeStartRowIndex === autoStartRowIndex &&
|
|
13757
|
+
if (changeEndRowIndex === autoEndRowIndex && changeEndColumnIndex === autoEndColumnIndex || changeStartRowIndex === autoStartRowIndex && changeEndRowIndex === autoEndRowIndex && changeStartColumnIndex >= autoStartColumnIndex && changeEndColumnIndex <= autoEndColumnIndex) {
|
|
13739
13758
|
const delta = change.inserted[0].length - change.deleted[0].length;
|
|
13740
13759
|
newAutoClosingRanges.push(autoStartRowIndex, autoStartColumnIndex, autoEndRowIndex, autoEndColumnIndex + delta);
|
|
13741
13760
|
}
|
|
@@ -13772,13 +13791,16 @@ const updateLines = (editor, lines) => {
|
|
|
13772
13791
|
};
|
|
13773
13792
|
|
|
13774
13793
|
/**
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
|
|
13779
|
-
|
|
13780
|
-
|
|
13781
|
-
const scheduleDocumentAndCursorsSelections = async (editor, changes,
|
|
13794
|
+
TODO make this synchronous maybe?
|
|
13795
|
+
@param {any} editor
|
|
13796
|
+
@param {any[]} changes
|
|
13797
|
+
@param {Uint32Array|undefined} selectionChanges
|
|
13798
|
+
@returns
|
|
13799
|
+
*/
|
|
13800
|
+
const scheduleDocumentAndCursorsSelections = async (editor, changes, {
|
|
13801
|
+
options = {},
|
|
13802
|
+
selectionChanges = undefined
|
|
13803
|
+
} = {}) => {
|
|
13782
13804
|
object(editor);
|
|
13783
13805
|
array(changes);
|
|
13784
13806
|
if (changes.length === 0) {
|
|
@@ -13815,7 +13837,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
13815
13837
|
const canCoalesceTyping = linkedEdit ? linkedEdit.canCoalesceTyping : changes.length === 1 && change.origin === EditorType && change.deleted[0] === '' && change.inserted[0].length > 0 && change.inserted.length === 1 && change.start.rowIndex === change.end.rowIndex && change.start.columnIndex === change.end.columnIndex;
|
|
13816
13838
|
const previousGroup = editor.undoStack.at(-1);
|
|
13817
13839
|
const previous = previousGroup?.[0];
|
|
13818
|
-
const mergedLinkedGroup = linkedEdit &&
|
|
13840
|
+
const mergedLinkedGroup = linkedEdit && canCoalesceTyping && editor.canCoalesceTyping ? mergeTypingGroups(previousGroup, changes) : undefined;
|
|
13819
13841
|
if (mergedLinkedGroup) {
|
|
13820
13842
|
Object.defineProperty(mergedLinkedGroup, 'selectionHistory', {
|
|
13821
13843
|
configurable: true,
|
|
@@ -14562,9 +14584,7 @@ const findEnclosingBrackets = (lines, rowIndex, columnIndex) => {
|
|
|
14562
14584
|
});
|
|
14563
14585
|
} else if (isClosingBracket(character)) {
|
|
14564
14586
|
const openingBracket = stack.at(-1);
|
|
14565
|
-
if (
|
|
14566
|
-
stack.length = 0;
|
|
14567
|
-
} else {
|
|
14587
|
+
if (openingBracket && openingBracket.character === openingBrackets[character]) {
|
|
14568
14588
|
stack.pop();
|
|
14569
14589
|
if (!enclosingPair && isBefore$1(openingBracket.position, cursor) && isBefore$1(cursor, position)) {
|
|
14570
14590
|
enclosingPair = {
|
|
@@ -14573,6 +14593,8 @@ const findEnclosingBrackets = (lines, rowIndex, columnIndex) => {
|
|
|
14573
14593
|
sourceIsBeforeCursor: false
|
|
14574
14594
|
};
|
|
14575
14595
|
}
|
|
14596
|
+
} else {
|
|
14597
|
+
stack.length = 0;
|
|
14576
14598
|
}
|
|
14577
14599
|
}
|
|
14578
14600
|
}
|
|
@@ -14727,9 +14749,9 @@ const isSingleCursorIn = (highlights, selections) => {
|
|
|
14727
14749
|
};
|
|
14728
14750
|
|
|
14729
14751
|
/**
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
|
-
|
|
14752
|
+
Highlights are cleared on edits until the provider refreshes them. Moving the cursor
|
|
14753
|
+
inside a highlighted range keeps them to avoid flicker while a new request is pending.
|
|
14754
|
+
*/
|
|
14733
14755
|
const getRetainedDocumentHighlights = (oldState, newState) => {
|
|
14734
14756
|
const highlights = newState.documentHighlights || emptyDocumentHighlights;
|
|
14735
14757
|
if (highlights.length === 0 || !newState.documentHighlightsEnabled) {
|
|
@@ -14822,10 +14844,11 @@ const getVisibleDocumentHighlights = async editor => {
|
|
|
14822
14844
|
const to = Math.min(highlight.endRowIndex, lastVisibleRow, lines.length - 1);
|
|
14823
14845
|
for (let rowIndex = from; rowIndex <= to; rowIndex++) {
|
|
14824
14846
|
const visibleIndex = visibleIndexByRow.get(rowIndex);
|
|
14825
|
-
if (visibleIndex
|
|
14826
|
-
|
|
14827
|
-
pending.push(getInfo(editor, highlight, rowIndex, differences?.[visibleIndex] ?? 0, y));
|
|
14847
|
+
if (visibleIndex === undefined) {
|
|
14848
|
+
continue;
|
|
14828
14849
|
}
|
|
14850
|
+
const y = (getVisualRow(rowIndex) - startVisualRow) * rowHeight;
|
|
14851
|
+
pending.push(getInfo(editor, highlight, rowIndex, differences?.[visibleIndex] ?? 0, y));
|
|
14829
14852
|
}
|
|
14830
14853
|
}
|
|
14831
14854
|
const infos = await Promise.all(pending);
|
|
@@ -15052,7 +15075,10 @@ const getColorPickerWorkerCommandMap = () => ({
|
|
|
15052
15075
|
|
|
15053
15076
|
const ModuleWorkerAndWorkaroundForChromeDevtoolsBug = 6;
|
|
15054
15077
|
|
|
15055
|
-
const launchWorker = async (name, url,
|
|
15078
|
+
const launchWorker = async (name, url, {
|
|
15079
|
+
commandMap = {},
|
|
15080
|
+
intializeCommand
|
|
15081
|
+
} = {}) => {
|
|
15056
15082
|
const rpc = await create$c({
|
|
15057
15083
|
commandMap,
|
|
15058
15084
|
isMessagePortOpen: true,
|
|
@@ -15075,7 +15101,9 @@ const launchWorker = async (name, url, intializeCommand, commandMap = {}) => {
|
|
|
15075
15101
|
const launchColorPickerWorker = async () => {
|
|
15076
15102
|
const name = 'Color Picker Worker';
|
|
15077
15103
|
const url = 'colorPickerWorkerMain.js';
|
|
15078
|
-
return launchWorker(name, url,
|
|
15104
|
+
return launchWorker(name, url, {
|
|
15105
|
+
commandMap: getColorPickerWorkerCommandMap()
|
|
15106
|
+
});
|
|
15079
15107
|
};
|
|
15080
15108
|
|
|
15081
15109
|
const state$8 = {};
|
|
@@ -15169,7 +15197,7 @@ const isCurrent$1 = (snapshot, current) => {
|
|
|
15169
15197
|
return true;
|
|
15170
15198
|
};
|
|
15171
15199
|
const merge = (current, snapshot, result) => {
|
|
15172
|
-
if (
|
|
15200
|
+
if (result === snapshot || result === current || !isCurrent$1(snapshot, current)) {
|
|
15173
15201
|
return current;
|
|
15174
15202
|
}
|
|
15175
15203
|
if (current === snapshot) {
|
|
@@ -15607,7 +15635,10 @@ const applyDocumentEdits$1 = (editor, edits, options = {}) => {
|
|
|
15607
15635
|
...editor
|
|
15608
15636
|
}, documentEdits);
|
|
15609
15637
|
const selections = getFormattingSelections(editor.lines, newLines, editor.selections);
|
|
15610
|
-
return scheduleDocumentAndCursorsSelections(editor, documentEdits,
|
|
15638
|
+
return scheduleDocumentAndCursorsSelections(editor, documentEdits, {
|
|
15639
|
+
options,
|
|
15640
|
+
selectionChanges: selections
|
|
15641
|
+
});
|
|
15611
15642
|
};
|
|
15612
15643
|
|
|
15613
15644
|
const getFormattingEdits$1 = async editor => {
|
|
@@ -15856,8 +15887,8 @@ const at = async (editor, eventX, eventY) => {
|
|
|
15856
15887
|
};
|
|
15857
15888
|
|
|
15858
15889
|
/**
|
|
15859
|
-
|
|
15860
|
-
|
|
15890
|
+
@deprecated this doesn't account for variable-width characters, gutters, or horizontal scrolling.
|
|
15891
|
+
*/
|
|
15861
15892
|
const x = (editor, rowIndex, columnIndex) => {
|
|
15862
15893
|
const {
|
|
15863
15894
|
columnWidth,
|
|
@@ -15896,14 +15927,14 @@ const y = (editor, rowIndex) => {
|
|
|
15896
15927
|
const defaultMessageDelay = 3000;
|
|
15897
15928
|
|
|
15898
15929
|
/**
|
|
15899
|
-
|
|
15900
|
-
|
|
15901
|
-
|
|
15902
|
-
|
|
15903
|
-
|
|
15904
|
-
|
|
15905
|
-
|
|
15906
|
-
|
|
15930
|
+
|
|
15931
|
+
@param {any} editor
|
|
15932
|
+
@param {number} rowIndex
|
|
15933
|
+
@param {number} columnIndex
|
|
15934
|
+
@param {string} message
|
|
15935
|
+
@param {boolean} isError
|
|
15936
|
+
@returns
|
|
15937
|
+
*/
|
|
15907
15938
|
// @ts-ignore
|
|
15908
15939
|
const editorShowMessage = async (editor, rowIndex, columnIndex, message, _isError) => {
|
|
15909
15940
|
object(editor);
|
|
@@ -15956,13 +15987,13 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, _isErro
|
|
|
15956
15987
|
};
|
|
15957
15988
|
|
|
15958
15989
|
/**
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
|
|
15964
|
-
|
|
15965
|
-
|
|
15990
|
+
|
|
15991
|
+
@param {any} editor
|
|
15992
|
+
@param {number} rowIndex
|
|
15993
|
+
@param {number} columnIndex
|
|
15994
|
+
@param {string} message
|
|
15995
|
+
@returns
|
|
15996
|
+
*/
|
|
15966
15997
|
// @ts-ignore
|
|
15967
15998
|
const showErrorMessage = async (editor, rowIndex, columnIndex, message) => {
|
|
15968
15999
|
return await editorShowMessage(editor, rowIndex, columnIndex, message);
|
|
@@ -16008,7 +16039,7 @@ const applyLineEndings = (content, endOfLine) => {
|
|
|
16008
16039
|
};
|
|
16009
16040
|
|
|
16010
16041
|
const getNewEditor = async (editor, skipFormatting = false) => {
|
|
16011
|
-
if (editor.formatOnSave
|
|
16042
|
+
if (!skipFormatting && editor.formatOnSave) {
|
|
16012
16043
|
return format(editor);
|
|
16013
16044
|
}
|
|
16014
16045
|
return editor;
|
|
@@ -16283,10 +16314,11 @@ const request$2 = async uid => {
|
|
|
16283
16314
|
};
|
|
16284
16315
|
const cancel = uid => {
|
|
16285
16316
|
const timeout = timeouts$2.get(uid);
|
|
16286
|
-
if (timeout
|
|
16287
|
-
|
|
16288
|
-
timeouts$2.delete(uid);
|
|
16317
|
+
if (timeout === undefined) {
|
|
16318
|
+
return;
|
|
16289
16319
|
}
|
|
16320
|
+
clearTimeout(timeout);
|
|
16321
|
+
timeouts$2.delete(uid);
|
|
16290
16322
|
};
|
|
16291
16323
|
const scheduleIfChanged = (oldState, newState) => {
|
|
16292
16324
|
const {
|
|
@@ -16309,8 +16341,8 @@ const scheduleIfChanged = (oldState, newState) => {
|
|
|
16309
16341
|
const isValidLink = (link, textLength) => Boolean(link) && Number.isSafeInteger(link.startOffset) && Number.isSafeInteger(link.endOffset) && link.startOffset >= 0 && link.startOffset < link.endOffset && link.endOffset <= textLength && typeof link.target === 'string' && link.target.length > 0;
|
|
16310
16342
|
|
|
16311
16343
|
/**
|
|
16312
|
-
|
|
16313
|
-
|
|
16344
|
+
Converts provider offsets (end exclusive) into row/column ranges in one pass over the lines.
|
|
16345
|
+
*/
|
|
16314
16346
|
const toDocumentLinks = (lines, result) => {
|
|
16315
16347
|
if (!Array.isArray(result) || result.length === 0) {
|
|
16316
16348
|
return [];
|
|
@@ -16379,8 +16411,8 @@ const linksEqual = (left, right) => left.length === right.length && left.every((
|
|
|
16379
16411
|
});
|
|
16380
16412
|
|
|
16381
16413
|
/**
|
|
16382
|
-
|
|
16383
|
-
|
|
16414
|
+
Replaces the link decorations of an editor, keeping other decorations such as diagnostics.
|
|
16415
|
+
*/
|
|
16384
16416
|
const updateLinkDecorations = editor => {
|
|
16385
16417
|
const linkDecorations = detectAllLinksAsDecorations(editor);
|
|
16386
16418
|
const decorations = editor.decorations || [];
|
|
@@ -16450,10 +16482,11 @@ const schedule$2 = (uid, delay) => {
|
|
|
16450
16482
|
};
|
|
16451
16483
|
const clear$3 = uid => {
|
|
16452
16484
|
const timeout = timeouts$1.get(uid);
|
|
16453
|
-
if (timeout
|
|
16454
|
-
|
|
16455
|
-
timeouts$1.delete(uid);
|
|
16485
|
+
if (timeout === undefined) {
|
|
16486
|
+
return;
|
|
16456
16487
|
}
|
|
16488
|
+
clearTimeout(timeout);
|
|
16489
|
+
timeouts$1.delete(uid);
|
|
16457
16490
|
};
|
|
16458
16491
|
const requestIfChanged$1 = (oldState, newState) => {
|
|
16459
16492
|
if (newState.initial || newState.largeFile || newState.loadError) {
|
|
@@ -16533,9 +16566,9 @@ const schedule$1 = uid => {
|
|
|
16533
16566
|
};
|
|
16534
16567
|
|
|
16535
16568
|
/**
|
|
16536
|
-
|
|
16537
|
-
|
|
16538
|
-
|
|
16569
|
+
Fetches linked editing ranges (debounced) after the cursor or the document changed,
|
|
16570
|
+
unless the cursor is still inside the current linked ranges.
|
|
16571
|
+
*/
|
|
16539
16572
|
const requestIfChanged = (oldState, newState) => {
|
|
16540
16573
|
if (newState.linkedEditingEnabled !== true || newState.initial || newState.largeFile || newState.loadError || !newState.selections || newState.selections.length !== 4) {
|
|
16541
16574
|
return;
|
|
@@ -16709,10 +16742,11 @@ const schedule = editor => {
|
|
|
16709
16742
|
refreshes.set(lifecycle, request);
|
|
16710
16743
|
}
|
|
16711
16744
|
request.pending = editor;
|
|
16712
|
-
if (
|
|
16713
|
-
|
|
16714
|
-
void refresh(request);
|
|
16745
|
+
if (request.running) {
|
|
16746
|
+
return;
|
|
16715
16747
|
}
|
|
16748
|
+
request.running = true;
|
|
16749
|
+
void refresh(request);
|
|
16716
16750
|
};
|
|
16717
16751
|
|
|
16718
16752
|
const stateCommands = new WeakSet() ;
|
|
@@ -16832,7 +16866,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
16832
16866
|
...newEditor,
|
|
16833
16867
|
cursorUndoStack: []
|
|
16834
16868
|
};
|
|
16835
|
-
} else if (selections && newEditor.selections &&
|
|
16869
|
+
} else if (!isSelecting && selections && newEditor.selections && newEditor.cursorUndoStack === cursorUndoStack && (!selectionsEqual(selections, newEditor.selections) || newEditor.isSelecting)) {
|
|
16836
16870
|
const previousCursorUndoStack = cursorUndoStack || [];
|
|
16837
16871
|
newEditor = {
|
|
16838
16872
|
...newEditor,
|
|
@@ -17732,10 +17766,11 @@ const diff2 = uid => {
|
|
|
17732
17766
|
const dismissals = new Map();
|
|
17733
17767
|
const clear$2 = editorUid => {
|
|
17734
17768
|
const dismissal = dismissals.get(editorUid);
|
|
17735
|
-
if (dismissal) {
|
|
17736
|
-
|
|
17737
|
-
dismissals.delete(editorUid);
|
|
17769
|
+
if (!dismissal) {
|
|
17770
|
+
return;
|
|
17738
17771
|
}
|
|
17772
|
+
clearTimeout(dismissal.timeout);
|
|
17773
|
+
dismissals.delete(editorUid);
|
|
17739
17774
|
};
|
|
17740
17775
|
const set$3 = (editorUid, dismissal) => {
|
|
17741
17776
|
clear$2(editorUid);
|
|
@@ -18389,7 +18424,9 @@ const acceptMergeConflict = async (state, action, rowIndexValue) => {
|
|
|
18389
18424
|
inserted,
|
|
18390
18425
|
origin: Unknown$2,
|
|
18391
18426
|
start
|
|
18392
|
-
}],
|
|
18427
|
+
}], {
|
|
18428
|
+
selectionChanges: selections
|
|
18429
|
+
});
|
|
18393
18430
|
return {
|
|
18394
18431
|
...result,
|
|
18395
18432
|
incrementalEdits: emptyIncrementalEdits
|
|
@@ -18457,7 +18494,9 @@ const addCursorBelow = editor => {
|
|
|
18457
18494
|
const applyEdit = async (editor, changes, selectionChanges) => {
|
|
18458
18495
|
object(editor);
|
|
18459
18496
|
array(changes);
|
|
18460
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
18497
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
18498
|
+
selectionChanges
|
|
18499
|
+
});
|
|
18461
18500
|
};
|
|
18462
18501
|
|
|
18463
18502
|
const isPersistentWidget = widgetId => {
|
|
@@ -18863,7 +18902,9 @@ const changeSelectedValue = async (editor, delta) => {
|
|
|
18863
18902
|
rowDeltas.set(target.rowIndex, columnDelta + replacement.length - target.value.length);
|
|
18864
18903
|
}
|
|
18865
18904
|
const newSelections = getNewSelections$b(editor, selectionTargetsWithChanges, changedTargets, replacements);
|
|
18866
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
18905
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
18906
|
+
selectionChanges: newSelections
|
|
18907
|
+
});
|
|
18867
18908
|
};
|
|
18868
18909
|
|
|
18869
18910
|
const decrementSelection = editor => {
|
|
@@ -18933,10 +18974,9 @@ const closeRename = async editor => {
|
|
|
18933
18974
|
}
|
|
18934
18975
|
const renameWidget = widgets[renameWidgetIndex];
|
|
18935
18976
|
await invoke$5('Rename.close', renameWidget.newState.uid);
|
|
18936
|
-
const latest = get$a(uid);
|
|
18937
18977
|
const {
|
|
18938
18978
|
newState
|
|
18939
|
-
} =
|
|
18979
|
+
} = get$a(uid);
|
|
18940
18980
|
return {
|
|
18941
18981
|
...newState,
|
|
18942
18982
|
widgetRevision: Math.max(newState.widgetRevision || 0, widgetRevision)
|
|
@@ -19167,7 +19207,7 @@ const getCopyLineOperations = selections => {
|
|
|
19167
19207
|
const operations = [];
|
|
19168
19208
|
for (let i = 0; i < selections.length; i += 4) {
|
|
19169
19209
|
const [startRowIndex,, selectionEndRowIndex, endColumnIndex] = getSelectionPairs(selections, i);
|
|
19170
|
-
const endRowIndex =
|
|
19210
|
+
const endRowIndex = endColumnIndex === 0 && startRowIndex < selectionEndRowIndex ? selectionEndRowIndex - 1 : selectionEndRowIndex;
|
|
19171
19211
|
operations.push({
|
|
19172
19212
|
endRowIndex,
|
|
19173
19213
|
startRowIndex
|
|
@@ -19227,7 +19267,9 @@ const copyLineDown = async editor => {
|
|
|
19227
19267
|
selectionChanges[i + 2] = selections[i + 2] + getRowOffset(selections[i + 2]);
|
|
19228
19268
|
selectionChanges[i + 3] = selections[i + 3];
|
|
19229
19269
|
}
|
|
19230
|
-
const newEditor = await scheduleDocumentAndCursorsSelections(editor, changes,
|
|
19270
|
+
const newEditor = await scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
19271
|
+
selectionChanges
|
|
19272
|
+
});
|
|
19231
19273
|
return typeof newEditor.finalDeltaY === 'number' ? scheduleSelections(newEditor, selectionChanges) : newEditor;
|
|
19232
19274
|
};
|
|
19233
19275
|
|
|
@@ -19256,10 +19298,7 @@ const getLineLength = line => {
|
|
|
19256
19298
|
/* eslint-disable sonarjs/super-linear-regex */
|
|
19257
19299
|
|
|
19258
19300
|
const characterLeft = (line, columnIndex) => {
|
|
19259
|
-
if (!supported()) {
|
|
19260
|
-
return 1;
|
|
19261
|
-
}
|
|
19262
|
-
if (columnIndex > line.length) {
|
|
19301
|
+
if (!supported() || columnIndex > line.length) {
|
|
19263
19302
|
return 1;
|
|
19264
19303
|
}
|
|
19265
19304
|
const segmenter = create$8();
|
|
@@ -19788,10 +19827,11 @@ const cutLine = async editor => {
|
|
|
19788
19827
|
const rows = [];
|
|
19789
19828
|
for (let i = 0; i < selections.length; i += 4) {
|
|
19790
19829
|
const [startRowIndex] = getSelectionPairs(selections, i);
|
|
19791
|
-
if (
|
|
19792
|
-
|
|
19793
|
-
rows.push(startRowIndex);
|
|
19830
|
+
if (seenRows.has(startRowIndex)) {
|
|
19831
|
+
continue;
|
|
19794
19832
|
}
|
|
19833
|
+
seenRows.add(startRowIndex);
|
|
19834
|
+
rows.push(startRowIndex);
|
|
19795
19835
|
}
|
|
19796
19836
|
rows.sort((a, b) => a - b);
|
|
19797
19837
|
const ranges = [];
|
|
@@ -19811,7 +19851,7 @@ const cutLine = async editor => {
|
|
|
19811
19851
|
}
|
|
19812
19852
|
const previous = ranges.at(-1);
|
|
19813
19853
|
if (previous && (range[0] < previous[2] || range[0] === previous[2] && range[1] <= previous[3])) {
|
|
19814
|
-
if (row === lines.length - 1 &&
|
|
19854
|
+
if (line === '' && row === lines.length - 1 && previous[0] > 0 && lines[previous[0]] === '') {
|
|
19815
19855
|
previous[0]--;
|
|
19816
19856
|
previous[1] = lines[previous[0]].length;
|
|
19817
19857
|
}
|
|
@@ -19848,7 +19888,9 @@ const cutLine = async editor => {
|
|
|
19848
19888
|
selectionChanges[i * 4 + 2] = cursorRow;
|
|
19849
19889
|
}
|
|
19850
19890
|
await writeText(joinLines(cutLines));
|
|
19851
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
19891
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
19892
|
+
selectionChanges
|
|
19893
|
+
});
|
|
19852
19894
|
};
|
|
19853
19895
|
|
|
19854
19896
|
const cutSelectedText = async editor => {
|
|
@@ -19925,10 +19967,7 @@ const getChanges$5 = (lines, selections, getDelta) => {
|
|
|
19925
19967
|
};
|
|
19926
19968
|
|
|
19927
19969
|
const isAutoClosingPairDelete = (autoClosingRanges, startRowIndex, startColumnIndex, endRowIndex, endColumnIndex) => {
|
|
19928
|
-
if (!isEmpty$1(startRowIndex, startColumnIndex, endRowIndex, endColumnIndex)) {
|
|
19929
|
-
return false;
|
|
19930
|
-
}
|
|
19931
|
-
if (startColumnIndex < 1) {
|
|
19970
|
+
if (!isEmpty$1(startRowIndex, startColumnIndex, endRowIndex, endColumnIndex) || startColumnIndex < 1) {
|
|
19932
19971
|
return false;
|
|
19933
19972
|
}
|
|
19934
19973
|
for (let j = 0; j < autoClosingRanges.length; j += 4) {
|
|
@@ -20046,7 +20085,7 @@ const getDeleteLineOperations = selections => {
|
|
|
20046
20085
|
const operations = [];
|
|
20047
20086
|
for (let i = 0; i < selections.length; i += 4) {
|
|
20048
20087
|
const [startRowIndex,, selectionEndRowIndex, endColumnIndex] = getSelectionPairs(selections, i);
|
|
20049
|
-
const endRowIndex =
|
|
20088
|
+
const endRowIndex = endColumnIndex === 0 && startRowIndex < selectionEndRowIndex ? selectionEndRowIndex - 1 : selectionEndRowIndex;
|
|
20050
20089
|
operations.push({
|
|
20051
20090
|
endRowIndex,
|
|
20052
20091
|
positionColumnIndex: selections[i + 3],
|
|
@@ -20126,7 +20165,9 @@ const deleteLine$1 = async editor => {
|
|
|
20126
20165
|
selectionChanges[offset + 3] = cursorColumnIndex;
|
|
20127
20166
|
linesDeleted += operation.endRowIndex - operation.startRowIndex + 1;
|
|
20128
20167
|
}
|
|
20129
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
20168
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
20169
|
+
selectionChanges
|
|
20170
|
+
});
|
|
20130
20171
|
};
|
|
20131
20172
|
|
|
20132
20173
|
const deleteWordLeft = editor => {
|
|
@@ -20148,8 +20189,7 @@ const deleteWordRight = editor => {
|
|
|
20148
20189
|
};
|
|
20149
20190
|
|
|
20150
20191
|
const findAllReferences$1 = async editor => {
|
|
20151
|
-
|
|
20152
|
-
await RendererWorker.invoke('SideBar.show', 'References', /* focus */true);
|
|
20192
|
+
await RendererWorker.showSideBar('References', /* focus */true);
|
|
20153
20193
|
return editor;
|
|
20154
20194
|
};
|
|
20155
20195
|
|
|
@@ -20272,9 +20312,9 @@ const RE_WORD_START$1 = /^[\w\-]+/;
|
|
|
20272
20312
|
const RE_WORD_END$1 = /[\w\-]+$/;
|
|
20273
20313
|
const getWordAt$2 = (line, columnIndex) => {
|
|
20274
20314
|
const before = line.slice(0, columnIndex);
|
|
20275
|
-
const matchBefore =
|
|
20315
|
+
const matchBefore = RE_WORD_END$1.exec(before);
|
|
20276
20316
|
const after = line.slice(columnIndex);
|
|
20277
|
-
const matchAfter =
|
|
20317
|
+
const matchAfter = RE_WORD_START$1.exec(after);
|
|
20278
20318
|
let word = EmptyString;
|
|
20279
20319
|
if (matchBefore) {
|
|
20280
20320
|
word += matchBefore[0];
|
|
@@ -20288,7 +20328,7 @@ const getWordAt$2 = (line, columnIndex) => {
|
|
|
20288
20328
|
};
|
|
20289
20329
|
const getWordBefore$1 = (line, columnIndex) => {
|
|
20290
20330
|
const before = line.slice(0, columnIndex);
|
|
20291
|
-
const matchBefore =
|
|
20331
|
+
const matchBefore = RE_WORD_END$1.exec(before);
|
|
20292
20332
|
if (matchBefore) {
|
|
20293
20333
|
return matchBefore[0];
|
|
20294
20334
|
}
|
|
@@ -20412,6 +20452,10 @@ const Undo = 'Undo';
|
|
|
20412
20452
|
const Unfold = 'Editor: Unfold';
|
|
20413
20453
|
const UnfoldAll = 'Editor: Unfold All';
|
|
20414
20454
|
const ViewToggleMinimap = 'View: Toggle Minimap';
|
|
20455
|
+
const Breadcrumbs = 'Breadcrumbs';
|
|
20456
|
+
const EditorRoleDescription = 'editor';
|
|
20457
|
+
const GutterDecorationOnLine = '{PH1} line {PH2}';
|
|
20458
|
+
const MergeConflictActionAtLine = '{PH1} at line {PH2}';
|
|
20415
20459
|
|
|
20416
20460
|
const goToDefinition$1 = () => {
|
|
20417
20461
|
return i18nString(GoToDefinition);
|
|
@@ -20576,6 +20620,21 @@ const editorCopyLineDown = () => {
|
|
|
20576
20620
|
const editorCopyLineUp = () => {
|
|
20577
20621
|
return i18nString(EditorCopyLineUp);
|
|
20578
20622
|
};
|
|
20623
|
+
const breadcrumbs = () => {
|
|
20624
|
+
return i18nString(Breadcrumbs);
|
|
20625
|
+
};
|
|
20626
|
+
const gutterDecorationOnLine = (label, lineNumber) => {
|
|
20627
|
+
return i18nString(GutterDecorationOnLine, {
|
|
20628
|
+
PH1: label,
|
|
20629
|
+
PH2: String(lineNumber)
|
|
20630
|
+
});
|
|
20631
|
+
};
|
|
20632
|
+
const mergeConflictActionAtLine = (label, lineNumber) => {
|
|
20633
|
+
return i18nString(MergeConflictActionAtLine, {
|
|
20634
|
+
PH1: label,
|
|
20635
|
+
PH2: String(lineNumber)
|
|
20636
|
+
});
|
|
20637
|
+
};
|
|
20579
20638
|
|
|
20580
20639
|
// @ts-ignore
|
|
20581
20640
|
const goTo = async ({
|
|
@@ -21122,7 +21181,7 @@ const handleMouseDown = async (state, button, altKey, ctrlKey, x, y, detail, shi
|
|
|
21122
21181
|
};
|
|
21123
21182
|
|
|
21124
21183
|
const editorHoverDismissDelay = 500;
|
|
21125
|
-
const handleMouseLeave = (viewletUid, editorUidValue) => {
|
|
21184
|
+
const handleMouseLeave = (viewletUid, editorUidValue = viewletUid) => {
|
|
21126
21185
|
const targetEditorUid = editorUidValue ?? viewletUid;
|
|
21127
21186
|
const editorUid = Number(targetEditorUid);
|
|
21128
21187
|
const instance = get$a(editorUid);
|
|
@@ -21164,7 +21223,7 @@ const handleMouseLeave = (viewletUid, editorUidValue) => {
|
|
|
21164
21223
|
timeout
|
|
21165
21224
|
});
|
|
21166
21225
|
};
|
|
21167
|
-
const handleMouseEnter = (viewletUid, editorUidValue) => {
|
|
21226
|
+
const handleMouseEnter = (viewletUid, editorUidValue = viewletUid) => {
|
|
21168
21227
|
const targetEditorUid = editorUidValue ?? viewletUid;
|
|
21169
21228
|
clear$2(Number(targetEditorUid));
|
|
21170
21229
|
};
|
|
@@ -22286,7 +22345,9 @@ const moveTextDrag = async (editor, data, target) => {
|
|
|
22286
22345
|
if (!result) {
|
|
22287
22346
|
return editor;
|
|
22288
22347
|
}
|
|
22289
|
-
return scheduleDocumentAndCursorsSelections(editor, [result.change],
|
|
22348
|
+
return scheduleDocumentAndCursorsSelections(editor, [result.change], {
|
|
22349
|
+
selectionChanges: result.selections
|
|
22350
|
+
});
|
|
22290
22351
|
};
|
|
22291
22352
|
|
|
22292
22353
|
const handlePointerUp = async editor => {
|
|
@@ -22586,7 +22647,10 @@ const getIndentString = ({
|
|
|
22586
22647
|
insertSpaces,
|
|
22587
22648
|
tabSize
|
|
22588
22649
|
}) => {
|
|
22589
|
-
|
|
22650
|
+
const useTabs = insertSpaces === false;
|
|
22651
|
+
const indentCharacter = useTabs ? '\t' : ' ';
|
|
22652
|
+
const indentWidth = useTabs ? 1 : tabSize || 2;
|
|
22653
|
+
return indentCharacter.repeat(indentWidth);
|
|
22590
22654
|
};
|
|
22591
22655
|
|
|
22592
22656
|
const getChanges$1 = (selections, indent) => {
|
|
@@ -22717,7 +22781,9 @@ const insertLineBreak = async editor => {
|
|
|
22717
22781
|
changes,
|
|
22718
22782
|
selectionChanges
|
|
22719
22783
|
} = getChanges(lines, selections, languageConfiguration, getIndentString(editor));
|
|
22720
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
22784
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
22785
|
+
selectionChanges
|
|
22786
|
+
});
|
|
22721
22787
|
};
|
|
22722
22788
|
|
|
22723
22789
|
const compareDiagnostics = (left, right) => {
|
|
@@ -22876,7 +22942,7 @@ const addWidget = (widget, id, render) => {
|
|
|
22876
22942
|
};
|
|
22877
22943
|
|
|
22878
22944
|
const setFocus = async focusKey => {
|
|
22879
|
-
await RendererWorker.
|
|
22945
|
+
await RendererWorker.setFocus(focusKey);
|
|
22880
22946
|
};
|
|
22881
22947
|
const unsetAdditionalFocus = async focusKey => {
|
|
22882
22948
|
if (!focusKey) {
|
|
@@ -22941,7 +23007,9 @@ const getFindWidgetWorkerCommandMap = () => ({
|
|
|
22941
23007
|
const launchFindWidgetWorker = async () => {
|
|
22942
23008
|
const name = 'Find Widget Worker';
|
|
22943
23009
|
const url = 'findWidgetWorkerMain.js';
|
|
22944
|
-
return launchWorker(name, url,
|
|
23010
|
+
return launchWorker(name, url, {
|
|
23011
|
+
commandMap: getFindWidgetWorkerCommandMap()
|
|
23012
|
+
});
|
|
22945
23013
|
};
|
|
22946
23014
|
|
|
22947
23015
|
const rpcId = 9002;
|
|
@@ -22973,7 +23041,9 @@ const launchHoverWorker = async () => {
|
|
|
22973
23041
|
const name = 'Hover Worker';
|
|
22974
23042
|
const url = 'hoverWorkerMain.js';
|
|
22975
23043
|
const intializeCommand = 'Hover.initialize';
|
|
22976
|
-
const rpc = await launchWorker(name, url,
|
|
23044
|
+
const rpc = await launchWorker(name, url, {
|
|
23045
|
+
intializeCommand
|
|
23046
|
+
});
|
|
22977
23047
|
return rpc;
|
|
22978
23048
|
};
|
|
22979
23049
|
|
|
@@ -22993,7 +23063,9 @@ const launchSourceActionWorker = async () => {
|
|
|
22993
23063
|
const name = 'Source Action Worker';
|
|
22994
23064
|
const url = 'sourceActionWorkerMain.js';
|
|
22995
23065
|
const intializeCommand = 'SourceActions.initialize';
|
|
22996
|
-
const rpc = await launchWorker(name, url,
|
|
23066
|
+
const rpc = await launchWorker(name, url, {
|
|
23067
|
+
intializeCommand
|
|
23068
|
+
});
|
|
22997
23069
|
return rpc;
|
|
22998
23070
|
};
|
|
22999
23071
|
|
|
@@ -23279,13 +23351,12 @@ const loadContent$2 = async (state, parentUid, savedState) => {
|
|
|
23279
23351
|
const {
|
|
23280
23352
|
uid
|
|
23281
23353
|
} = state;
|
|
23282
|
-
const editor = getEditor$1(parentUid);
|
|
23283
23354
|
const {
|
|
23284
23355
|
height,
|
|
23285
23356
|
width,
|
|
23286
23357
|
x,
|
|
23287
23358
|
y
|
|
23288
|
-
} =
|
|
23359
|
+
} = getEditor$1(parentUid);
|
|
23289
23360
|
await launch();
|
|
23290
23361
|
await invoke$3('FindWidget.create', uid, x, y, width, height, parentUid);
|
|
23291
23362
|
await invoke$3('FindWidget.loadContent', uid, savedState);
|
|
@@ -24056,7 +24127,9 @@ const selectNextOccurrence = editor => {
|
|
|
24056
24127
|
}
|
|
24057
24128
|
// TODO what is this magic number 5?
|
|
24058
24129
|
// const deltaY = (revealRangeStartRowIndex - 5) * editor.rowHeight
|
|
24059
|
-
return scheduleDocumentAndCursorsSelections(editor, [],
|
|
24130
|
+
return scheduleDocumentAndCursorsSelections(editor, [], {
|
|
24131
|
+
selectionChanges: selectionEdits
|
|
24132
|
+
});
|
|
24060
24133
|
};
|
|
24061
24134
|
|
|
24062
24135
|
// @ts-ignore
|
|
@@ -24662,7 +24735,9 @@ const editorSnippet = async (editor, snippet) => {
|
|
|
24662
24735
|
selectionChanges,
|
|
24663
24736
|
tabStops
|
|
24664
24737
|
} = getSnippetChanges(lines, selections, snippet);
|
|
24665
|
-
const newEditor = await scheduleDocumentAndCursorsSelections(editor, changes,
|
|
24738
|
+
const newEditor = await scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
24739
|
+
selectionChanges
|
|
24740
|
+
});
|
|
24666
24741
|
if (selections.length !== 4 || tabStops.length < 2) {
|
|
24667
24742
|
return newEditor;
|
|
24668
24743
|
}
|
|
@@ -24777,22 +24852,7 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
24777
24852
|
startRowIndex--;
|
|
24778
24853
|
}
|
|
24779
24854
|
const changes = [];
|
|
24780
|
-
if (startColumnIndex
|
|
24781
|
-
changes.push(...getRemoveBlockCommentEdits(rowIndex, startRowIndex, startColumnIndex, endRowIndex, endColumnIndex, blockCommentStart, blockCommentEnd));
|
|
24782
|
-
|
|
24783
|
-
// const oldRow1 = TextDocument.getLine(editor, startRowIndex)
|
|
24784
|
-
// const newRow1 =
|
|
24785
|
-
// oldRow1.slice(0, startColumnIndex) +
|
|
24786
|
-
// oldRow1.slice(startColumnIndex + blockCommentStart.length)
|
|
24787
|
-
// const oldRow2 = TextDocument.getLine(editor, endRowIndex)
|
|
24788
|
-
// const newRow2 =
|
|
24789
|
-
// oldRow2.slice(0, endColumnIndex) +
|
|
24790
|
-
// oldRow2.slice(endColumnIndex + blockCommentEnd.length)
|
|
24791
|
-
// // TODO use applyEdit to have undo functionality
|
|
24792
|
-
// TextDocument.setLine(editor, startRowIndex, newRow1)
|
|
24793
|
-
// TextDocument.setLine(editor, endRowIndex, newRow2)
|
|
24794
|
-
// TODO move cursors
|
|
24795
|
-
} else {
|
|
24855
|
+
if (startColumnIndex === -1 || endColumnIndex === -1) {
|
|
24796
24856
|
const whitespaceAtStart = line.match(RE_WHITESPACE_AT_START$1);
|
|
24797
24857
|
const whitespaceAtEnd = line.match(RE_WHITESPACE_AT_END);
|
|
24798
24858
|
let startColumnIndex = 0;
|
|
@@ -24849,6 +24909,21 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
24849
24909
|
// columnIndex: newColumnIndex,
|
|
24850
24910
|
// }
|
|
24851
24911
|
// })
|
|
24912
|
+
} else {
|
|
24913
|
+
changes.push(...getRemoveBlockCommentEdits(rowIndex, startRowIndex, startColumnIndex, endRowIndex, endColumnIndex, blockCommentStart, blockCommentEnd));
|
|
24914
|
+
|
|
24915
|
+
// const oldRow1 = TextDocument.getLine(editor, startRowIndex)
|
|
24916
|
+
// const newRow1 =
|
|
24917
|
+
// oldRow1.slice(0, startColumnIndex) +
|
|
24918
|
+
// oldRow1.slice(startColumnIndex + blockCommentStart.length)
|
|
24919
|
+
// const oldRow2 = TextDocument.getLine(editor, endRowIndex)
|
|
24920
|
+
// const newRow2 =
|
|
24921
|
+
// oldRow2.slice(0, endColumnIndex) +
|
|
24922
|
+
// oldRow2.slice(endColumnIndex + blockCommentEnd.length)
|
|
24923
|
+
// // TODO use applyEdit to have undo functionality
|
|
24924
|
+
// TextDocument.setLine(editor, startRowIndex, newRow1)
|
|
24925
|
+
// TextDocument.setLine(editor, endRowIndex, newRow2)
|
|
24926
|
+
// TODO move cursors
|
|
24852
24927
|
}
|
|
24853
24928
|
// if (line.startsWith(blockComment[0]) && line.endsWith(blockComment[1])) {
|
|
24854
24929
|
// lines[rowIndex] = line.slice(
|
|
@@ -24899,7 +24974,7 @@ const getLineComment = async editor => {
|
|
|
24899
24974
|
|
|
24900
24975
|
const RE_WHITESPACE_AT_START = /^\s+/;
|
|
24901
24976
|
const getLineCommentEdit = (rowIndex, line, lineComment) => {
|
|
24902
|
-
const whitespaceMatch =
|
|
24977
|
+
const whitespaceMatch = RE_WHITESPACE_AT_START.exec(line);
|
|
24903
24978
|
const index = whitespaceMatch ? whitespaceMatch[0].length : 0;
|
|
24904
24979
|
if (line.slice(index).startsWith(lineComment)) {
|
|
24905
24980
|
// TODO also check tab character
|
|
@@ -24957,7 +25032,7 @@ const getSelectedLineCommentEdits = (editor, lineComment, origin = ToggleBlockCo
|
|
|
24957
25032
|
const startRow = Math.min(selections[i], selections[i + 2]);
|
|
24958
25033
|
let endRow = Math.max(selections[i], selections[i + 2]);
|
|
24959
25034
|
const endColumn = selections[i + (selections[i] > selections[i + 2] ? 1 : 3)];
|
|
24960
|
-
if (
|
|
25035
|
+
if (endColumn === 0 && endRow > startRow) {
|
|
24961
25036
|
endRow--;
|
|
24962
25037
|
}
|
|
24963
25038
|
for (let row = startRow; row <= endRow; row++) {
|
|
@@ -25133,7 +25208,9 @@ const typeWithAutoClosingBracket = (editor, text) => {
|
|
|
25133
25208
|
lineDelta += change.inserted.length - change.deleted.length;
|
|
25134
25209
|
}
|
|
25135
25210
|
// @ts-ignore
|
|
25136
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
25211
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
25212
|
+
selectionChanges
|
|
25213
|
+
});
|
|
25137
25214
|
};
|
|
25138
25215
|
|
|
25139
25216
|
// @ts-ignore
|
|
@@ -25171,7 +25248,9 @@ const typeWithAutoClosingQuote = (editor, text) => {
|
|
|
25171
25248
|
// @ts-ignore
|
|
25172
25249
|
changes[0].end.columnIndex + 1]);
|
|
25173
25250
|
// @ts-ignore
|
|
25174
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
25251
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
25252
|
+
selectionChanges
|
|
25253
|
+
});
|
|
25175
25254
|
};
|
|
25176
25255
|
|
|
25177
25256
|
const typeWithAutoClosingTag = async (editor, text) => {
|
|
@@ -26183,14 +26262,14 @@ const getEditorBreadcrumbsVirtualDom = state => {
|
|
|
26183
26262
|
const {
|
|
26184
26263
|
breadcrumbFileIcon
|
|
26185
26264
|
} = state;
|
|
26186
|
-
const breadcrumbs = getEditorBreadcrumbs(state);
|
|
26265
|
+
const breadcrumbs$1 = getEditorBreadcrumbs(state);
|
|
26187
26266
|
const children = [];
|
|
26188
|
-
for (let index = 0; index < breadcrumbs.length; index++) {
|
|
26189
|
-
const breadcrumb = breadcrumbs[index];
|
|
26267
|
+
for (let index = 0; index < breadcrumbs$1.length; index++) {
|
|
26268
|
+
const breadcrumb = breadcrumbs$1[index];
|
|
26190
26269
|
if (index > 0) {
|
|
26191
26270
|
children.push(separator);
|
|
26192
26271
|
}
|
|
26193
|
-
const isFile = breadcrumb.kind === 'file' && breadcrumbs[index + 1]?.kind !== 'file';
|
|
26272
|
+
const isFile = breadcrumb.kind === 'file' && breadcrumbs$1[index + 1]?.kind !== 'file';
|
|
26194
26273
|
const icon = breadcrumb.kind === 'symbol' ? {
|
|
26195
26274
|
ariaHidden: True,
|
|
26196
26275
|
childCount: 0,
|
|
@@ -26211,8 +26290,8 @@ const getEditorBreadcrumbsVirtualDom = state => {
|
|
|
26211
26290
|
}, ...(icon ? [icon] : []), text(breadcrumb.label));
|
|
26212
26291
|
}
|
|
26213
26292
|
return [{
|
|
26214
|
-
ariaLabel:
|
|
26215
|
-
childCount: breadcrumbs.length > 0 ? breadcrumbs.length * 2 - 1 : 0,
|
|
26293
|
+
ariaLabel: breadcrumbs(),
|
|
26294
|
+
childCount: breadcrumbs$1.length > 0 ? breadcrumbs$1.length * 2 - 1 : 0,
|
|
26216
26295
|
className: 'EditorBreadcrumbs',
|
|
26217
26296
|
type: Nav
|
|
26218
26297
|
}, ...children];
|
|
@@ -26226,7 +26305,7 @@ const editorInputNode = {
|
|
|
26226
26305
|
const editorTextAreaNode = {
|
|
26227
26306
|
ariaAutoComplete: 'list',
|
|
26228
26307
|
ariaMultiLine: True,
|
|
26229
|
-
ariaRoleDescription:
|
|
26308
|
+
ariaRoleDescription: EditorRoleDescription,
|
|
26230
26309
|
autocapitalize: 'off',
|
|
26231
26310
|
autocomplete: 'off',
|
|
26232
26311
|
autocorrect: 'off',
|
|
@@ -26414,9 +26493,10 @@ const mergeConflictActions = [{
|
|
|
26414
26493
|
}];
|
|
26415
26494
|
const getUnnecessaryRanges = (diagnostics, rowIndex, textLength, visibleStartColumn, line, hasLine, tabSize, segments) => {
|
|
26416
26495
|
const visibleStart = hasLine ? getHorizontalDisplayColumn(line, visibleStartColumn, tabSize, segments) : visibleStartColumn;
|
|
26417
|
-
|
|
26418
|
-
|
|
26419
|
-
|
|
26496
|
+
const ranges = [];
|
|
26497
|
+
for (const diagnostic of diagnostics) {
|
|
26498
|
+
if (!diagnostic.tags?.includes(DiagnosticTag.Unnecessary) || rowIndex < diagnostic.rowIndex || rowIndex > diagnostic.endRowIndex) {
|
|
26499
|
+
continue;
|
|
26420
26500
|
}
|
|
26421
26501
|
const diagnosticStart = rowIndex === diagnostic.rowIndex ? diagnostic.columnIndex : 0;
|
|
26422
26502
|
const diagnosticEnd = rowIndex === diagnostic.endRowIndex ? diagnostic.endColumnIndex : line.length;
|
|
@@ -26424,11 +26504,14 @@ const getUnnecessaryRanges = (diagnostics, rowIndex, textLength, visibleStartCol
|
|
|
26424
26504
|
const endColumn = hasLine ? getHorizontalDisplayColumn(line, diagnosticEnd, tabSize, segments) : diagnosticEnd;
|
|
26425
26505
|
const start = Math.max(0, startColumn - visibleStart);
|
|
26426
26506
|
const end = Math.min(textLength, endColumn - visibleStart);
|
|
26427
|
-
|
|
26428
|
-
|
|
26429
|
-
|
|
26430
|
-
|
|
26431
|
-
|
|
26507
|
+
if (start < end) {
|
|
26508
|
+
ranges.push({
|
|
26509
|
+
end,
|
|
26510
|
+
start
|
|
26511
|
+
});
|
|
26512
|
+
}
|
|
26513
|
+
}
|
|
26514
|
+
return ranges.toSorted((left, right) => left.start - right.start);
|
|
26432
26515
|
};
|
|
26433
26516
|
const getTokenParts = (textInfos, ranges) => {
|
|
26434
26517
|
const parts = [];
|
|
@@ -26484,7 +26567,7 @@ const addMergeConflictActions = (dom, rowIndex) => {
|
|
|
26484
26567
|
label
|
|
26485
26568
|
} of mergeConflictActions) {
|
|
26486
26569
|
dom.push({
|
|
26487
|
-
ariaLabel:
|
|
26570
|
+
ariaLabel: mergeConflictActionAtLine(label, rowIndex + 1),
|
|
26488
26571
|
childCount: 1,
|
|
26489
26572
|
className: 'MergeConflictAction',
|
|
26490
26573
|
'data-action': action,
|
|
@@ -26524,7 +26607,24 @@ const addCodeLenses = (dom, codeLensRows, rowIndex) => {
|
|
|
26524
26607
|
}, text(label));
|
|
26525
26608
|
}
|
|
26526
26609
|
};
|
|
26527
|
-
const getEditorRowsVirtualDom$1 = (textInfos, differences,
|
|
26610
|
+
const getEditorRowsVirtualDom$1 = (textInfos, differences, {
|
|
26611
|
+
charWidth = 1,
|
|
26612
|
+
codeLensRows = {},
|
|
26613
|
+
deltaX = 0,
|
|
26614
|
+
diagnostics = [],
|
|
26615
|
+
endOfLineDecorations = [],
|
|
26616
|
+
highlightedLine = -1,
|
|
26617
|
+
horizontalVirtualizationThreshold = 500,
|
|
26618
|
+
horizontalVisibleRanges = [],
|
|
26619
|
+
lineNumbers = true,
|
|
26620
|
+
lines = [],
|
|
26621
|
+
problemsHighlightedRow = -1,
|
|
26622
|
+
rtl = false,
|
|
26623
|
+
tabSize = 2,
|
|
26624
|
+
visibleLineIndices = [],
|
|
26625
|
+
visibleViewLineIndices = [],
|
|
26626
|
+
width = Infinity
|
|
26627
|
+
} = {}) => {
|
|
26528
26628
|
const dom = [];
|
|
26529
26629
|
const actualViewRows = visibleViewLineIndices.length === 0 ? Array.from({
|
|
26530
26630
|
length: textInfos.length
|
|
@@ -26616,8 +26716,38 @@ const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, h
|
|
|
26616
26716
|
return dom;
|
|
26617
26717
|
};
|
|
26618
26718
|
|
|
26619
|
-
const getEditorRowsVirtualDom = (textInfos, differences,
|
|
26620
|
-
|
|
26719
|
+
const getEditorRowsVirtualDom = (textInfos, differences, {
|
|
26720
|
+
codeLensRows,
|
|
26721
|
+
endOfLineDecorations = [],
|
|
26722
|
+
highlightedLine = -1,
|
|
26723
|
+
horizontalVisibleRanges = [],
|
|
26724
|
+
lineNumbers = true,
|
|
26725
|
+
lines = [],
|
|
26726
|
+
problemsHighlightedRow = -1,
|
|
26727
|
+
rtl = false,
|
|
26728
|
+
tabSize = 2,
|
|
26729
|
+
unnecessaryDiagnostics = [],
|
|
26730
|
+
visibleLineIndices = [],
|
|
26731
|
+
visibleViewLineIndices = []
|
|
26732
|
+
} = {}) => {
|
|
26733
|
+
const rowsDom = getEditorRowsVirtualDom$1(textInfos, differences, {
|
|
26734
|
+
charWidth: 1,
|
|
26735
|
+
codeLensRows,
|
|
26736
|
+
deltaX: 0,
|
|
26737
|
+
diagnostics: unnecessaryDiagnostics,
|
|
26738
|
+
endOfLineDecorations,
|
|
26739
|
+
highlightedLine,
|
|
26740
|
+
horizontalVirtualizationThreshold: 500,
|
|
26741
|
+
horizontalVisibleRanges,
|
|
26742
|
+
lineNumbers,
|
|
26743
|
+
lines,
|
|
26744
|
+
problemsHighlightedRow,
|
|
26745
|
+
rtl,
|
|
26746
|
+
tabSize,
|
|
26747
|
+
visibleLineIndices,
|
|
26748
|
+
visibleViewLineIndices,
|
|
26749
|
+
width: Infinity
|
|
26750
|
+
});
|
|
26621
26751
|
return [{
|
|
26622
26752
|
childCount: visibleViewLineIndices.length || textInfos.length,
|
|
26623
26753
|
className: 'EditorRows',
|
|
@@ -26714,8 +26844,40 @@ const editorLayersNode = {
|
|
|
26714
26844
|
className: 'EditorLayers',
|
|
26715
26845
|
type: Div
|
|
26716
26846
|
};
|
|
26717
|
-
const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences,
|
|
26718
|
-
|
|
26847
|
+
const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, {
|
|
26848
|
+
bracketMatchInfos = [],
|
|
26849
|
+
codeLensRows,
|
|
26850
|
+
cursorInfos = [],
|
|
26851
|
+
diagnostics = [],
|
|
26852
|
+
endOfLineDecorations = [],
|
|
26853
|
+
focused = true,
|
|
26854
|
+
highlightedLine = -1,
|
|
26855
|
+
horizontalVisibleRanges = [],
|
|
26856
|
+
lineNumbers = true,
|
|
26857
|
+
lines = [],
|
|
26858
|
+
problemsHighlightedRow = -1,
|
|
26859
|
+
roundedSelection = false,
|
|
26860
|
+
rtl = false,
|
|
26861
|
+
tabSize = 2,
|
|
26862
|
+
textDecorationDom = [],
|
|
26863
|
+
unnecessaryDiagnostics = [],
|
|
26864
|
+
visibleLineIndices = [],
|
|
26865
|
+
visibleViewLineIndices = []
|
|
26866
|
+
} = {}) => {
|
|
26867
|
+
return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused, roundedSelection), ...getEditorRowsVirtualDom(textInfos, differences, {
|
|
26868
|
+
codeLensRows,
|
|
26869
|
+
endOfLineDecorations,
|
|
26870
|
+
highlightedLine,
|
|
26871
|
+
horizontalVisibleRanges,
|
|
26872
|
+
lineNumbers,
|
|
26873
|
+
lines,
|
|
26874
|
+
problemsHighlightedRow,
|
|
26875
|
+
rtl,
|
|
26876
|
+
tabSize,
|
|
26877
|
+
unnecessaryDiagnostics,
|
|
26878
|
+
visibleLineIndices,
|
|
26879
|
+
visibleViewLineIndices
|
|
26880
|
+
}), ...getEditorCursorsVirtualDom(cursorInfos, focused), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos, textDecorationDom)];
|
|
26719
26881
|
};
|
|
26720
26882
|
|
|
26721
26883
|
const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
|
|
@@ -26813,7 +26975,26 @@ const getEditorContentVirtualDom = ({
|
|
|
26813
26975
|
return [{
|
|
26814
26976
|
...editorContentNode,
|
|
26815
26977
|
className: breadcrumbsEnabled ? 'EditorContent EditorBreadcrumbsOffset' : 'EditorContent'
|
|
26816
|
-
}, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences,
|
|
26978
|
+
}, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, {
|
|
26979
|
+
bracketMatchInfos,
|
|
26980
|
+
codeLensRows,
|
|
26981
|
+
cursorInfos,
|
|
26982
|
+
diagnostics,
|
|
26983
|
+
endOfLineDecorations,
|
|
26984
|
+
focused,
|
|
26985
|
+
highlightedLine,
|
|
26986
|
+
horizontalVisibleRanges,
|
|
26987
|
+
lineNumbers,
|
|
26988
|
+
lines,
|
|
26989
|
+
problemsHighlightedRow,
|
|
26990
|
+
roundedSelection,
|
|
26991
|
+
rtl,
|
|
26992
|
+
tabSize,
|
|
26993
|
+
textDecorationDom,
|
|
26994
|
+
unnecessaryDiagnostics,
|
|
26995
|
+
visibleLineIndices,
|
|
26996
|
+
visibleViewLineIndices
|
|
26997
|
+
}), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarWidth, scrollBarLeft)];
|
|
26817
26998
|
};
|
|
26818
26999
|
|
|
26819
27000
|
const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
|
|
@@ -26848,10 +27029,10 @@ const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
|
|
|
26848
27029
|
}),
|
|
26849
27030
|
type: Span
|
|
26850
27031
|
}, ...gutterDecorations.map(decoration => ({
|
|
26851
|
-
ariaLabel:
|
|
27032
|
+
ariaLabel: gutterDecorationOnLine(decoration.type[0].toUpperCase() + decoration.type.slice(1), lineNumber),
|
|
26852
27033
|
childCount: 0,
|
|
26853
27034
|
className: mergeClassNames('EditorGutterDecoration', `EditorGutterDecoration${decoration.type[0].toUpperCase()}${decoration.type.slice(1)}`),
|
|
26854
|
-
title:
|
|
27035
|
+
title: gutterDecorationOnLine(decoration.type[0].toUpperCase() + decoration.type.slice(1), lineNumber),
|
|
26855
27036
|
type: Span
|
|
26856
27037
|
})), text(isMergeConflictActions || isLightBulb ? '' : isBreakpoint ? '●' : showLineNumber ? lineNumber : '')];
|
|
26857
27038
|
};
|
|
@@ -27013,7 +27194,7 @@ const getEditorVirtualDom = ({
|
|
|
27013
27194
|
}, textEditorErrorIconNode, textEditorErrorMessageNode, text(loadError)];
|
|
27014
27195
|
}
|
|
27015
27196
|
const gutterLineIndices = visibleViewLineIndices.length > 0 ? visibleViewLineIndices : visibleLineIndices;
|
|
27016
|
-
const visibleGutterInfos = breakPoints.length > 0 || gutterDecorations.length > 0
|
|
27197
|
+
const visibleGutterInfos = visibleLineIndices || breakPoints.length > 0 || gutterDecorations.length > 0 ? getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, gutterLineIndices, lightBulbRowIndex, gutterDecorations) : gutterInfos;
|
|
27017
27198
|
const showGutter = lineNumbers || breakPoints.length > 0 || lightBulbRowIndex >= 0 || gutterDecorations.length > 0;
|
|
27018
27199
|
const primaryCursorRowIndex = getPrimaryCursorRowIndex(selections, primarySelectionIndex);
|
|
27019
27200
|
const activeLineNumber = highlightActiveLineNumber ? primaryCursorRowIndex + 1 : -1;
|
|
@@ -27102,11 +27283,11 @@ const getTextAppendPaths = dom => {
|
|
|
27102
27283
|
numberOfRows++;
|
|
27103
27284
|
const span = dom[index + 1];
|
|
27104
27285
|
const text = dom[index + 2];
|
|
27105
|
-
if (node.childCount
|
|
27106
|
-
numberOfRows = -100;
|
|
27107
|
-
} else {
|
|
27286
|
+
if (node.childCount === 1 && span?.type === Span && span.childCount === 1 && text?.type === Text) {
|
|
27108
27287
|
textIndex = index + 2;
|
|
27109
27288
|
textPath = [...path, 0, 0];
|
|
27289
|
+
} else {
|
|
27290
|
+
numberOfRows = -100;
|
|
27110
27291
|
}
|
|
27111
27292
|
}
|
|
27112
27293
|
if (node.className === 'EditorCursor') {
|
|
@@ -27126,7 +27307,7 @@ const getTextAppendPaths = dom => {
|
|
|
27126
27307
|
return nextIndex;
|
|
27127
27308
|
};
|
|
27128
27309
|
const endIndex = visit(0, []);
|
|
27129
|
-
if (
|
|
27310
|
+
if (numberOfRows !== 1 || numberOfCursors !== 1 || textIndex < 0 || cursorIndex < 0 || endIndex !== dom.length) {
|
|
27130
27311
|
return undefined;
|
|
27131
27312
|
}
|
|
27132
27313
|
return {
|
|
@@ -27161,13 +27342,7 @@ const canRenderPlainTextAppend = (oldState, newState) => {
|
|
|
27161
27342
|
}
|
|
27162
27343
|
const oldLine = oldLines[0];
|
|
27163
27344
|
const newLine = newLines[0];
|
|
27164
|
-
if (oldState.rtl !== newState.rtl || isBidi(oldLine, oldState.rtl) || isBidi(newLine, newState.rtl)) {
|
|
27165
|
-
return false;
|
|
27166
|
-
}
|
|
27167
|
-
if (newLine.length <= oldLine.length || !newLine.startsWith(oldLine) || /[\r\n]/.test(newLine.slice(oldLine.length))) {
|
|
27168
|
-
return false;
|
|
27169
|
-
}
|
|
27170
|
-
if (oldState.initial || newState.initial || !oldState.focused || !newState.focused || oldState.uid !== newState.uid || oldTextInfos[0][1] !== newTextInfos[0][1] || oldState.cursorInfos.length !== 1 || newState.cursorInfos.length !== 1 || oldState.selectionInfos.length > 0 || newState.selectionInfos.length > 0 || oldState.selections.length !== 4 || newState.selections.length !== 4 || oldState.selections[0] !== 0 || oldState.selections[1] !== oldLine.length || oldState.selections[2] !== 0 || oldState.selections[3] !== oldLine.length || newState.selections[0] !== 0 || newState.selections[1] !== newLine.length || newState.selections[2] !== 0 || newState.selections[3] !== newLine.length) {
|
|
27345
|
+
if (oldState.rtl !== newState.rtl || isBidi(oldLine, oldState.rtl) || isBidi(newLine, newState.rtl) || newLine.length <= oldLine.length || !newLine.startsWith(oldLine) || /[\r\n]/.test(newLine.slice(oldLine.length)) || oldState.initial || newState.initial || !oldState.focused || !newState.focused || oldState.uid !== newState.uid || oldTextInfos[0][1] !== newTextInfos[0][1] || oldState.cursorInfos.length !== 1 || newState.cursorInfos.length !== 1 || oldState.selectionInfos.length > 0 || newState.selectionInfos.length > 0 || oldState.selections.length !== 4 || newState.selections.length !== 4 || oldState.selections[0] !== 0 || oldState.selections[1] !== oldLine.length || oldState.selections[2] !== 0 || oldState.selections[3] !== oldLine.length || newState.selections[0] !== 0 || newState.selections[1] !== newLine.length || newState.selections[2] !== 0 || newState.selections[3] !== newLine.length) {
|
|
27171
27346
|
return false;
|
|
27172
27347
|
}
|
|
27173
27348
|
if (oldState.breadcrumbsEnabled || newState.breadcrumbsEnabled || oldState.minimapEnabled || newState.minimapEnabled || oldState.lineNumbers !== newState.lineNumbers || oldState.highlightActiveLineNumber !== newState.highlightActiveLineNumber || oldState.highlightedLine !== newState.highlightedLine || oldState.problemsHighlightedRow !== newState.problemsHighlightedRow || oldState.focused !== newState.focused || oldState.roundedSelection !== newState.roundedSelection || oldState.deltaX !== newState.deltaX || oldState.gutterWidth !== newState.gutterWidth || (newState.deltaX ?? 0) !== 0 && oldState.longestLineWidth !== newState.longestLineWidth || oldState.width !== newState.width || oldState.height !== newState.height || oldState.minimumSliderSize !== newState.minimumSliderSize || getScrollBarSize(getHorizontalScrollDimensions(oldState).width, oldState.longestLineWidth, oldState.minimumSliderSize) !== getScrollBarSize(getHorizontalScrollDimensions(newState).width, newState.longestLineWidth, newState.minimumSliderSize) || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || !sameValues(oldState.visibleLineIndices, newState.visibleLineIndices) || !sameValues(oldState.visibleViewLineIndices, newState.visibleViewLineIndices) || oldState.differences !== newState.differences && !sameValues(oldState.differences, newState.differences) || oldState.scrollBarHeight !== newState.scrollBarHeight || oldState.uri !== newState.uri || oldState.workspaceUri !== newState.workspaceUri || oldState.assetDir !== newState.assetDir || oldState.loadError !== newState.loadError || oldState.combineWhitespaceTokens !== newState.combineWhitespaceTokens || oldState.widgets?.length > 0 || newState.widgets?.length > 0 || Boolean(oldState.codeLensRows) || Boolean(newState.codeLensRows) || oldState.mergeConflicts.length > 0 || newState.mergeConflicts.length > 0 || !isEmpty(oldState.diagnostics) || !isEmpty(newState.diagnostics) || !isEmpty(oldState.textDecorationDom) || !isEmpty(newState.textDecorationDom) || !isEmpty(oldState.visualDecorations) || !isEmpty(newState.visualDecorations) || !isEmpty(oldState.bracketMatchInfos) || !isEmpty(newState.bracketMatchInfos) || !isEmpty(oldState.documentHighlightInfos) || !isEmpty(newState.documentHighlightInfos) || !isEmpty(oldState.endOfLineDecorations) || !isEmpty(newState.endOfLineDecorations) || !isEmpty(oldState.gutterDecorations) || !isEmpty(newState.gutterDecorations) || !isEmpty(oldState.breakPoints) || !isEmpty(newState.breakPoints)) {
|
|
@@ -27180,13 +27355,11 @@ const getTextAppendPatches = (state, paths) => {
|
|
|
27180
27355
|
cursorInfos,
|
|
27181
27356
|
lines
|
|
27182
27357
|
} = state;
|
|
27183
|
-
|
|
27184
|
-
|
|
27185
|
-
|
|
27186
|
-
|
|
27187
|
-
|
|
27188
|
-
}); // NavigateChild
|
|
27189
|
-
}
|
|
27358
|
+
// NavigateChild
|
|
27359
|
+
const patches = Array.from(paths.textPath, index => ({
|
|
27360
|
+
index,
|
|
27361
|
+
type: 7
|
|
27362
|
+
}));
|
|
27190
27363
|
patches.push({
|
|
27191
27364
|
type: 1,
|
|
27192
27365
|
value: lines[0]
|
|
@@ -27601,10 +27774,9 @@ const getWordBefore2 = (editorUid, rowIndex, columnIndex) => {
|
|
|
27601
27774
|
return word;
|
|
27602
27775
|
};
|
|
27603
27776
|
const getLines2 = editorUid => {
|
|
27604
|
-
const editor = getEditor$1(editorUid);
|
|
27605
27777
|
const {
|
|
27606
27778
|
lines
|
|
27607
|
-
} =
|
|
27779
|
+
} = getEditor$1(editorUid);
|
|
27608
27780
|
return lines;
|
|
27609
27781
|
};
|
|
27610
27782
|
const getVisibleLineRange = editorUid => {
|
|
@@ -27615,10 +27787,9 @@ const getVisibleLineRange = editorUid => {
|
|
|
27615
27787
|
return [minLineY, maxLineY];
|
|
27616
27788
|
};
|
|
27617
27789
|
const getSelections2 = editorUid => {
|
|
27618
|
-
const editor = getEditor$1(editorUid);
|
|
27619
27790
|
const {
|
|
27620
27791
|
selections
|
|
27621
|
-
} =
|
|
27792
|
+
} = getEditor$1(editorUid);
|
|
27622
27793
|
return selections;
|
|
27623
27794
|
};
|
|
27624
27795
|
const setSelections2 = async (editorUid, selections, reveal = true) => {
|
|
@@ -27687,15 +27858,14 @@ const getSourceActions = async editorUid => {
|
|
|
27687
27858
|
return actions;
|
|
27688
27859
|
};
|
|
27689
27860
|
const getDiagnostics = async editorUid => {
|
|
27690
|
-
const editor = getEditor$1(editorUid);
|
|
27691
27861
|
const {
|
|
27692
27862
|
diagnostics
|
|
27693
|
-
} =
|
|
27863
|
+
} = getEditor$1(editorUid);
|
|
27694
27864
|
return diagnostics;
|
|
27695
27865
|
};
|
|
27696
27866
|
|
|
27697
27867
|
const ensure = async (fontName, fontUrl) => {
|
|
27698
|
-
await TextMeasurementWorker.
|
|
27868
|
+
await TextMeasurementWorker.ensureFont(fontName, fontUrl);
|
|
27699
27869
|
setLoaded(fontName);
|
|
27700
27870
|
};
|
|
27701
27871
|
|
|
@@ -28127,8 +28297,8 @@ const getKeys = () => {
|
|
|
28127
28297
|
};
|
|
28128
28298
|
|
|
28129
28299
|
/**
|
|
28130
|
-
|
|
28131
|
-
|
|
28300
|
+
@enum {string}
|
|
28301
|
+
*/
|
|
28132
28302
|
const UiStrings = {
|
|
28133
28303
|
CommandPalette: 'Command Palette'};
|
|
28134
28304
|
const commandPalette = () => {
|
|
@@ -28345,19 +28515,17 @@ const getQuickPickMenuEntries = () => {
|
|
|
28345
28515
|
};
|
|
28346
28516
|
|
|
28347
28517
|
const getSelections = editorUid => {
|
|
28348
|
-
const editor = getEditor$1(editorUid);
|
|
28349
28518
|
const {
|
|
28350
28519
|
selections
|
|
28351
|
-
} =
|
|
28520
|
+
} = getEditor$1(editorUid);
|
|
28352
28521
|
return selections;
|
|
28353
28522
|
};
|
|
28354
28523
|
|
|
28355
28524
|
const getText = editorUid => {
|
|
28356
28525
|
number(editorUid);
|
|
28357
|
-
const editor = getEditor$1(editorUid);
|
|
28358
28526
|
const {
|
|
28359
28527
|
lines
|
|
28360
|
-
} =
|
|
28528
|
+
} = getEditor$1(editorUid);
|
|
28361
28529
|
return lines.join(NewLine);
|
|
28362
28530
|
};
|
|
28363
28531
|
|
|
@@ -28402,10 +28570,11 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
28402
28570
|
commandMap: {},
|
|
28403
28571
|
messagePort: port
|
|
28404
28572
|
});
|
|
28405
|
-
if (rpcId) {
|
|
28406
|
-
|
|
28407
|
-
await initializeListener(rpcId);
|
|
28573
|
+
if (!rpcId) {
|
|
28574
|
+
return;
|
|
28408
28575
|
}
|
|
28576
|
+
set$d(rpcId, rpc);
|
|
28577
|
+
await initializeListener(rpcId);
|
|
28409
28578
|
};
|
|
28410
28579
|
const handleDirectMessagePort = async (port, commands) => {
|
|
28411
28580
|
const rpc = await create$d({
|
|
@@ -28465,7 +28634,7 @@ const isAutoClosingTagsEnabled = async () => {
|
|
|
28465
28634
|
};
|
|
28466
28635
|
const getRowHeight = async applicationId => {
|
|
28467
28636
|
const [lineHeight, fontSize] = await Promise.all([getPreference(kLineHeight, applicationId), getFontSize(applicationId)]);
|
|
28468
|
-
if (typeof lineHeight !== 'number' || !Number.isFinite(lineHeight)
|
|
28637
|
+
if (typeof lineHeight !== 'number' || lineHeight === 0 || !Number.isFinite(lineHeight)) {
|
|
28469
28638
|
lastWarnings.delete(kLineHeight);
|
|
28470
28639
|
return fontSize;
|
|
28471
28640
|
}
|
|
@@ -28561,10 +28730,10 @@ const getHorizontalVirtualizationThreshold = value => {
|
|
|
28561
28730
|
return Math.floor(threshold);
|
|
28562
28731
|
};
|
|
28563
28732
|
const getEditorPreferences = async applicationId => {
|
|
28564
|
-
const [diagnosticsEnabled, fontFamily, fontSize, fontWeight, formatOnSave, formatActions, hoverEnabled, hoverDelay, horizontalVirtualizationThreshold, messageDelay, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, rtl, breadcrumbsEnabled, codeLensEnabled, occurrencesHighlight, insertSpaces, dragAndDropEnabled, roundedSelection, combineWhitespaceTokens, selectedTextOccurrenceMatching, disableMonospaceOptimizations, syntaxHighlightingCacheEnabled, linkedEditingEnabled] = await Promise.all([get$2('editor.diagnostics', applicationId), getFontFamily(applicationId), getFontSize(applicationId), getFontWeight(applicationId), get$2('editor.formatOnSave', applicationId), get$2('editor.formatActions', applicationId), get$2('editor.hover', applicationId), get$2('editor.hoverDelay', applicationId), get$2('editor.horizontalVirtualizationThreshold', applicationId), get$2('editor.messageDelay', applicationId), isAutoClosingBracketsEnabled(applicationId), isAutoClosingQuotesEnabled(applicationId), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(applicationId), getLineNumbers(applicationId), getHighlightActiveLineNumber(applicationId), getRowHeight(applicationId), getTabSize(applicationId), getLetterSpacing(applicationId), getCompletionTriggerCharacters(), getMinimapEnabled(applicationId), getMergeConflictActionsEnabled(applicationId), get$2('editor.rtl', applicationId), get$2('breadcrumbs.enabled', applicationId), get$2('editor.extensionCodeLens', applicationId), get$2('editor.occurrencesHighlight', applicationId), get$2('editor.insertSpaces', applicationId), get$2('editor.dragAndDrop', applicationId), get$2('editor.roundedSelection', applicationId), get$2('editor.combineWhitespaceTokens', applicationId), get$2('editor.selectedTextOccurrenceMatching', applicationId), get$2('editor.disableMonospaceOptimizations', applicationId), get$2('editor.syntaxHighlightingCache', applicationId), get$2('editor.linkedEditing', applicationId)]);
|
|
28733
|
+
const [diagnosticsEnabled, fontFamily, fontSize, fontWeight, formatOnSave, formatActions, hoverEnabled, hoverDelay, horizontalVirtualizationThreshold, messageDelay, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, rtl, breadcrumbsEnabled, codeLensEnabled, legacyCodeLensEnabled, occurrencesHighlight, insertSpaces, dragAndDropEnabled, roundedSelection, combineWhitespaceTokens, selectedTextOccurrenceMatching, disableMonospaceOptimizations, syntaxHighlightingCacheEnabled, linkedEditingEnabled] = await Promise.all([get$2('editor.diagnostics', applicationId), getFontFamily(applicationId), getFontSize(applicationId), getFontWeight(applicationId), get$2('editor.formatOnSave', applicationId), get$2('editor.formatActions', applicationId), get$2('editor.hover', applicationId), get$2('editor.hoverDelay', applicationId), get$2('editor.horizontalVirtualizationThreshold', applicationId), get$2('editor.messageDelay', applicationId), isAutoClosingBracketsEnabled(applicationId), isAutoClosingQuotesEnabled(applicationId), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(applicationId), getLineNumbers(applicationId), getHighlightActiveLineNumber(applicationId), getRowHeight(applicationId), getTabSize(applicationId), getLetterSpacing(applicationId), getCompletionTriggerCharacters(), getMinimapEnabled(applicationId), getMergeConflictActionsEnabled(applicationId), get$2('editor.rtl', applicationId), get$2('breadcrumbs.enabled', applicationId), get$2('editor.codeLens', applicationId), get$2('editor.extensionCodeLens', applicationId), get$2('editor.occurrencesHighlight', applicationId), get$2('editor.insertSpaces', applicationId), get$2('editor.dragAndDrop', applicationId), get$2('editor.roundedSelection', applicationId), get$2('editor.combineWhitespaceTokens', applicationId), get$2('editor.selectedTextOccurrenceMatching', applicationId), get$2('editor.disableMonospaceOptimizations', applicationId), get$2('editor.syntaxHighlightingCache', applicationId), get$2('editor.linkedEditing', applicationId)]);
|
|
28565
28734
|
return {
|
|
28566
28735
|
breadcrumbsEnabled: breadcrumbsEnabled ?? false,
|
|
28567
|
-
codeLensEnabled: codeLensEnabled === true,
|
|
28736
|
+
codeLensEnabled: (codeLensEnabled ?? legacyCodeLensEnabled) === true,
|
|
28568
28737
|
combineWhitespaceTokens: combineWhitespaceTokens ?? true,
|
|
28569
28738
|
completionTriggerCharacters,
|
|
28570
28739
|
diagnosticsEnabled: diagnosticsEnabled ?? false,
|
|
@@ -28970,7 +29139,9 @@ const launchCompletionWorker = async () => {
|
|
|
28970
29139
|
const name = 'Completion Worker';
|
|
28971
29140
|
const url = 'completionWorkerMain.js';
|
|
28972
29141
|
const intializeCommand = 'Completions.initialize';
|
|
28973
|
-
const rpc = await launchWorker(name, url,
|
|
29142
|
+
const rpc = await launchWorker(name, url, {
|
|
29143
|
+
intializeCommand
|
|
29144
|
+
});
|
|
28974
29145
|
return rpc;
|
|
28975
29146
|
};
|
|
28976
29147
|
|
|
@@ -29117,10 +29288,7 @@ const getSavedHistory = (savedState, content) => {
|
|
|
29117
29288
|
redoStack,
|
|
29118
29289
|
undoStack
|
|
29119
29290
|
} = savedState;
|
|
29120
|
-
if (!Array.isArray(lines) || lines.some(line => typeof line !== 'string') || lines.join('\n') !== content) {
|
|
29121
|
-
return undefined;
|
|
29122
|
-
}
|
|
29123
|
-
if (!Array.isArray(redoStack) || !Array.isArray(undoStack)) {
|
|
29291
|
+
if (!Array.isArray(lines) || lines.some(line => typeof line !== 'string') || lines.join('\n') !== content || !Array.isArray(redoStack) || !Array.isArray(undoStack)) {
|
|
29124
29292
|
return undefined;
|
|
29125
29293
|
}
|
|
29126
29294
|
return {
|
|
@@ -29135,10 +29303,7 @@ const getSavedLanguageId = (savedState, languages) => {
|
|
|
29135
29303
|
const {
|
|
29136
29304
|
explicitLanguageId
|
|
29137
29305
|
} = savedState;
|
|
29138
|
-
if (typeof explicitLanguageId !== 'string' || !explicitLanguageId) {
|
|
29139
|
-
return undefined;
|
|
29140
|
-
}
|
|
29141
|
-
if (languages.every(language => language?.id !== explicitLanguageId)) {
|
|
29306
|
+
if (typeof explicitLanguageId !== 'string' || !explicitLanguageId || languages.every(language => language?.id !== explicitLanguageId)) {
|
|
29142
29307
|
return undefined;
|
|
29143
29308
|
}
|
|
29144
29309
|
return explicitLanguageId;
|
|
@@ -29356,7 +29521,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
|
|
|
29356
29521
|
|
|
29357
29522
|
const getSelectedLineRange = (selections, primarySelectionIndex) => {
|
|
29358
29523
|
const [startRowIndex,, selectionEndRowIndex, endColumnIndex] = getSelectionPairs(selections, primarySelectionIndex);
|
|
29359
|
-
const endRowIndex =
|
|
29524
|
+
const endRowIndex = endColumnIndex === 0 && startRowIndex < selectionEndRowIndex ? selectionEndRowIndex - 1 : selectionEndRowIndex;
|
|
29360
29525
|
return {
|
|
29361
29526
|
endRowIndex,
|
|
29362
29527
|
startRowIndex
|
|
@@ -29393,7 +29558,7 @@ const moveLines = (editor, direction) => {
|
|
|
29393
29558
|
startRowIndex
|
|
29394
29559
|
} = getSelectedLineRange(selections, primarySelectionIndex);
|
|
29395
29560
|
const lastRowIndex = lines.length - 1;
|
|
29396
|
-
if (
|
|
29561
|
+
if (startRowIndex === 0 && direction < 0 || endRowIndex === lastRowIndex && direction > 0) {
|
|
29397
29562
|
return editor;
|
|
29398
29563
|
}
|
|
29399
29564
|
const editStartRowIndex = direction < 0 ? startRowIndex - 1 : startRowIndex;
|
|
@@ -29414,7 +29579,9 @@ const moveLines = (editor, direction) => {
|
|
|
29414
29579
|
}
|
|
29415
29580
|
}];
|
|
29416
29581
|
const selectionChanges = getSelectionChanges(lines, selections, primarySelectionIndex, direction);
|
|
29417
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
29582
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
29583
|
+
selectionChanges
|
|
29584
|
+
});
|
|
29418
29585
|
};
|
|
29419
29586
|
|
|
29420
29587
|
const moveLineDown = editor => {
|
|
@@ -29435,26 +29602,27 @@ const refreshGutterDecorations = async editor => {
|
|
|
29435
29602
|
const refreshGutterDecorationsAll = async () => {
|
|
29436
29603
|
for (const key of getKeys$1()) {
|
|
29437
29604
|
const editor = get$a(Number(key))?.newState;
|
|
29438
|
-
if (editor) {
|
|
29439
|
-
|
|
29440
|
-
const latest = get$a(editor.id);
|
|
29441
|
-
if (!latest) {
|
|
29442
|
-
continue;
|
|
29443
|
-
}
|
|
29444
|
-
set$b(editor.id, latest.oldState, {
|
|
29445
|
-
...latest.newState,
|
|
29446
|
-
gutterDecorations: refreshedEditor.gutterDecorations
|
|
29447
|
-
});
|
|
29448
|
-
await RendererWorker.invoke('Editor.renderPending', editor.id);
|
|
29605
|
+
if (!editor) {
|
|
29606
|
+
continue;
|
|
29449
29607
|
}
|
|
29608
|
+
const refreshedEditor = await refreshGutterDecorations(editor);
|
|
29609
|
+
const latest = get$a(editor.id);
|
|
29610
|
+
if (!latest) {
|
|
29611
|
+
continue;
|
|
29612
|
+
}
|
|
29613
|
+
set$b(editor.id, latest.oldState, {
|
|
29614
|
+
...latest.newState,
|
|
29615
|
+
gutterDecorations: refreshedEditor.gutterDecorations
|
|
29616
|
+
});
|
|
29617
|
+
await RendererWorker.invoke('Editor.renderPending', editor.id);
|
|
29450
29618
|
}
|
|
29451
29619
|
};
|
|
29452
29620
|
|
|
29453
29621
|
/**
|
|
29454
|
-
|
|
29455
|
-
|
|
29456
|
-
|
|
29457
|
-
|
|
29622
|
+
Register a listener for editor events
|
|
29623
|
+
@param listenerType - The type of event to listen for (from ListenerType enum)
|
|
29624
|
+
@param rpcId - The RPC ID of the listener that will be notified
|
|
29625
|
+
*/
|
|
29458
29626
|
const registerListener = async (listenerType, rpcId) => {
|
|
29459
29627
|
number(listenerType);
|
|
29460
29628
|
number(rpcId);
|
|
@@ -29482,7 +29650,24 @@ const renderLines = {
|
|
|
29482
29650
|
visibleLineIndices,
|
|
29483
29651
|
visibleViewLineIndices
|
|
29484
29652
|
} = newState;
|
|
29485
|
-
const dom = getEditorRowsVirtualDom$1(textInfos, differences,
|
|
29653
|
+
const dom = getEditorRowsVirtualDom$1(textInfos, differences, {
|
|
29654
|
+
charWidth: newState.charWidth,
|
|
29655
|
+
codeLensRows: newState.codeLensRows,
|
|
29656
|
+
deltaX: newState.deltaX,
|
|
29657
|
+
diagnostics: diagnostics || [],
|
|
29658
|
+
endOfLineDecorations,
|
|
29659
|
+
highlightedLine,
|
|
29660
|
+
horizontalVirtualizationThreshold: newState.horizontalVirtualizationThreshold,
|
|
29661
|
+
horizontalVisibleRanges: newState.horizontalVisibleRanges,
|
|
29662
|
+
lineNumbers: true,
|
|
29663
|
+
lines: newState.lines,
|
|
29664
|
+
problemsHighlightedRow: newState.problemsHighlightedRow,
|
|
29665
|
+
rtl: newState.rtl,
|
|
29666
|
+
tabSize: newState.tabSize,
|
|
29667
|
+
visibleLineIndices,
|
|
29668
|
+
visibleViewLineIndices,
|
|
29669
|
+
width: newState.width
|
|
29670
|
+
});
|
|
29486
29671
|
return [/* method */'setText', dom];
|
|
29487
29672
|
},
|
|
29488
29673
|
isEqual: (oldState, newState) => oldState.lines === newState.lines && oldState.codeLensRows === newState.codeLensRows && 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.diagnostics === newState.diagnostics && oldState.deltaX === newState.deltaX && oldState.charWidth === newState.charWidth && oldState.tabSize === newState.tabSize && oldState.rtl === newState.rtl && oldState.gutterWidth === newState.gutterWidth && oldState.horizontalVirtualizationThreshold === newState.horizontalVirtualizationThreshold && oldState.fontFamily === newState.fontFamily && oldState.fontSize === newState.fontSize && oldState.fontWeight === newState.fontWeight && oldState.letterSpacing === newState.letterSpacing && oldState.isMonospaceFont === newState.isMonospaceFont && oldState.width === newState.width && oldState.highlightedLine === newState.highlightedLine && oldState.problemsHighlightedRow === newState.problemsHighlightedRow && oldState.debugEnabled === newState.debugEnabled
|
|
@@ -29541,7 +29726,7 @@ const renderGutterInfo = {
|
|
|
29541
29726
|
visibleLineIndices,
|
|
29542
29727
|
visibleViewLineIndices = []
|
|
29543
29728
|
} = newState;
|
|
29544
|
-
if (!lineNumbers &&
|
|
29729
|
+
if (!lineNumbers && lightBulbRowIndex === -1 && breakPoints.length === 0 && gutterDecorations.length === 0) {
|
|
29545
29730
|
return ['renderGutter', []];
|
|
29546
29731
|
}
|
|
29547
29732
|
const gutterLineIndices = visibleViewLineIndices.length > 0 ? visibleViewLineIndices : visibleLineIndices;
|
|
@@ -29882,10 +30067,10 @@ const toggleMinimap = async () => {
|
|
|
29882
30067
|
};
|
|
29883
30068
|
|
|
29884
30069
|
/**
|
|
29885
|
-
|
|
29886
|
-
|
|
29887
|
-
|
|
29888
|
-
|
|
30070
|
+
Unregister a listener for editor events
|
|
30071
|
+
@param listenerType - The type of event to stop listening for
|
|
30072
|
+
@param rpcId - The RPC ID of the listener to unregister
|
|
30073
|
+
*/
|
|
29889
30074
|
const unregisterListener = (listenerType, rpcId) => {
|
|
29890
30075
|
number(listenerType);
|
|
29891
30076
|
number(rpcId);
|
|
@@ -29923,7 +30108,7 @@ const updateDebugInfo = async debugId => {
|
|
|
29923
30108
|
};
|
|
29924
30109
|
set$b(key, oldState, newEditor);
|
|
29925
30110
|
// @ts-ignore
|
|
29926
|
-
await RendererWorker.
|
|
30111
|
+
await RendererWorker.rerenderEditor(key);
|
|
29927
30112
|
};
|
|
29928
30113
|
|
|
29929
30114
|
const handleMouseDownAndRender = (uid, ...args) => {
|
|
@@ -30641,10 +30826,10 @@ const registerWidgets = () => {
|
|
|
30641
30826
|
const reservedIds = new Set();
|
|
30642
30827
|
|
|
30643
30828
|
/**
|
|
30644
|
-
|
|
30645
|
-
|
|
30646
|
-
|
|
30647
|
-
|
|
30829
|
+
Creates an editor owned by the caller, without starting a worker or installing
|
|
30830
|
+
message listeners. The host initializes the shared rpc-registry connections.
|
|
30831
|
+
Commands use document coordinates; the host owns display coordinate mapping.
|
|
30832
|
+
*/
|
|
30648
30833
|
const createEmbeddedEditor = async options => {
|
|
30649
30834
|
const {
|
|
30650
30835
|
id
|