monaco-editor11 1.0.9 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/monaco-editor11.es.js +11 -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,173 +0,0 @@
|
|
|
1
|
-
import { ShiftCommand } from '../commands/shiftCommand.js';
|
|
2
|
-
import { CompositionSurroundSelectionCommand } from '../commands/surroundSelectionCommand.js';
|
|
3
|
-
import { isQuote, EditOperationResult } from '../cursorCommon.js';
|
|
4
|
-
import { PasteOperation, TabOperation, CompositionOperation, CompositionEndOvertypeOperation, shouldSurroundChar, AutoClosingOvertypeWithInterceptorsOperation, AutoClosingOpenCharTypeOperation, EnterOperation, AutoIndentOperation, AutoClosingOvertypeOperation, SurroundSelectionOperation, InterceptorElectricCharOperation, SimpleCharacterTypeOperation, TypeWithoutInterceptorsOperation } from './cursorTypeEditOperations.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
|
-
class TypeOperations {
|
|
11
|
-
static indent(config, model, selections) {
|
|
12
|
-
if (model === null || selections === null) {
|
|
13
|
-
return [];
|
|
14
|
-
}
|
|
15
|
-
const commands = [];
|
|
16
|
-
for (let i = 0, len = selections.length; i < len; i++) {
|
|
17
|
-
commands[i] = new ShiftCommand(selections[i], {
|
|
18
|
-
isUnshift: false,
|
|
19
|
-
tabSize: config.tabSize,
|
|
20
|
-
indentSize: config.indentSize,
|
|
21
|
-
insertSpaces: config.insertSpaces,
|
|
22
|
-
useTabStops: config.useTabStops,
|
|
23
|
-
autoIndent: config.autoIndent
|
|
24
|
-
}, config.languageConfigurationService);
|
|
25
|
-
}
|
|
26
|
-
return commands;
|
|
27
|
-
}
|
|
28
|
-
static outdent(config, model, selections) {
|
|
29
|
-
const commands = [];
|
|
30
|
-
for (let i = 0, len = selections.length; i < len; i++) {
|
|
31
|
-
commands[i] = new ShiftCommand(selections[i], {
|
|
32
|
-
isUnshift: true,
|
|
33
|
-
tabSize: config.tabSize,
|
|
34
|
-
indentSize: config.indentSize,
|
|
35
|
-
insertSpaces: config.insertSpaces,
|
|
36
|
-
useTabStops: config.useTabStops,
|
|
37
|
-
autoIndent: config.autoIndent
|
|
38
|
-
}, config.languageConfigurationService);
|
|
39
|
-
}
|
|
40
|
-
return commands;
|
|
41
|
-
}
|
|
42
|
-
static paste(config, model, selections, text, pasteOnNewLine, multicursorText) {
|
|
43
|
-
return PasteOperation.getEdits(config, model, selections, text, pasteOnNewLine, multicursorText);
|
|
44
|
-
}
|
|
45
|
-
static tab(config, model, selections) {
|
|
46
|
-
return TabOperation.getCommands(config, model, selections);
|
|
47
|
-
}
|
|
48
|
-
static compositionType(prevEditOperationType, config, model, selections, text, replacePrevCharCnt, replaceNextCharCnt, positionDelta) {
|
|
49
|
-
return CompositionOperation.getEdits(prevEditOperationType, config, model, selections, text, replacePrevCharCnt, replaceNextCharCnt, positionDelta);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* This is very similar with typing, but the character is already in the text buffer!
|
|
53
|
-
*/
|
|
54
|
-
static compositionEndWithInterceptors(prevEditOperationType, config, model, compositions, selections, autoClosedCharacters) {
|
|
55
|
-
if (!compositions) {
|
|
56
|
-
// could not deduce what the composition did
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
let insertedText = null;
|
|
60
|
-
for (const composition of compositions) {
|
|
61
|
-
if (insertedText === null) {
|
|
62
|
-
insertedText = composition.insertedText;
|
|
63
|
-
}
|
|
64
|
-
else if (insertedText !== composition.insertedText) {
|
|
65
|
-
// not all selections agree on what was typed
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (!insertedText || insertedText.length !== 1) {
|
|
70
|
-
// we're only interested in the case where a single character was inserted
|
|
71
|
-
return CompositionEndOvertypeOperation.getEdits(config, compositions);
|
|
72
|
-
}
|
|
73
|
-
const ch = insertedText;
|
|
74
|
-
let hasDeletion = false;
|
|
75
|
-
for (const composition of compositions) {
|
|
76
|
-
if (composition.deletedText.length !== 0) {
|
|
77
|
-
hasDeletion = true;
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (hasDeletion) {
|
|
82
|
-
// Check if this could have been a surround selection
|
|
83
|
-
if (!shouldSurroundChar(config, ch) || !config.surroundingPairs.hasOwnProperty(ch)) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
const isTypingAQuoteCharacter = isQuote(ch);
|
|
87
|
-
for (const composition of compositions) {
|
|
88
|
-
if (composition.deletedSelectionStart !== 0 || composition.deletedSelectionEnd !== composition.deletedText.length) {
|
|
89
|
-
// more text was deleted than was selected, so this could not have been a surround selection
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
if (/^[ \t]+$/.test(composition.deletedText)) {
|
|
93
|
-
// deleted text was only whitespace
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
if (isTypingAQuoteCharacter && isQuote(composition.deletedText)) {
|
|
97
|
-
// deleted text was a quote
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
const positions = [];
|
|
102
|
-
for (const selection of selections) {
|
|
103
|
-
if (!selection.isEmpty()) {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
positions.push(selection.getPosition());
|
|
107
|
-
}
|
|
108
|
-
if (positions.length !== compositions.length) {
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
const commands = [];
|
|
112
|
-
for (let i = 0, len = positions.length; i < len; i++) {
|
|
113
|
-
commands.push(new CompositionSurroundSelectionCommand(positions[i], compositions[i].deletedText, config.surroundingPairs[ch]));
|
|
114
|
-
}
|
|
115
|
-
return new EditOperationResult(4 /* EditOperationType.TypingOther */, commands, {
|
|
116
|
-
shouldPushStackElementBefore: true,
|
|
117
|
-
shouldPushStackElementAfter: false
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
const autoClosingOvertypeEdits = AutoClosingOvertypeWithInterceptorsOperation.getEdits(config, model, selections, autoClosedCharacters, ch);
|
|
121
|
-
if (autoClosingOvertypeEdits !== undefined) {
|
|
122
|
-
return autoClosingOvertypeEdits;
|
|
123
|
-
}
|
|
124
|
-
const autoClosingOpenCharEdits = AutoClosingOpenCharTypeOperation.getEdits(config, model, selections, ch, true, false);
|
|
125
|
-
if (autoClosingOpenCharEdits !== undefined) {
|
|
126
|
-
return autoClosingOpenCharEdits;
|
|
127
|
-
}
|
|
128
|
-
return CompositionEndOvertypeOperation.getEdits(config, compositions);
|
|
129
|
-
}
|
|
130
|
-
static typeWithInterceptors(isDoingComposition, prevEditOperationType, config, model, selections, autoClosedCharacters, ch) {
|
|
131
|
-
const enterEdits = EnterOperation.getEdits(config, model, selections, ch, isDoingComposition);
|
|
132
|
-
if (enterEdits !== undefined) {
|
|
133
|
-
return enterEdits;
|
|
134
|
-
}
|
|
135
|
-
const autoIndentEdits = AutoIndentOperation.getEdits(config, model, selections, ch, isDoingComposition);
|
|
136
|
-
if (autoIndentEdits !== undefined) {
|
|
137
|
-
return autoIndentEdits;
|
|
138
|
-
}
|
|
139
|
-
const autoClosingOverTypeEdits = AutoClosingOvertypeOperation.getEdits(prevEditOperationType, config, model, selections, autoClosedCharacters, ch);
|
|
140
|
-
if (autoClosingOverTypeEdits !== undefined) {
|
|
141
|
-
return autoClosingOverTypeEdits;
|
|
142
|
-
}
|
|
143
|
-
const autoClosingOpenCharEdits = AutoClosingOpenCharTypeOperation.getEdits(config, model, selections, ch, false, isDoingComposition);
|
|
144
|
-
if (autoClosingOpenCharEdits !== undefined) {
|
|
145
|
-
return autoClosingOpenCharEdits;
|
|
146
|
-
}
|
|
147
|
-
const surroundSelectionEdits = SurroundSelectionOperation.getEdits(config, model, selections, ch, isDoingComposition);
|
|
148
|
-
if (surroundSelectionEdits !== undefined) {
|
|
149
|
-
return surroundSelectionEdits;
|
|
150
|
-
}
|
|
151
|
-
const interceptorElectricCharOperation = InterceptorElectricCharOperation.getEdits(prevEditOperationType, config, model, selections, ch, isDoingComposition);
|
|
152
|
-
if (interceptorElectricCharOperation !== undefined) {
|
|
153
|
-
return interceptorElectricCharOperation;
|
|
154
|
-
}
|
|
155
|
-
return SimpleCharacterTypeOperation.getEdits(config, prevEditOperationType, selections, ch, isDoingComposition);
|
|
156
|
-
}
|
|
157
|
-
static typeWithoutInterceptors(prevEditOperationType, config, model, selections, str) {
|
|
158
|
-
return TypeWithoutInterceptorsOperation.getEdits(prevEditOperationType, selections, str);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
class CompositionOutcome {
|
|
162
|
-
constructor(deletedText, deletedSelectionStart, deletedSelectionEnd, insertedText, insertedSelectionStart, insertedSelectionEnd, insertedTextRange) {
|
|
163
|
-
this.deletedText = deletedText;
|
|
164
|
-
this.deletedSelectionStart = deletedSelectionStart;
|
|
165
|
-
this.deletedSelectionEnd = deletedSelectionEnd;
|
|
166
|
-
this.insertedText = insertedText;
|
|
167
|
-
this.insertedSelectionStart = insertedSelectionStart;
|
|
168
|
-
this.insertedSelectionEnd = insertedSelectionEnd;
|
|
169
|
-
this.insertedTextRange = insertedTextRange;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export { CompositionOutcome, TypeOperations };
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
function gotoNextSibling(newCursor, oldCursor) {
|
|
2
|
-
const n = newCursor.gotoNextSibling();
|
|
3
|
-
const o = oldCursor.gotoNextSibling();
|
|
4
|
-
if (n !== o) {
|
|
5
|
-
throw new Error('Trees are out of sync');
|
|
6
|
-
}
|
|
7
|
-
return n && o;
|
|
8
|
-
}
|
|
9
|
-
function gotoParent(newCursor, oldCursor) {
|
|
10
|
-
const n = newCursor.gotoParent();
|
|
11
|
-
const o = oldCursor.gotoParent();
|
|
12
|
-
if (n !== o) {
|
|
13
|
-
throw new Error('Trees are out of sync');
|
|
14
|
-
}
|
|
15
|
-
return n && o;
|
|
16
|
-
}
|
|
17
|
-
function gotoNthChild(newCursor, oldCursor, index) {
|
|
18
|
-
const n = newCursor.gotoFirstChild();
|
|
19
|
-
const o = oldCursor.gotoFirstChild();
|
|
20
|
-
if (n !== o) {
|
|
21
|
-
throw new Error('Trees are out of sync');
|
|
22
|
-
}
|
|
23
|
-
if (index === 0) {
|
|
24
|
-
return n && o;
|
|
25
|
-
}
|
|
26
|
-
for (let i = 1; i <= index; i++) {
|
|
27
|
-
const nn = newCursor.gotoNextSibling();
|
|
28
|
-
const oo = oldCursor.gotoNextSibling();
|
|
29
|
-
if (nn !== oo) {
|
|
30
|
-
throw new Error('Trees are out of sync');
|
|
31
|
-
}
|
|
32
|
-
if (!nn || !oo) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return n && o;
|
|
37
|
-
}
|
|
38
|
-
function nextSiblingOrParentSibling(newCursor, oldCursor) {
|
|
39
|
-
do {
|
|
40
|
-
if (newCursor.currentNode.nextSibling) {
|
|
41
|
-
return gotoNextSibling(newCursor, oldCursor);
|
|
42
|
-
}
|
|
43
|
-
if (newCursor.currentNode.parent) {
|
|
44
|
-
gotoParent(newCursor, oldCursor);
|
|
45
|
-
}
|
|
46
|
-
} while (newCursor.currentNode.nextSibling || newCursor.currentNode.parent);
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
function getClosestPreviousNodes(cursor, tree) {
|
|
50
|
-
// Go up parents until the end of the parent is before the start of the current.
|
|
51
|
-
const findPrev = tree.walk();
|
|
52
|
-
findPrev.resetTo(cursor);
|
|
53
|
-
const startingNode = cursor.currentNode;
|
|
54
|
-
do {
|
|
55
|
-
if (findPrev.currentNode.previousSibling && ((findPrev.currentNode.endIndex - findPrev.currentNode.startIndex) !== 0)) {
|
|
56
|
-
findPrev.gotoPreviousSibling();
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
while (!findPrev.currentNode.previousSibling && findPrev.currentNode.parent) {
|
|
60
|
-
findPrev.gotoParent();
|
|
61
|
-
}
|
|
62
|
-
findPrev.gotoPreviousSibling();
|
|
63
|
-
}
|
|
64
|
-
} while ((findPrev.currentNode.endIndex > startingNode.startIndex)
|
|
65
|
-
&& (findPrev.currentNode.parent || findPrev.currentNode.previousSibling)
|
|
66
|
-
&& (findPrev.currentNode.id !== startingNode.id));
|
|
67
|
-
if ((findPrev.currentNode.id !== startingNode.id) && findPrev.currentNode.endIndex <= startingNode.startIndex) {
|
|
68
|
-
return findPrev.currentNode;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export { getClosestPreviousNodes, gotoNextSibling, gotoNthChild, gotoParent, nextSiblingOrParentSibling };
|