monaco-editor11 1.0.9 → 1.1.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/index.d.ts +1 -1
- package/dist/monaco-editor11.es.js +12 -16
- package/dist/monaco-editor11.umd.js +1 -1
- package/package.json +2 -2
- package/dist/monaco.d.ts +0 -8
- package/dist/workers/common/initialize.js +0 -16
- package/dist/workers/common/workers.js +0 -141
- package/dist/workers/editor/common/abstractSyntaxTokenBackend.js +0 -128
- package/dist/workers/editor/common/abstractText.js +0 -89
- package/dist/workers/editor/common/ast.js +0 -485
- package/dist/workers/editor/common/autoIndent.js +0 -390
- package/dist/workers/editor/common/beforeEditPositionMapper.js +0 -110
- package/dist/workers/editor/common/bracketPairsImpl.js +0 -717
- package/dist/workers/editor/common/bracketPairsTree.js +0 -343
- package/dist/workers/editor/common/brackets.js +0 -108
- package/dist/workers/editor/common/characterClassifier.js +0 -59
- package/dist/workers/editor/common/characterPair.js +0 -40
- package/dist/workers/editor/common/colorizedBracketPairsDecorationProvider.js +0 -97
- package/dist/workers/editor/common/columnRange.js +0 -35
- package/dist/workers/editor/common/combineTextEditInfos.js +0 -124
- package/dist/workers/editor/common/common.js +0 -20
- package/dist/workers/editor/common/computeMovedLines.js +0 -249
- package/dist/workers/editor/common/concat23Trees.js +0 -192
- package/dist/workers/editor/common/contiguousMultilineTokens.js +0 -32
- package/dist/workers/editor/common/contiguousMultilineTokensBuilder.js +0 -23
- package/dist/workers/editor/common/contiguousTokensEditing.js +0 -128
- package/dist/workers/editor/common/contiguousTokensStore.js +0 -207
- package/dist/workers/editor/common/coordinatesConverter.js +0 -51
- package/dist/workers/editor/common/cursor.js +0 -899
- package/dist/workers/editor/common/cursorAtomicMoveOperations.js +0 -145
- package/dist/workers/editor/common/cursorCollection.js +0 -194
- package/dist/workers/editor/common/cursorColumnSelection.js +0 -93
- package/dist/workers/editor/common/cursorColumns.js +0 -112
- package/dist/workers/editor/common/cursorCommon.js +0 -250
- package/dist/workers/editor/common/cursorContext.js +0 -15
- package/dist/workers/editor/common/cursorDeleteOperations.js +0 -231
- package/dist/workers/editor/common/cursorMoveCommands.js +0 -676
- package/dist/workers/editor/common/cursorMoveOperations.js +0 -290
- package/dist/workers/editor/common/cursorTypeEditOperations.js +0 -968
- package/dist/workers/editor/common/cursorTypeOperations.js +0 -173
- package/dist/workers/editor/common/cursorUtils.js +0 -75
- package/dist/workers/editor/common/cursorWordOperations.js +0 -720
- package/dist/workers/editor/common/defaultDocumentColorsComputer.js +0 -138
- package/dist/workers/editor/common/defaultLinesDiffComputer.js +0 -188
- package/dist/workers/editor/common/diffAlgorithm.js +0 -139
- package/dist/workers/editor/common/diffEditor.js +0 -38
- package/dist/workers/editor/common/dynamicProgrammingDiffing.js +0 -101
- package/dist/workers/editor/common/edit.js +0 -183
- package/dist/workers/editor/common/editOperation.js +0 -36
- package/dist/workers/editor/common/editStack.js +0 -363
- package/dist/workers/editor/common/editorAction.js +0 -26
- package/dist/workers/editor/common/editorBaseApi.js +0 -43
- package/dist/workers/editor/common/editorColorRegistry.js +0 -102
- package/dist/workers/editor/common/editorCommon.js +0 -13
- package/dist/workers/editor/common/editorConfigurationSchema.js +0 -338
- package/dist/workers/editor/common/editorContextKeys.js +0 -84
- package/dist/workers/editor/common/editorFeatures.js +0 -17
- package/dist/workers/editor/common/editorOptions.js +0 -3440
- package/dist/workers/editor/common/editorTheme.js +0 -23
- package/dist/workers/editor/common/editorWebWorker.js +0 -299
- package/dist/workers/editor/common/editorWorker.js +0 -9
- package/dist/workers/editor/common/editorWorkerHost.js +0 -15
- package/dist/workers/editor/common/editorZoom.js +0 -26
- package/dist/workers/editor/common/electricCharacter.js +0 -55
- package/dist/workers/editor/common/encodedTokenAttributes.js +0 -79
- package/dist/workers/editor/common/enterAction.js +0 -53
- package/dist/workers/editor/common/eolCounter.js +0 -44
- package/dist/workers/editor/common/findSectionHeaders.js +0 -128
- package/dist/workers/editor/common/fixBrackets.js +0 -67
- package/dist/workers/editor/common/fixedArray.js +0 -70
- package/dist/workers/editor/common/fontInfo.js +0 -172
- package/dist/workers/editor/common/fontInfoFromSettings.js +0 -29
- package/dist/workers/editor/common/getIconClasses.js +0 -106
- package/dist/workers/editor/common/getPositionOffsetTransformerFromTextModel.js +0 -24
- package/dist/workers/editor/common/glyphLanesModel.js +0 -61
- package/dist/workers/editor/common/guidesTextModelPart.js +0 -405
- package/dist/workers/editor/common/heuristicSequenceOptimizations.js +0 -374
- package/dist/workers/editor/common/indentRules.js +0 -63
- package/dist/workers/editor/common/indentation.js +0 -39
- package/dist/workers/editor/common/indentationGuesser.js +0 -178
- package/dist/workers/editor/common/indentationLineProcessor.js +0 -193
- package/dist/workers/editor/common/inlineDecorations.js +0 -26
- package/dist/workers/editor/common/inplaceReplaceSupport.js +0 -87
- package/dist/workers/editor/common/inputMode.js +0 -22
- package/dist/workers/editor/common/intervalTree.js +0 -1002
- package/dist/workers/editor/common/language.js +0 -9
- package/dist/workers/editor/common/languageBracketsConfiguration.js +0 -133
- package/dist/workers/editor/common/languageConfiguration.js +0 -138
- package/dist/workers/editor/common/languageConfigurationRegistry.js +0 -361
- package/dist/workers/editor/common/languageFeatureDebounce.js +0 -137
- package/dist/workers/editor/common/languageFeatureRegistry.js +0 -180
- package/dist/workers/editor/common/languageFeatures.js +0 -9
- package/dist/workers/editor/common/languageFeaturesService.js +0 -47
- package/dist/workers/editor/common/languageSelector.js +0 -112
- package/dist/workers/editor/common/languageService.js +0 -92
- package/dist/workers/editor/common/languages.js +0 -522
- package/dist/workers/editor/common/languagesAssociations.js +0 -193
- package/dist/workers/editor/common/languagesRegistry.js +0 -237
- package/dist/workers/editor/common/legacyLinesDiffComputer.js +0 -468
- package/dist/workers/editor/common/length.js +0 -129
- package/dist/workers/editor/common/lineDecorations.js +0 -208
- package/dist/workers/editor/common/lineEdit.js +0 -75
- package/dist/workers/editor/common/lineHeights.js +0 -370
- package/dist/workers/editor/common/linePart.js +0 -25
- package/dist/workers/editor/common/lineRange.js +0 -312
- package/dist/workers/editor/common/lineSequence.js +0 -36
- package/dist/workers/editor/common/lineTokens.js +0 -405
- package/dist/workers/editor/common/linesDiffComputer.js +0 -29
- package/dist/workers/editor/common/linesDiffComputers.js +0 -13
- package/dist/workers/editor/common/linesLayout.js +0 -765
- package/dist/workers/editor/common/linesSliceCharSequence.js +0 -205
- package/dist/workers/editor/common/linkComputer.js +0 -269
- package/dist/workers/editor/common/markerDecorations.js +0 -9
- package/dist/workers/editor/common/markerDecorationsService.js +0 -248
- package/dist/workers/editor/common/minimapTokensColorTracker.js +0 -58
- package/dist/workers/editor/common/mirrorTextModel.js +0 -117
- package/dist/workers/editor/common/model.js +0 -9
- package/dist/workers/editor/common/modelLineProjection.js +0 -350
- package/dist/workers/editor/common/modelLineProjectionData.js +0 -297
- package/dist/workers/editor/common/modelService.js +0 -413
- package/dist/workers/editor/common/modesRegistry.js +0 -75
- package/dist/workers/editor/common/monospaceLineBreaksComputer.js +0 -473
- package/dist/workers/editor/common/myersDiffAlgorithm.js +0 -159
- package/dist/workers/editor/common/nodeReader.js +0 -127
- package/dist/workers/editor/common/nullTokenize.js +0 -29
- package/dist/workers/editor/common/offsetRange.js +0 -225
- package/dist/workers/editor/common/onEnter.js +0 -109
- package/dist/workers/editor/common/oneCursor.js +0 -117
- package/dist/workers/editor/common/overviewZoneManager.js +0 -176
- package/dist/workers/editor/common/parser.js +0 -121
- package/dist/workers/editor/common/pieceTreeBase.js +0 -1473
- package/dist/workers/editor/common/pieceTreeTextBuffer.js +0 -461
- package/dist/workers/editor/common/pieceTreeTextBufferBuilder.js +0 -140
- package/dist/workers/editor/common/point.js +0 -50
- package/dist/workers/editor/common/position.js +0 -142
- package/dist/workers/editor/common/positionToOffset.js +0 -17
- package/dist/workers/editor/common/positionToOffsetImpl.js +0 -98
- package/dist/workers/editor/common/prefixSumComputer.js +0 -226
- package/dist/workers/editor/common/range.js +0 -421
- package/dist/workers/editor/common/rangeMapping.js +0 -229
- package/dist/workers/editor/common/rangeSingleLine.js +0 -17
- package/dist/workers/editor/common/rbTreeBase.js +0 -362
- package/dist/workers/editor/common/rect.js +0 -163
- package/dist/workers/editor/common/replaceCommand.js +0 -158
- package/dist/workers/editor/common/resolverService.js +0 -5
- package/dist/workers/editor/common/rgba.js +0 -35
- package/dist/workers/editor/common/richEditBrackets.js +0 -356
- package/dist/workers/editor/common/selection.js +0 -145
- package/dist/workers/editor/common/semanticTokensDto.js +0 -82
- package/dist/workers/editor/common/semanticTokensProviderStyling.js +0 -263
- package/dist/workers/editor/common/semanticTokensStyling.js +0 -9
- package/dist/workers/editor/common/semanticTokensStylingService.js +0 -47
- package/dist/workers/editor/common/shiftCommand.js +0 -241
- package/dist/workers/editor/common/smallImmutableSet.js +0 -108
- package/dist/workers/editor/common/sparseMultilineTokens.js +0 -548
- package/dist/workers/editor/common/sparseTokensStore.js +0 -210
- package/dist/workers/editor/common/standaloneEnums.js +0 -1017
- package/dist/workers/editor/common/standaloneStrings.js +0 -42
- package/dist/workers/editor/common/stringBuilder.js +0 -122
- package/dist/workers/editor/common/stringEdit.js +0 -165
- package/dist/workers/editor/common/supports.js +0 -58
- package/dist/workers/editor/common/surroundSelectionCommand.js +0 -44
- package/dist/workers/editor/common/textChange.js +0 -248
- package/dist/workers/editor/common/textEdit.js +0 -269
- package/dist/workers/editor/common/textLength.js +0 -87
- package/dist/workers/editor/common/textModel.js +0 -2031
- package/dist/workers/editor/common/textModelBracketPairs.js +0 -45
- package/dist/workers/editor/common/textModelDefaults.js +0 -18
- package/dist/workers/editor/common/textModelEditSource.js +0 -166
- package/dist/workers/editor/common/textModelEvents.js +0 -216
- package/dist/workers/editor/common/textModelGuides.js +0 -40
- package/dist/workers/editor/common/textModelPart.js +0 -23
- package/dist/workers/editor/common/textModelSearch.js +0 -455
- package/dist/workers/editor/common/textModelStringEdit.js +0 -11
- package/dist/workers/editor/common/textModelSync.impl.js +0 -307
- package/dist/workers/editor/common/textModelText.js +0 -26
- package/dist/workers/editor/common/textModelTokens.js +0 -436
- package/dist/workers/editor/common/textResourceConfiguration.js +0 -6
- package/dist/workers/editor/common/textToHtmlTokenizer.js +0 -139
- package/dist/workers/editor/common/tokenStore.js +0 -407
- package/dist/workers/editor/common/tokenWithTextArray.js +0 -73
- package/dist/workers/editor/common/tokenization.js +0 -287
- package/dist/workers/editor/common/tokenizationRegistry.js +0 -123
- package/dist/workers/editor/common/tokenizationTextModelPart.js +0 -275
- package/dist/workers/editor/common/tokenizer.js +0 -301
- package/dist/workers/editor/common/tokenizerSyntaxTokenBackend.js +0 -261
- package/dist/workers/editor/common/treeSitterLibraryService.js +0 -9
- package/dist/workers/editor/common/treeSitterSyntaxTokenBackend.js +0 -167
- package/dist/workers/editor/common/treeSitterThemeService.js +0 -9
- package/dist/workers/editor/common/treeSitterTokenizationImpl.js +0 -713
- package/dist/workers/editor/common/treeSitterTree.js +0 -395
- package/dist/workers/editor/common/treeViewsDnd.js +0 -24
- package/dist/workers/editor/common/treeViewsDndService.js +0 -12
- package/dist/workers/editor/common/trimTrailingWhitespaceCommand.js +0 -98
- package/dist/workers/editor/common/unicodeTextModelHighlighter.js +0 -188
- package/dist/workers/editor/common/utils.js +0 -62
- package/dist/workers/editor/common/viewContext.js +0 -22
- package/dist/workers/editor/common/viewEventHandler.js +0 -186
- package/dist/workers/editor/common/viewEvents.js +0 -180
- package/dist/workers/editor/common/viewLayout.js +0 -368
- package/dist/workers/editor/common/viewLineRenderer.js +0 -948
- package/dist/workers/editor/common/viewLinesViewportData.js +0 -30
- package/dist/workers/editor/common/viewModel.js +0 -98
- package/dist/workers/editor/common/viewModelDecoration.js +0 -55
- package/dist/workers/editor/common/viewModelDecorations.js +0 -132
- package/dist/workers/editor/common/viewModelEventDispatcher.js +0 -398
- package/dist/workers/editor/common/viewModelImpl.js +0 -1163
- package/dist/workers/editor/common/viewModelLines.js +0 -938
- package/dist/workers/editor/common/wordCharacterClassifier.js +0 -87
- package/dist/workers/editor/common/wordHelper.js +0 -127
- package/dist/workers/language/cssMode.js +0 -198
- package/dist/workers/language/cssWorker.js +0 -183
- package/dist/workers/language/htmlMode.js +0 -213
- package/dist/workers/language/htmlWorker.js +0 -126
- package/dist/workers/language/jsonMode.js +0 -224
- package/dist/workers/language/jsonWorker.js +0 -187
- package/dist/workers/language/languageFeatures.js +0 -1009
- package/dist/workers/language/lib.index.js +0 -103
- package/dist/workers/language/lib.js +0 -1107
- package/dist/workers/language/lspLanguageFeatures.js +0 -716
- package/dist/workers/language/monaco.contribution.js +0 -144
- package/dist/workers/language/tokenization.js +0 -189
- package/dist/workers/language/tsMode.js +0 -212
- package/dist/workers/language/tsWorker.js +0 -352
- package/dist/workers/language/typescriptServices.js +0 -210154
- package/dist/workers/language/typescriptServicesMetadata.js +0 -3
- package/dist/workers/language/workerManager.js +0 -65
- /package/dist/workers/{language/css.worker.js → css.worker.js} +0 -0
- /package/dist/workers/{editor/editor.worker.js → editor.worker.js} +0 -0
- /package/dist/workers/{language/html.worker.js → html.worker.js} +0 -0
- /package/dist/workers/{language/json.worker.js → json.worker.js} +0 -0
- /package/dist/workers/{language/ts.worker.js → ts.worker.js} +0 -0
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { lengthZero, lengthLessThan, lengthAdd } from './length.js';
|
|
2
|
-
|
|
3
|
-
/*---------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
-
*--------------------------------------------------------------------------------------------*/
|
|
7
|
-
/**
|
|
8
|
-
* Allows to efficiently find a longest child at a given offset in a fixed node.
|
|
9
|
-
* The requested offsets must increase monotonously.
|
|
10
|
-
*/
|
|
11
|
-
class NodeReader {
|
|
12
|
-
constructor(node) {
|
|
13
|
-
this.lastOffset = lengthZero;
|
|
14
|
-
this.nextNodes = [node];
|
|
15
|
-
this.offsets = [lengthZero];
|
|
16
|
-
this.idxs = [];
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Returns the longest node at `offset` that satisfies the predicate.
|
|
20
|
-
* @param offset must be greater than or equal to the last offset this method has been called with!
|
|
21
|
-
*/
|
|
22
|
-
readLongestNodeAt(offset, predicate) {
|
|
23
|
-
if (lengthLessThan(offset, this.lastOffset)) {
|
|
24
|
-
throw new Error('Invalid offset');
|
|
25
|
-
}
|
|
26
|
-
this.lastOffset = offset;
|
|
27
|
-
// Find the longest node of all those that are closest to the current offset.
|
|
28
|
-
while (true) {
|
|
29
|
-
const curNode = lastOrUndefined(this.nextNodes);
|
|
30
|
-
if (!curNode) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
const curNodeOffset = lastOrUndefined(this.offsets);
|
|
34
|
-
if (lengthLessThan(offset, curNodeOffset)) {
|
|
35
|
-
// The next best node is not here yet.
|
|
36
|
-
// The reader must advance before a cached node is hit.
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
if (lengthLessThan(curNodeOffset, offset)) {
|
|
40
|
-
// The reader is ahead of the current node.
|
|
41
|
-
if (lengthAdd(curNodeOffset, curNode.length) <= offset) {
|
|
42
|
-
// The reader is after the end of the current node.
|
|
43
|
-
this.nextNodeAfterCurrent();
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
// The reader is somewhere in the current node.
|
|
47
|
-
const nextChildIdx = getNextChildIdx(curNode);
|
|
48
|
-
if (nextChildIdx !== -1) {
|
|
49
|
-
// Go to the first child and repeat.
|
|
50
|
-
this.nextNodes.push(curNode.getChild(nextChildIdx));
|
|
51
|
-
this.offsets.push(curNodeOffset);
|
|
52
|
-
this.idxs.push(nextChildIdx);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
// We don't have children
|
|
56
|
-
this.nextNodeAfterCurrent();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
// readerOffsetBeforeChange === curNodeOffset
|
|
62
|
-
if (predicate(curNode)) {
|
|
63
|
-
this.nextNodeAfterCurrent();
|
|
64
|
-
return curNode;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
const nextChildIdx = getNextChildIdx(curNode);
|
|
68
|
-
// look for shorter node
|
|
69
|
-
if (nextChildIdx === -1) {
|
|
70
|
-
// There is no shorter node.
|
|
71
|
-
this.nextNodeAfterCurrent();
|
|
72
|
-
return undefined;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
// Descend into first child & repeat.
|
|
76
|
-
this.nextNodes.push(curNode.getChild(nextChildIdx));
|
|
77
|
-
this.offsets.push(curNodeOffset);
|
|
78
|
-
this.idxs.push(nextChildIdx);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
// Navigates to the longest node that continues after the current node.
|
|
85
|
-
nextNodeAfterCurrent() {
|
|
86
|
-
while (true) {
|
|
87
|
-
const currentOffset = lastOrUndefined(this.offsets);
|
|
88
|
-
const currentNode = lastOrUndefined(this.nextNodes);
|
|
89
|
-
this.nextNodes.pop();
|
|
90
|
-
this.offsets.pop();
|
|
91
|
-
if (this.idxs.length === 0) {
|
|
92
|
-
// We just popped the root node, there is no next node.
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
// Parent is not undefined, because idxs is not empty
|
|
96
|
-
const parent = lastOrUndefined(this.nextNodes);
|
|
97
|
-
const nextChildIdx = getNextChildIdx(parent, this.idxs[this.idxs.length - 1]);
|
|
98
|
-
if (nextChildIdx !== -1) {
|
|
99
|
-
this.nextNodes.push(parent.getChild(nextChildIdx));
|
|
100
|
-
this.offsets.push(lengthAdd(currentOffset, currentNode.length));
|
|
101
|
-
this.idxs[this.idxs.length - 1] = nextChildIdx;
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
this.idxs.pop();
|
|
106
|
-
}
|
|
107
|
-
// We fully consumed the parent.
|
|
108
|
-
// Current node is now parent, so call nextNodeAfterCurrent again
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
function getNextChildIdx(node, curIdx = -1) {
|
|
113
|
-
while (true) {
|
|
114
|
-
curIdx++;
|
|
115
|
-
if (curIdx >= node.childrenLength) {
|
|
116
|
-
return -1;
|
|
117
|
-
}
|
|
118
|
-
if (node.getChild(curIdx)) {
|
|
119
|
-
return curIdx;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
function lastOrUndefined(arr) {
|
|
124
|
-
return arr.length > 0 ? arr[arr.length - 1] : undefined;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export { NodeReader };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { EncodedTokenizationResult, TokenizationResult, Token } from '../languages.js';
|
|
2
|
-
|
|
3
|
-
/*---------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
-
*--------------------------------------------------------------------------------------------*/
|
|
7
|
-
const NullState = new class {
|
|
8
|
-
clone() {
|
|
9
|
-
return this;
|
|
10
|
-
}
|
|
11
|
-
equals(other) {
|
|
12
|
-
return (this === other);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
function nullTokenize(languageId, state) {
|
|
16
|
-
return new TokenizationResult([new Token(0, '', languageId)], state);
|
|
17
|
-
}
|
|
18
|
-
function nullTokenizeEncoded(languageId, state) {
|
|
19
|
-
const tokens = new Uint32Array(2);
|
|
20
|
-
tokens[0] = 0;
|
|
21
|
-
tokens[1] = ((languageId << 0 /* MetadataConsts.LANGUAGEID_OFFSET */)
|
|
22
|
-
| (0 /* StandardTokenType.Other */ << 8 /* MetadataConsts.TOKEN_TYPE_OFFSET */)
|
|
23
|
-
| (0 /* FontStyle.None */ << 11 /* MetadataConsts.FONT_STYLE_OFFSET */)
|
|
24
|
-
| (1 /* ColorId.DefaultForeground */ << 15 /* MetadataConsts.FOREGROUND_OFFSET */)
|
|
25
|
-
| (2 /* ColorId.DefaultBackground */ << 24 /* MetadataConsts.BACKGROUND_OFFSET */)) >>> 0;
|
|
26
|
-
return new EncodedTokenizationResult(tokens, state === null ? NullState : state);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { NullState, nullTokenize, nullTokenizeEncoded };
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { BugIndicatingError } from '../../../../base/common/errors.js';
|
|
2
|
-
|
|
3
|
-
/*---------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
-
*--------------------------------------------------------------------------------------------*/
|
|
7
|
-
/**
|
|
8
|
-
* A range of offsets (0-based).
|
|
9
|
-
*/
|
|
10
|
-
class OffsetRange {
|
|
11
|
-
static fromTo(start, endExclusive) {
|
|
12
|
-
return new OffsetRange(start, endExclusive);
|
|
13
|
-
}
|
|
14
|
-
static addRange(range, sortedRanges) {
|
|
15
|
-
let i = 0;
|
|
16
|
-
while (i < sortedRanges.length && sortedRanges[i].endExclusive < range.start) {
|
|
17
|
-
i++;
|
|
18
|
-
}
|
|
19
|
-
let j = i;
|
|
20
|
-
while (j < sortedRanges.length && sortedRanges[j].start <= range.endExclusive) {
|
|
21
|
-
j++;
|
|
22
|
-
}
|
|
23
|
-
if (i === j) {
|
|
24
|
-
sortedRanges.splice(i, 0, range);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
const start = Math.min(range.start, sortedRanges[i].start);
|
|
28
|
-
const end = Math.max(range.endExclusive, sortedRanges[j - 1].endExclusive);
|
|
29
|
-
sortedRanges.splice(i, j - i, new OffsetRange(start, end));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
static tryCreate(start, endExclusive) {
|
|
33
|
-
if (start > endExclusive) {
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
return new OffsetRange(start, endExclusive);
|
|
37
|
-
}
|
|
38
|
-
static ofLength(length) {
|
|
39
|
-
return new OffsetRange(0, length);
|
|
40
|
-
}
|
|
41
|
-
static ofStartAndLength(start, length) {
|
|
42
|
-
return new OffsetRange(start, start + length);
|
|
43
|
-
}
|
|
44
|
-
static emptyAt(offset) {
|
|
45
|
-
return new OffsetRange(offset, offset);
|
|
46
|
-
}
|
|
47
|
-
constructor(start, endExclusive) {
|
|
48
|
-
this.start = start;
|
|
49
|
-
this.endExclusive = endExclusive;
|
|
50
|
-
if (start > endExclusive) {
|
|
51
|
-
throw new BugIndicatingError(`Invalid range: ${this.toString()}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
get isEmpty() {
|
|
55
|
-
return this.start === this.endExclusive;
|
|
56
|
-
}
|
|
57
|
-
delta(offset) {
|
|
58
|
-
return new OffsetRange(this.start + offset, this.endExclusive + offset);
|
|
59
|
-
}
|
|
60
|
-
deltaStart(offset) {
|
|
61
|
-
return new OffsetRange(this.start + offset, this.endExclusive);
|
|
62
|
-
}
|
|
63
|
-
deltaEnd(offset) {
|
|
64
|
-
return new OffsetRange(this.start, this.endExclusive + offset);
|
|
65
|
-
}
|
|
66
|
-
get length() {
|
|
67
|
-
return this.endExclusive - this.start;
|
|
68
|
-
}
|
|
69
|
-
toString() {
|
|
70
|
-
return `[${this.start}, ${this.endExclusive})`;
|
|
71
|
-
}
|
|
72
|
-
equals(other) {
|
|
73
|
-
return this.start === other.start && this.endExclusive === other.endExclusive;
|
|
74
|
-
}
|
|
75
|
-
contains(offset) {
|
|
76
|
-
return this.start <= offset && offset < this.endExclusive;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* for all numbers n: range1.contains(n) or range2.contains(n) => range1.join(range2).contains(n)
|
|
80
|
-
* The joined range is the smallest range that contains both ranges.
|
|
81
|
-
*/
|
|
82
|
-
join(other) {
|
|
83
|
-
return new OffsetRange(Math.min(this.start, other.start), Math.max(this.endExclusive, other.endExclusive));
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* for all numbers n: range1.contains(n) and range2.contains(n) <=> range1.intersect(range2).contains(n)
|
|
87
|
-
*
|
|
88
|
-
* The resulting range is empty if the ranges do not intersect, but touch.
|
|
89
|
-
* If the ranges don't even touch, the result is undefined.
|
|
90
|
-
*/
|
|
91
|
-
intersect(other) {
|
|
92
|
-
const start = Math.max(this.start, other.start);
|
|
93
|
-
const end = Math.min(this.endExclusive, other.endExclusive);
|
|
94
|
-
if (start <= end) {
|
|
95
|
-
return new OffsetRange(start, end);
|
|
96
|
-
}
|
|
97
|
-
return undefined;
|
|
98
|
-
}
|
|
99
|
-
intersectionLength(range) {
|
|
100
|
-
const start = Math.max(this.start, range.start);
|
|
101
|
-
const end = Math.min(this.endExclusive, range.endExclusive);
|
|
102
|
-
return Math.max(0, end - start);
|
|
103
|
-
}
|
|
104
|
-
intersects(other) {
|
|
105
|
-
const start = Math.max(this.start, other.start);
|
|
106
|
-
const end = Math.min(this.endExclusive, other.endExclusive);
|
|
107
|
-
return start < end;
|
|
108
|
-
}
|
|
109
|
-
intersectsOrTouches(other) {
|
|
110
|
-
const start = Math.max(this.start, other.start);
|
|
111
|
-
const end = Math.min(this.endExclusive, other.endExclusive);
|
|
112
|
-
return start <= end;
|
|
113
|
-
}
|
|
114
|
-
isBefore(other) {
|
|
115
|
-
return this.endExclusive <= other.start;
|
|
116
|
-
}
|
|
117
|
-
isAfter(other) {
|
|
118
|
-
return this.start >= other.endExclusive;
|
|
119
|
-
}
|
|
120
|
-
slice(arr) {
|
|
121
|
-
return arr.slice(this.start, this.endExclusive);
|
|
122
|
-
}
|
|
123
|
-
substring(str) {
|
|
124
|
-
return str.substring(this.start, this.endExclusive);
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Returns the given value if it is contained in this instance, otherwise the closest value that is contained.
|
|
128
|
-
* The range must not be empty.
|
|
129
|
-
*/
|
|
130
|
-
clip(value) {
|
|
131
|
-
if (this.isEmpty) {
|
|
132
|
-
throw new BugIndicatingError(`Invalid clipping range: ${this.toString()}`);
|
|
133
|
-
}
|
|
134
|
-
return Math.max(this.start, Math.min(this.endExclusive - 1, value));
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Returns `r := value + k * length` such that `r` is contained in this range.
|
|
138
|
-
* The range must not be empty.
|
|
139
|
-
*
|
|
140
|
-
* E.g. `[5, 10).clipCyclic(10) === 5`, `[5, 10).clipCyclic(11) === 6` and `[5, 10).clipCyclic(4) === 9`.
|
|
141
|
-
*/
|
|
142
|
-
clipCyclic(value) {
|
|
143
|
-
if (this.isEmpty) {
|
|
144
|
-
throw new BugIndicatingError(`Invalid clipping range: ${this.toString()}`);
|
|
145
|
-
}
|
|
146
|
-
if (value < this.start) {
|
|
147
|
-
return this.endExclusive - ((this.start - value) % this.length);
|
|
148
|
-
}
|
|
149
|
-
if (value >= this.endExclusive) {
|
|
150
|
-
return this.start + ((value - this.start) % this.length);
|
|
151
|
-
}
|
|
152
|
-
return value;
|
|
153
|
-
}
|
|
154
|
-
forEach(f) {
|
|
155
|
-
for (let i = this.start; i < this.endExclusive; i++) {
|
|
156
|
-
f(i);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* this: [ 5, 10), range: [10, 15) => [5, 15)]
|
|
161
|
-
* Throws if the ranges are not touching.
|
|
162
|
-
*/
|
|
163
|
-
joinRightTouching(range) {
|
|
164
|
-
if (this.endExclusive !== range.start) {
|
|
165
|
-
throw new BugIndicatingError(`Invalid join: ${this.toString()} and ${range.toString()}`);
|
|
166
|
-
}
|
|
167
|
-
return new OffsetRange(this.start, range.endExclusive);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
class OffsetRangeSet {
|
|
171
|
-
constructor() {
|
|
172
|
-
this._sortedRanges = [];
|
|
173
|
-
}
|
|
174
|
-
addRange(range) {
|
|
175
|
-
let i = 0;
|
|
176
|
-
while (i < this._sortedRanges.length && this._sortedRanges[i].endExclusive < range.start) {
|
|
177
|
-
i++;
|
|
178
|
-
}
|
|
179
|
-
let j = i;
|
|
180
|
-
while (j < this._sortedRanges.length && this._sortedRanges[j].start <= range.endExclusive) {
|
|
181
|
-
j++;
|
|
182
|
-
}
|
|
183
|
-
if (i === j) {
|
|
184
|
-
this._sortedRanges.splice(i, 0, range);
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
const start = Math.min(range.start, this._sortedRanges[i].start);
|
|
188
|
-
const end = Math.max(range.endExclusive, this._sortedRanges[j - 1].endExclusive);
|
|
189
|
-
this._sortedRanges.splice(i, j - i, new OffsetRange(start, end));
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
toString() {
|
|
193
|
-
return this._sortedRanges.map(r => r.toString()).join(', ');
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Returns of there is a value that is contained in this instance and the given range.
|
|
197
|
-
*/
|
|
198
|
-
intersectsStrict(other) {
|
|
199
|
-
// TODO use binary search
|
|
200
|
-
let i = 0;
|
|
201
|
-
while (i < this._sortedRanges.length && this._sortedRanges[i].endExclusive <= other.start) {
|
|
202
|
-
i++;
|
|
203
|
-
}
|
|
204
|
-
return i < this._sortedRanges.length && this._sortedRanges[i].start < other.endExclusive;
|
|
205
|
-
}
|
|
206
|
-
intersectWithRange(other) {
|
|
207
|
-
// TODO use binary search + slice
|
|
208
|
-
const result = new OffsetRangeSet();
|
|
209
|
-
for (const range of this._sortedRanges) {
|
|
210
|
-
const intersection = range.intersect(other);
|
|
211
|
-
if (intersection) {
|
|
212
|
-
result.addRange(intersection);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
return result;
|
|
216
|
-
}
|
|
217
|
-
intersectWithRangeLength(other) {
|
|
218
|
-
return this.intersectWithRange(other).length;
|
|
219
|
-
}
|
|
220
|
-
get length() {
|
|
221
|
-
return this._sortedRanges.reduce((prev, cur) => prev + cur.length, 0);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export { OffsetRange, OffsetRangeSet };
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { onUnexpectedError } from '../../../../base/common/errors.js';
|
|
2
|
-
import { escapeRegExpCharacters } from '../../../../base/common/strings.js';
|
|
3
|
-
import { IndentAction } from '../languageConfiguration.js';
|
|
4
|
-
|
|
5
|
-
/*---------------------------------------------------------------------------------------------
|
|
6
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
8
|
-
*--------------------------------------------------------------------------------------------*/
|
|
9
|
-
class OnEnterSupport {
|
|
10
|
-
constructor(opts) {
|
|
11
|
-
opts = opts || {};
|
|
12
|
-
opts.brackets = opts.brackets || [
|
|
13
|
-
['(', ')'],
|
|
14
|
-
['{', '}'],
|
|
15
|
-
['[', ']']
|
|
16
|
-
];
|
|
17
|
-
this._brackets = [];
|
|
18
|
-
opts.brackets.forEach((bracket) => {
|
|
19
|
-
const openRegExp = OnEnterSupport._createOpenBracketRegExp(bracket[0]);
|
|
20
|
-
const closeRegExp = OnEnterSupport._createCloseBracketRegExp(bracket[1]);
|
|
21
|
-
if (openRegExp && closeRegExp) {
|
|
22
|
-
this._brackets.push({
|
|
23
|
-
open: bracket[0],
|
|
24
|
-
openRegExp: openRegExp,
|
|
25
|
-
close: bracket[1],
|
|
26
|
-
closeRegExp: closeRegExp,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
this._regExpRules = opts.onEnterRules || [];
|
|
31
|
-
}
|
|
32
|
-
onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText) {
|
|
33
|
-
// (1): `regExpRules`
|
|
34
|
-
if (autoIndent >= 3 /* EditorAutoIndentStrategy.Advanced */) {
|
|
35
|
-
for (let i = 0, len = this._regExpRules.length; i < len; i++) {
|
|
36
|
-
const rule = this._regExpRules[i];
|
|
37
|
-
const regResult = [{
|
|
38
|
-
reg: rule.beforeText,
|
|
39
|
-
text: beforeEnterText
|
|
40
|
-
}, {
|
|
41
|
-
reg: rule.afterText,
|
|
42
|
-
text: afterEnterText
|
|
43
|
-
}, {
|
|
44
|
-
reg: rule.previousLineText,
|
|
45
|
-
text: previousLineText
|
|
46
|
-
}].every((obj) => {
|
|
47
|
-
if (!obj.reg) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
obj.reg.lastIndex = 0; // To disable the effect of the "g" flag.
|
|
51
|
-
return obj.reg.test(obj.text);
|
|
52
|
-
});
|
|
53
|
-
if (regResult) {
|
|
54
|
-
return rule.action;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// (2): Special indent-outdent
|
|
59
|
-
if (autoIndent >= 2 /* EditorAutoIndentStrategy.Brackets */) {
|
|
60
|
-
if (beforeEnterText.length > 0 && afterEnterText.length > 0) {
|
|
61
|
-
for (let i = 0, len = this._brackets.length; i < len; i++) {
|
|
62
|
-
const bracket = this._brackets[i];
|
|
63
|
-
if (bracket.openRegExp.test(beforeEnterText) && bracket.closeRegExp.test(afterEnterText)) {
|
|
64
|
-
return { indentAction: IndentAction.IndentOutdent };
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
// (4): Open bracket based logic
|
|
70
|
-
if (autoIndent >= 2 /* EditorAutoIndentStrategy.Brackets */) {
|
|
71
|
-
if (beforeEnterText.length > 0) {
|
|
72
|
-
for (let i = 0, len = this._brackets.length; i < len; i++) {
|
|
73
|
-
const bracket = this._brackets[i];
|
|
74
|
-
if (bracket.openRegExp.test(beforeEnterText)) {
|
|
75
|
-
return { indentAction: IndentAction.Indent };
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
static _createOpenBracketRegExp(bracket) {
|
|
83
|
-
let str = escapeRegExpCharacters(bracket);
|
|
84
|
-
if (!/\B/.test(str.charAt(0))) {
|
|
85
|
-
str = '\\b' + str;
|
|
86
|
-
}
|
|
87
|
-
str += '\\s*$';
|
|
88
|
-
return OnEnterSupport._safeRegExp(str);
|
|
89
|
-
}
|
|
90
|
-
static _createCloseBracketRegExp(bracket) {
|
|
91
|
-
let str = escapeRegExpCharacters(bracket);
|
|
92
|
-
if (!/\B/.test(str.charAt(str.length - 1))) {
|
|
93
|
-
str = str + '\\b';
|
|
94
|
-
}
|
|
95
|
-
str = '^\\s*' + str;
|
|
96
|
-
return OnEnterSupport._safeRegExp(str);
|
|
97
|
-
}
|
|
98
|
-
static _safeRegExp(def) {
|
|
99
|
-
try {
|
|
100
|
-
return new RegExp(def);
|
|
101
|
-
}
|
|
102
|
-
catch (err) {
|
|
103
|
-
onUnexpectedError(err);
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export { OnEnterSupport };
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { SingleCursorState, CursorState } from '../cursorCommon.js';
|
|
2
|
-
import { Position } from '../core/position.js';
|
|
3
|
-
import { Range } from '../core/range.js';
|
|
4
|
-
import { Selection } from '../core/selection.js';
|
|
5
|
-
|
|
6
|
-
/*---------------------------------------------------------------------------------------------
|
|
7
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
9
|
-
*--------------------------------------------------------------------------------------------*/
|
|
10
|
-
/**
|
|
11
|
-
* Represents a single cursor.
|
|
12
|
-
*/
|
|
13
|
-
class Cursor {
|
|
14
|
-
constructor(context) {
|
|
15
|
-
this._selTrackedRange = null;
|
|
16
|
-
this._trackSelection = true;
|
|
17
|
-
this._setState(context, new SingleCursorState(new Range(1, 1, 1, 1), 0 /* SelectionStartKind.Simple */, 0, new Position(1, 1), 0), new SingleCursorState(new Range(1, 1, 1, 1), 0 /* SelectionStartKind.Simple */, 0, new Position(1, 1), 0));
|
|
18
|
-
}
|
|
19
|
-
dispose(context) {
|
|
20
|
-
this._removeTrackedRange(context);
|
|
21
|
-
}
|
|
22
|
-
startTrackingSelection(context) {
|
|
23
|
-
this._trackSelection = true;
|
|
24
|
-
this._updateTrackedRange(context);
|
|
25
|
-
}
|
|
26
|
-
stopTrackingSelection(context) {
|
|
27
|
-
this._trackSelection = false;
|
|
28
|
-
this._removeTrackedRange(context);
|
|
29
|
-
}
|
|
30
|
-
_updateTrackedRange(context) {
|
|
31
|
-
if (!this._trackSelection) {
|
|
32
|
-
// don't track the selection
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
this._selTrackedRange = context.model._setTrackedRange(this._selTrackedRange, this.modelState.selection, 0 /* TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges */);
|
|
36
|
-
}
|
|
37
|
-
_removeTrackedRange(context) {
|
|
38
|
-
this._selTrackedRange = context.model._setTrackedRange(this._selTrackedRange, null, 0 /* TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges */);
|
|
39
|
-
}
|
|
40
|
-
asCursorState() {
|
|
41
|
-
return new CursorState(this.modelState, this.viewState);
|
|
42
|
-
}
|
|
43
|
-
readSelectionFromMarkers(context) {
|
|
44
|
-
const range = context.model._getTrackedRange(this._selTrackedRange);
|
|
45
|
-
if (this.modelState.selection.isEmpty() && !range.isEmpty()) {
|
|
46
|
-
// Avoid selecting text when recovering from markers
|
|
47
|
-
return Selection.fromRange(range.collapseToEnd(), this.modelState.selection.getDirection());
|
|
48
|
-
}
|
|
49
|
-
return Selection.fromRange(range, this.modelState.selection.getDirection());
|
|
50
|
-
}
|
|
51
|
-
ensureValidState(context) {
|
|
52
|
-
this._setState(context, this.modelState, this.viewState);
|
|
53
|
-
}
|
|
54
|
-
setState(context, modelState, viewState) {
|
|
55
|
-
this._setState(context, modelState, viewState);
|
|
56
|
-
}
|
|
57
|
-
static _validatePositionWithCache(viewModel, position, cacheInput, cacheOutput) {
|
|
58
|
-
if (position.equals(cacheInput)) {
|
|
59
|
-
return cacheOutput;
|
|
60
|
-
}
|
|
61
|
-
return viewModel.normalizePosition(position, 2 /* PositionAffinity.None */);
|
|
62
|
-
}
|
|
63
|
-
static _validateViewState(viewModel, viewState) {
|
|
64
|
-
const position = viewState.position;
|
|
65
|
-
const sStartPosition = viewState.selectionStart.getStartPosition();
|
|
66
|
-
const sEndPosition = viewState.selectionStart.getEndPosition();
|
|
67
|
-
const validPosition = viewModel.normalizePosition(position, 2 /* PositionAffinity.None */);
|
|
68
|
-
const validSStartPosition = this._validatePositionWithCache(viewModel, sStartPosition, position, validPosition);
|
|
69
|
-
const validSEndPosition = this._validatePositionWithCache(viewModel, sEndPosition, sStartPosition, validSStartPosition);
|
|
70
|
-
if (position.equals(validPosition) && sStartPosition.equals(validSStartPosition) && sEndPosition.equals(validSEndPosition)) {
|
|
71
|
-
// fast path: the state is valid
|
|
72
|
-
return viewState;
|
|
73
|
-
}
|
|
74
|
-
return new SingleCursorState(Range.fromPositions(validSStartPosition, validSEndPosition), viewState.selectionStartKind, viewState.selectionStartLeftoverVisibleColumns + sStartPosition.column - validSStartPosition.column, validPosition, viewState.leftoverVisibleColumns + position.column - validPosition.column);
|
|
75
|
-
}
|
|
76
|
-
_setState(context, modelState, viewState) {
|
|
77
|
-
if (viewState) {
|
|
78
|
-
viewState = Cursor._validateViewState(context.viewModel, viewState);
|
|
79
|
-
}
|
|
80
|
-
if (!modelState) {
|
|
81
|
-
if (!viewState) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
// We only have the view state => compute the model state
|
|
85
|
-
const selectionStart = context.model.validateRange(context.coordinatesConverter.convertViewRangeToModelRange(viewState.selectionStart));
|
|
86
|
-
const position = context.model.validatePosition(context.coordinatesConverter.convertViewPositionToModelPosition(viewState.position));
|
|
87
|
-
modelState = new SingleCursorState(selectionStart, viewState.selectionStartKind, viewState.selectionStartLeftoverVisibleColumns, position, viewState.leftoverVisibleColumns);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
// Validate new model state
|
|
91
|
-
const selectionStart = context.model.validateRange(modelState.selectionStart);
|
|
92
|
-
const selectionStartLeftoverVisibleColumns = modelState.selectionStart.equalsRange(selectionStart) ? modelState.selectionStartLeftoverVisibleColumns : 0;
|
|
93
|
-
const position = context.model.validatePosition(modelState.position);
|
|
94
|
-
const leftoverVisibleColumns = modelState.position.equals(position) ? modelState.leftoverVisibleColumns : 0;
|
|
95
|
-
modelState = new SingleCursorState(selectionStart, modelState.selectionStartKind, selectionStartLeftoverVisibleColumns, position, leftoverVisibleColumns);
|
|
96
|
-
}
|
|
97
|
-
if (!viewState) {
|
|
98
|
-
// We only have the model state => compute the view state
|
|
99
|
-
const viewSelectionStart1 = context.coordinatesConverter.convertModelPositionToViewPosition(new Position(modelState.selectionStart.startLineNumber, modelState.selectionStart.startColumn));
|
|
100
|
-
const viewSelectionStart2 = context.coordinatesConverter.convertModelPositionToViewPosition(new Position(modelState.selectionStart.endLineNumber, modelState.selectionStart.endColumn));
|
|
101
|
-
const viewSelectionStart = new Range(viewSelectionStart1.lineNumber, viewSelectionStart1.column, viewSelectionStart2.lineNumber, viewSelectionStart2.column);
|
|
102
|
-
const viewPosition = context.coordinatesConverter.convertModelPositionToViewPosition(modelState.position);
|
|
103
|
-
viewState = new SingleCursorState(viewSelectionStart, modelState.selectionStartKind, modelState.selectionStartLeftoverVisibleColumns, viewPosition, modelState.leftoverVisibleColumns);
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
// Validate new view state
|
|
107
|
-
const viewSelectionStart = context.coordinatesConverter.validateViewRange(viewState.selectionStart, modelState.selectionStart);
|
|
108
|
-
const viewPosition = context.coordinatesConverter.validateViewPosition(viewState.position, modelState.position);
|
|
109
|
-
viewState = new SingleCursorState(viewSelectionStart, modelState.selectionStartKind, modelState.selectionStartLeftoverVisibleColumns, viewPosition, modelState.leftoverVisibleColumns);
|
|
110
|
-
}
|
|
111
|
-
this.modelState = modelState;
|
|
112
|
-
this.viewState = viewState;
|
|
113
|
-
this._updateTrackedRange(context);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export { Cursor };
|