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,9 +0,0 @@
|
|
|
1
|
-
import { createDecorator } from '../../../platform/instantiation/common/instantiation.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 ILanguageService = createDecorator('languageService');
|
|
8
|
-
|
|
9
|
-
export { ILanguageService };
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { CachedFunction } from '../../../../base/common/cache.js';
|
|
2
|
-
import { createBracketOrRegExp } from './richEditBrackets.js';
|
|
3
|
-
|
|
4
|
-
/*---------------------------------------------------------------------------------------------
|
|
5
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
7
|
-
*--------------------------------------------------------------------------------------------*/
|
|
8
|
-
/**
|
|
9
|
-
* Captures all bracket related configurations for a single language.
|
|
10
|
-
* Immutable.
|
|
11
|
-
*/
|
|
12
|
-
class LanguageBracketsConfiguration {
|
|
13
|
-
constructor(languageId, config) {
|
|
14
|
-
this.languageId = languageId;
|
|
15
|
-
const bracketPairs = config.brackets ? filterValidBrackets(config.brackets) : [];
|
|
16
|
-
const openingBracketInfos = new CachedFunction((bracket) => {
|
|
17
|
-
const closing = new Set();
|
|
18
|
-
return {
|
|
19
|
-
info: new OpeningBracketKind(this, bracket, closing),
|
|
20
|
-
closing,
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
const closingBracketInfos = new CachedFunction((bracket) => {
|
|
24
|
-
const opening = new Set();
|
|
25
|
-
const openingColorized = new Set();
|
|
26
|
-
return {
|
|
27
|
-
info: new ClosingBracketKind(this, bracket, opening, openingColorized),
|
|
28
|
-
opening,
|
|
29
|
-
openingColorized,
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
for (const [open, close] of bracketPairs) {
|
|
33
|
-
const opening = openingBracketInfos.get(open);
|
|
34
|
-
const closing = closingBracketInfos.get(close);
|
|
35
|
-
opening.closing.add(closing.info);
|
|
36
|
-
closing.opening.add(opening.info);
|
|
37
|
-
}
|
|
38
|
-
// Treat colorized brackets as brackets, and mark them as colorized.
|
|
39
|
-
const colorizedBracketPairs = config.colorizedBracketPairs
|
|
40
|
-
? filterValidBrackets(config.colorizedBracketPairs)
|
|
41
|
-
// If not configured: Take all brackets except `<` ... `>`
|
|
42
|
-
// Many languages set < ... > as bracket pair, even though they also use it as comparison operator.
|
|
43
|
-
// This leads to problems when colorizing this bracket, so we exclude it if not explicitly configured otherwise.
|
|
44
|
-
// https://github.com/microsoft/vscode/issues/132476
|
|
45
|
-
: bracketPairs.filter((p) => !(p[0] === '<' && p[1] === '>'));
|
|
46
|
-
for (const [open, close] of colorizedBracketPairs) {
|
|
47
|
-
const opening = openingBracketInfos.get(open);
|
|
48
|
-
const closing = closingBracketInfos.get(close);
|
|
49
|
-
opening.closing.add(closing.info);
|
|
50
|
-
closing.openingColorized.add(opening.info);
|
|
51
|
-
closing.opening.add(opening.info);
|
|
52
|
-
}
|
|
53
|
-
this._openingBrackets = new Map([...openingBracketInfos.cachedValues].map(([k, v]) => [k, v.info]));
|
|
54
|
-
this._closingBrackets = new Map([...closingBracketInfos.cachedValues].map(([k, v]) => [k, v.info]));
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* No two brackets have the same bracket text.
|
|
58
|
-
*/
|
|
59
|
-
get openingBrackets() {
|
|
60
|
-
return [...this._openingBrackets.values()];
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* No two brackets have the same bracket text.
|
|
64
|
-
*/
|
|
65
|
-
get closingBrackets() {
|
|
66
|
-
return [...this._closingBrackets.values()];
|
|
67
|
-
}
|
|
68
|
-
getOpeningBracketInfo(bracketText) {
|
|
69
|
-
return this._openingBrackets.get(bracketText);
|
|
70
|
-
}
|
|
71
|
-
getClosingBracketInfo(bracketText) {
|
|
72
|
-
return this._closingBrackets.get(bracketText);
|
|
73
|
-
}
|
|
74
|
-
getBracketInfo(bracketText) {
|
|
75
|
-
return this.getOpeningBracketInfo(bracketText) || this.getClosingBracketInfo(bracketText);
|
|
76
|
-
}
|
|
77
|
-
getBracketRegExp(options) {
|
|
78
|
-
const brackets = Array.from([...this._openingBrackets.keys(), ...this._closingBrackets.keys()]);
|
|
79
|
-
return createBracketOrRegExp(brackets, options);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function filterValidBrackets(bracketPairs) {
|
|
83
|
-
return bracketPairs.filter(([open, close]) => open !== '' && close !== '');
|
|
84
|
-
}
|
|
85
|
-
class BracketKindBase {
|
|
86
|
-
constructor(config, bracketText) {
|
|
87
|
-
this.config = config;
|
|
88
|
-
this.bracketText = bracketText;
|
|
89
|
-
}
|
|
90
|
-
get languageId() {
|
|
91
|
-
return this.config.languageId;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
class OpeningBracketKind extends BracketKindBase {
|
|
95
|
-
constructor(config, bracketText, openedBrackets) {
|
|
96
|
-
super(config, bracketText);
|
|
97
|
-
this.openedBrackets = openedBrackets;
|
|
98
|
-
this.isOpeningBracket = true;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
class ClosingBracketKind extends BracketKindBase {
|
|
102
|
-
constructor(config, bracketText,
|
|
103
|
-
/**
|
|
104
|
-
* Non empty array of all opening brackets this bracket closes.
|
|
105
|
-
*/
|
|
106
|
-
openingBrackets, openingColorizedBrackets) {
|
|
107
|
-
super(config, bracketText);
|
|
108
|
-
this.openingBrackets = openingBrackets;
|
|
109
|
-
this.openingColorizedBrackets = openingColorizedBrackets;
|
|
110
|
-
this.isOpeningBracket = false;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Checks if this bracket closes the given other bracket.
|
|
114
|
-
* If the bracket infos come from different configurations, this method will return false.
|
|
115
|
-
*/
|
|
116
|
-
closes(other) {
|
|
117
|
-
if (other['config'] !== this.config) {
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
return this.openingBrackets.has(other);
|
|
121
|
-
}
|
|
122
|
-
closesColorized(other) {
|
|
123
|
-
if (other['config'] !== this.config) {
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
126
|
-
return this.openingColorizedBrackets.has(other);
|
|
127
|
-
}
|
|
128
|
-
getOpeningBrackets() {
|
|
129
|
-
return [...this.openingBrackets];
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export { BracketKindBase, ClosingBracketKind, LanguageBracketsConfiguration, OpeningBracketKind };
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
/**
|
|
6
|
-
* Describes what to do with the indentation when pressing Enter.
|
|
7
|
-
*/
|
|
8
|
-
var IndentAction;
|
|
9
|
-
(function (IndentAction) {
|
|
10
|
-
/**
|
|
11
|
-
* Insert new line and copy the previous line's indentation.
|
|
12
|
-
*/
|
|
13
|
-
IndentAction[IndentAction["None"] = 0] = "None";
|
|
14
|
-
/**
|
|
15
|
-
* Insert new line and indent once (relative to the previous line's indentation).
|
|
16
|
-
*/
|
|
17
|
-
IndentAction[IndentAction["Indent"] = 1] = "Indent";
|
|
18
|
-
/**
|
|
19
|
-
* Insert two new lines:
|
|
20
|
-
* - the first one indented which will hold the cursor
|
|
21
|
-
* - the second one at the same indentation level
|
|
22
|
-
*/
|
|
23
|
-
IndentAction[IndentAction["IndentOutdent"] = 2] = "IndentOutdent";
|
|
24
|
-
/**
|
|
25
|
-
* Insert new line and outdent once (relative to the previous line's indentation).
|
|
26
|
-
*/
|
|
27
|
-
IndentAction[IndentAction["Outdent"] = 3] = "Outdent";
|
|
28
|
-
})(IndentAction || (IndentAction = {}));
|
|
29
|
-
/**
|
|
30
|
-
* @internal
|
|
31
|
-
*/
|
|
32
|
-
class StandardAutoClosingPairConditional {
|
|
33
|
-
constructor(source) {
|
|
34
|
-
this._neutralCharacter = null;
|
|
35
|
-
this._neutralCharacterSearched = false;
|
|
36
|
-
this.open = source.open;
|
|
37
|
-
this.close = source.close;
|
|
38
|
-
// initially allowed in all tokens
|
|
39
|
-
this._inString = true;
|
|
40
|
-
this._inComment = true;
|
|
41
|
-
this._inRegEx = true;
|
|
42
|
-
if (Array.isArray(source.notIn)) {
|
|
43
|
-
for (let i = 0, len = source.notIn.length; i < len; i++) {
|
|
44
|
-
const notIn = source.notIn[i];
|
|
45
|
-
switch (notIn) {
|
|
46
|
-
case 'string':
|
|
47
|
-
this._inString = false;
|
|
48
|
-
break;
|
|
49
|
-
case 'comment':
|
|
50
|
-
this._inComment = false;
|
|
51
|
-
break;
|
|
52
|
-
case 'regex':
|
|
53
|
-
this._inRegEx = false;
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
isOK(standardToken) {
|
|
60
|
-
switch (standardToken) {
|
|
61
|
-
case 0 /* StandardTokenType.Other */:
|
|
62
|
-
return true;
|
|
63
|
-
case 1 /* StandardTokenType.Comment */:
|
|
64
|
-
return this._inComment;
|
|
65
|
-
case 2 /* StandardTokenType.String */:
|
|
66
|
-
return this._inString;
|
|
67
|
-
case 3 /* StandardTokenType.RegEx */:
|
|
68
|
-
return this._inRegEx;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
shouldAutoClose(context, column) {
|
|
72
|
-
// Always complete on empty line
|
|
73
|
-
if (context.getTokenCount() === 0) {
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
const tokenIndex = context.findTokenIndexAtOffset(column - 2);
|
|
77
|
-
const standardTokenType = context.getStandardTokenType(tokenIndex);
|
|
78
|
-
return this.isOK(standardTokenType);
|
|
79
|
-
}
|
|
80
|
-
_findNeutralCharacterInRange(fromCharCode, toCharCode) {
|
|
81
|
-
for (let charCode = fromCharCode; charCode <= toCharCode; charCode++) {
|
|
82
|
-
const character = String.fromCharCode(charCode);
|
|
83
|
-
if (!this.open.includes(character) && !this.close.includes(character)) {
|
|
84
|
-
return character;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Find a character in the range [0-9a-zA-Z] that does not appear in the open or close
|
|
91
|
-
*/
|
|
92
|
-
findNeutralCharacter() {
|
|
93
|
-
if (!this._neutralCharacterSearched) {
|
|
94
|
-
this._neutralCharacterSearched = true;
|
|
95
|
-
if (!this._neutralCharacter) {
|
|
96
|
-
this._neutralCharacter = this._findNeutralCharacterInRange(48 /* CharCode.Digit0 */, 57 /* CharCode.Digit9 */);
|
|
97
|
-
}
|
|
98
|
-
if (!this._neutralCharacter) {
|
|
99
|
-
this._neutralCharacter = this._findNeutralCharacterInRange(97 /* CharCode.a */, 122 /* CharCode.z */);
|
|
100
|
-
}
|
|
101
|
-
if (!this._neutralCharacter) {
|
|
102
|
-
this._neutralCharacter = this._findNeutralCharacterInRange(65 /* CharCode.A */, 90 /* CharCode.Z */);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return this._neutralCharacter;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* @internal
|
|
110
|
-
*/
|
|
111
|
-
class AutoClosingPairs {
|
|
112
|
-
constructor(autoClosingPairs) {
|
|
113
|
-
this.autoClosingPairsOpenByStart = new Map();
|
|
114
|
-
this.autoClosingPairsOpenByEnd = new Map();
|
|
115
|
-
this.autoClosingPairsCloseByStart = new Map();
|
|
116
|
-
this.autoClosingPairsCloseByEnd = new Map();
|
|
117
|
-
this.autoClosingPairsCloseSingleChar = new Map();
|
|
118
|
-
for (const pair of autoClosingPairs) {
|
|
119
|
-
appendEntry(this.autoClosingPairsOpenByStart, pair.open.charAt(0), pair);
|
|
120
|
-
appendEntry(this.autoClosingPairsOpenByEnd, pair.open.charAt(pair.open.length - 1), pair);
|
|
121
|
-
appendEntry(this.autoClosingPairsCloseByStart, pair.close.charAt(0), pair);
|
|
122
|
-
appendEntry(this.autoClosingPairsCloseByEnd, pair.close.charAt(pair.close.length - 1), pair);
|
|
123
|
-
if (pair.close.length === 1 && pair.open.length === 1) {
|
|
124
|
-
appendEntry(this.autoClosingPairsCloseSingleChar, pair.close, pair);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
function appendEntry(target, key, value) {
|
|
130
|
-
if (target.has(key)) {
|
|
131
|
-
target.get(key).push(value);
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
target.set(key, [value]);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export { AutoClosingPairs, IndentAction, StandardAutoClosingPairConditional };
|
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
import { Emitter } from '../../../base/common/event.js';
|
|
2
|
-
import { Disposable, markAsSingleton, toDisposable } from '../../../base/common/lifecycle.js';
|
|
3
|
-
import { getLeadingWhitespace } from '../../../base/common/strings.js';
|
|
4
|
-
import { DEFAULT_WORD_REGEXP, ensureValidWordDefinition } from '../core/wordHelper.js';
|
|
5
|
-
import { AutoClosingPairs } from './languageConfiguration.js';
|
|
6
|
-
import { CharacterPairSupport } from './supports/characterPair.js';
|
|
7
|
-
import { BracketElectricCharacterSupport } from './supports/electricCharacter.js';
|
|
8
|
-
import { IndentRulesSupport } from './supports/indentRules.js';
|
|
9
|
-
import { OnEnterSupport } from './supports/onEnter.js';
|
|
10
|
-
import { RichEditBrackets } from './supports/richEditBrackets.js';
|
|
11
|
-
import { createDecorator } from '../../../platform/instantiation/common/instantiation.js';
|
|
12
|
-
import { IConfigurationService } from '../../../platform/configuration/common/configuration.js';
|
|
13
|
-
import { ILanguageService } from './language.js';
|
|
14
|
-
import { registerSingleton } from '../../../platform/instantiation/common/extensions.js';
|
|
15
|
-
import { PLAINTEXT_LANGUAGE_ID } from './modesRegistry.js';
|
|
16
|
-
import { LanguageBracketsConfiguration } from './supports/languageBracketsConfiguration.js';
|
|
17
|
-
|
|
18
|
-
/*---------------------------------------------------------------------------------------------
|
|
19
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
20
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
21
|
-
*--------------------------------------------------------------------------------------------*/
|
|
22
|
-
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
23
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
25
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
26
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
27
|
-
};
|
|
28
|
-
var __param = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
|
29
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
30
|
-
};
|
|
31
|
-
class LanguageConfigurationServiceChangeEvent {
|
|
32
|
-
constructor(languageId) {
|
|
33
|
-
this.languageId = languageId;
|
|
34
|
-
}
|
|
35
|
-
affects(languageId) {
|
|
36
|
-
return !this.languageId ? true : this.languageId === languageId;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const ILanguageConfigurationService = createDecorator('languageConfigurationService');
|
|
40
|
-
let LanguageConfigurationService = class LanguageConfigurationService extends Disposable {
|
|
41
|
-
constructor(configurationService, languageService) {
|
|
42
|
-
super();
|
|
43
|
-
this.configurationService = configurationService;
|
|
44
|
-
this.languageService = languageService;
|
|
45
|
-
this._registry = this._register(new LanguageConfigurationRegistry());
|
|
46
|
-
this.onDidChangeEmitter = this._register(new Emitter());
|
|
47
|
-
this.onDidChange = this.onDidChangeEmitter.event;
|
|
48
|
-
this.configurations = new Map();
|
|
49
|
-
const languageConfigKeys = new Set(Object.values(customizedLanguageConfigKeys));
|
|
50
|
-
this._register(this.configurationService.onDidChangeConfiguration((e) => {
|
|
51
|
-
const globalConfigChanged = e.change.keys.some((k) => languageConfigKeys.has(k));
|
|
52
|
-
const localConfigChanged = e.change.overrides
|
|
53
|
-
.filter(([overrideLangName, keys]) => keys.some((k) => languageConfigKeys.has(k)))
|
|
54
|
-
.map(([overrideLangName]) => overrideLangName);
|
|
55
|
-
if (globalConfigChanged) {
|
|
56
|
-
this.configurations.clear();
|
|
57
|
-
this.onDidChangeEmitter.fire(new LanguageConfigurationServiceChangeEvent(undefined));
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
for (const languageId of localConfigChanged) {
|
|
61
|
-
if (this.languageService.isRegisteredLanguageId(languageId)) {
|
|
62
|
-
this.configurations.delete(languageId);
|
|
63
|
-
this.onDidChangeEmitter.fire(new LanguageConfigurationServiceChangeEvent(languageId));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}));
|
|
68
|
-
this._register(this._registry.onDidChange((e) => {
|
|
69
|
-
this.configurations.delete(e.languageId);
|
|
70
|
-
this.onDidChangeEmitter.fire(new LanguageConfigurationServiceChangeEvent(e.languageId));
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
register(languageId, configuration, priority) {
|
|
74
|
-
return this._registry.register(languageId, configuration, priority);
|
|
75
|
-
}
|
|
76
|
-
getLanguageConfiguration(languageId) {
|
|
77
|
-
let result = this.configurations.get(languageId);
|
|
78
|
-
if (!result) {
|
|
79
|
-
result = computeConfig(languageId, this._registry, this.configurationService, this.languageService);
|
|
80
|
-
this.configurations.set(languageId, result);
|
|
81
|
-
}
|
|
82
|
-
return result;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
LanguageConfigurationService = __decorate([
|
|
86
|
-
__param(0, IConfigurationService),
|
|
87
|
-
__param(1, ILanguageService)
|
|
88
|
-
], LanguageConfigurationService);
|
|
89
|
-
function computeConfig(languageId, registry, configurationService, languageService) {
|
|
90
|
-
let languageConfig = registry.getLanguageConfiguration(languageId);
|
|
91
|
-
if (!languageConfig) {
|
|
92
|
-
if (!languageService.isRegisteredLanguageId(languageId)) {
|
|
93
|
-
// this happens for the null language, which can be returned by monarch.
|
|
94
|
-
// Instead of throwing an error, we just return a default config.
|
|
95
|
-
return new ResolvedLanguageConfiguration(languageId, {});
|
|
96
|
-
}
|
|
97
|
-
languageConfig = new ResolvedLanguageConfiguration(languageId, {});
|
|
98
|
-
}
|
|
99
|
-
const customizedConfig = getCustomizedLanguageConfig(languageConfig.languageId, configurationService);
|
|
100
|
-
const data = combineLanguageConfigurations([languageConfig.underlyingConfig, customizedConfig]);
|
|
101
|
-
const config = new ResolvedLanguageConfiguration(languageConfig.languageId, data);
|
|
102
|
-
return config;
|
|
103
|
-
}
|
|
104
|
-
const customizedLanguageConfigKeys = {
|
|
105
|
-
brackets: 'editor.language.brackets',
|
|
106
|
-
colorizedBracketPairs: 'editor.language.colorizedBracketPairs'
|
|
107
|
-
};
|
|
108
|
-
function getCustomizedLanguageConfig(languageId, configurationService) {
|
|
109
|
-
const brackets = configurationService.getValue(customizedLanguageConfigKeys.brackets, {
|
|
110
|
-
overrideIdentifier: languageId,
|
|
111
|
-
});
|
|
112
|
-
const colorizedBracketPairs = configurationService.getValue(customizedLanguageConfigKeys.colorizedBracketPairs, {
|
|
113
|
-
overrideIdentifier: languageId,
|
|
114
|
-
});
|
|
115
|
-
return {
|
|
116
|
-
brackets: validateBracketPairs(brackets),
|
|
117
|
-
colorizedBracketPairs: validateBracketPairs(colorizedBracketPairs),
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function validateBracketPairs(data) {
|
|
121
|
-
if (!Array.isArray(data)) {
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
return data.map(pair => {
|
|
125
|
-
if (!Array.isArray(pair) || pair.length !== 2) {
|
|
126
|
-
return undefined;
|
|
127
|
-
}
|
|
128
|
-
return [pair[0], pair[1]];
|
|
129
|
-
}).filter((p) => !!p);
|
|
130
|
-
}
|
|
131
|
-
function getIndentationAtPosition(model, lineNumber, column) {
|
|
132
|
-
const lineText = model.getLineContent(lineNumber);
|
|
133
|
-
let indentation = getLeadingWhitespace(lineText);
|
|
134
|
-
if (indentation.length > column - 1) {
|
|
135
|
-
indentation = indentation.substring(0, column - 1);
|
|
136
|
-
}
|
|
137
|
-
return indentation;
|
|
138
|
-
}
|
|
139
|
-
class ComposedLanguageConfiguration {
|
|
140
|
-
constructor(languageId) {
|
|
141
|
-
this.languageId = languageId;
|
|
142
|
-
this._resolved = null;
|
|
143
|
-
this._entries = [];
|
|
144
|
-
this._order = 0;
|
|
145
|
-
this._resolved = null;
|
|
146
|
-
}
|
|
147
|
-
register(configuration, priority) {
|
|
148
|
-
const entry = new LanguageConfigurationContribution(configuration, priority, ++this._order);
|
|
149
|
-
this._entries.push(entry);
|
|
150
|
-
this._resolved = null;
|
|
151
|
-
return markAsSingleton(toDisposable(() => {
|
|
152
|
-
for (let i = 0; i < this._entries.length; i++) {
|
|
153
|
-
if (this._entries[i] === entry) {
|
|
154
|
-
this._entries.splice(i, 1);
|
|
155
|
-
this._resolved = null;
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}));
|
|
160
|
-
}
|
|
161
|
-
getResolvedConfiguration() {
|
|
162
|
-
if (!this._resolved) {
|
|
163
|
-
const config = this._resolve();
|
|
164
|
-
if (config) {
|
|
165
|
-
this._resolved = new ResolvedLanguageConfiguration(this.languageId, config);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return this._resolved;
|
|
169
|
-
}
|
|
170
|
-
_resolve() {
|
|
171
|
-
if (this._entries.length === 0) {
|
|
172
|
-
return null;
|
|
173
|
-
}
|
|
174
|
-
this._entries.sort(LanguageConfigurationContribution.cmp);
|
|
175
|
-
return combineLanguageConfigurations(this._entries.map(e => e.configuration));
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
function combineLanguageConfigurations(configs) {
|
|
179
|
-
let result = {
|
|
180
|
-
comments: undefined,
|
|
181
|
-
brackets: undefined,
|
|
182
|
-
wordPattern: undefined,
|
|
183
|
-
indentationRules: undefined,
|
|
184
|
-
onEnterRules: undefined,
|
|
185
|
-
autoClosingPairs: undefined,
|
|
186
|
-
surroundingPairs: undefined,
|
|
187
|
-
autoCloseBefore: undefined,
|
|
188
|
-
folding: undefined,
|
|
189
|
-
colorizedBracketPairs: undefined,
|
|
190
|
-
__electricCharacterSupport: undefined,
|
|
191
|
-
};
|
|
192
|
-
for (const entry of configs) {
|
|
193
|
-
result = {
|
|
194
|
-
comments: entry.comments || result.comments,
|
|
195
|
-
brackets: entry.brackets || result.brackets,
|
|
196
|
-
wordPattern: entry.wordPattern || result.wordPattern,
|
|
197
|
-
indentationRules: entry.indentationRules || result.indentationRules,
|
|
198
|
-
onEnterRules: entry.onEnterRules || result.onEnterRules,
|
|
199
|
-
autoClosingPairs: entry.autoClosingPairs || result.autoClosingPairs,
|
|
200
|
-
surroundingPairs: entry.surroundingPairs || result.surroundingPairs,
|
|
201
|
-
autoCloseBefore: entry.autoCloseBefore || result.autoCloseBefore,
|
|
202
|
-
folding: entry.folding || result.folding,
|
|
203
|
-
colorizedBracketPairs: entry.colorizedBracketPairs || result.colorizedBracketPairs,
|
|
204
|
-
__electricCharacterSupport: entry.__electricCharacterSupport || result.__electricCharacterSupport,
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
return result;
|
|
208
|
-
}
|
|
209
|
-
class LanguageConfigurationContribution {
|
|
210
|
-
constructor(configuration, priority, order) {
|
|
211
|
-
this.configuration = configuration;
|
|
212
|
-
this.priority = priority;
|
|
213
|
-
this.order = order;
|
|
214
|
-
}
|
|
215
|
-
static cmp(a, b) {
|
|
216
|
-
if (a.priority === b.priority) {
|
|
217
|
-
// higher order last
|
|
218
|
-
return a.order - b.order;
|
|
219
|
-
}
|
|
220
|
-
// higher priority last
|
|
221
|
-
return a.priority - b.priority;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
class LanguageConfigurationChangeEvent {
|
|
225
|
-
constructor(languageId) {
|
|
226
|
-
this.languageId = languageId;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
class LanguageConfigurationRegistry extends Disposable {
|
|
230
|
-
constructor() {
|
|
231
|
-
super();
|
|
232
|
-
this._entries = new Map();
|
|
233
|
-
this._onDidChange = this._register(new Emitter());
|
|
234
|
-
this.onDidChange = this._onDidChange.event;
|
|
235
|
-
this._register(this.register(PLAINTEXT_LANGUAGE_ID, {
|
|
236
|
-
brackets: [
|
|
237
|
-
['(', ')'],
|
|
238
|
-
['[', ']'],
|
|
239
|
-
['{', '}'],
|
|
240
|
-
],
|
|
241
|
-
surroundingPairs: [
|
|
242
|
-
{ open: '{', close: '}' },
|
|
243
|
-
{ open: '[', close: ']' },
|
|
244
|
-
{ open: '(', close: ')' },
|
|
245
|
-
{ open: '<', close: '>' },
|
|
246
|
-
{ open: '\"', close: '\"' },
|
|
247
|
-
{ open: '\'', close: '\'' },
|
|
248
|
-
{ open: '`', close: '`' },
|
|
249
|
-
],
|
|
250
|
-
colorizedBracketPairs: [],
|
|
251
|
-
folding: {
|
|
252
|
-
offSide: true
|
|
253
|
-
}
|
|
254
|
-
}, 0));
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* @param priority Use a higher number for higher priority
|
|
258
|
-
*/
|
|
259
|
-
register(languageId, configuration, priority = 0) {
|
|
260
|
-
let entries = this._entries.get(languageId);
|
|
261
|
-
if (!entries) {
|
|
262
|
-
entries = new ComposedLanguageConfiguration(languageId);
|
|
263
|
-
this._entries.set(languageId, entries);
|
|
264
|
-
}
|
|
265
|
-
const disposable = entries.register(configuration, priority);
|
|
266
|
-
this._onDidChange.fire(new LanguageConfigurationChangeEvent(languageId));
|
|
267
|
-
return markAsSingleton(toDisposable(() => {
|
|
268
|
-
disposable.dispose();
|
|
269
|
-
this._onDidChange.fire(new LanguageConfigurationChangeEvent(languageId));
|
|
270
|
-
}));
|
|
271
|
-
}
|
|
272
|
-
getLanguageConfiguration(languageId) {
|
|
273
|
-
const entries = this._entries.get(languageId);
|
|
274
|
-
return entries?.getResolvedConfiguration() || null;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Immutable.
|
|
279
|
-
*/
|
|
280
|
-
class ResolvedLanguageConfiguration {
|
|
281
|
-
constructor(languageId, underlyingConfig) {
|
|
282
|
-
this.languageId = languageId;
|
|
283
|
-
this.underlyingConfig = underlyingConfig;
|
|
284
|
-
this._brackets = null;
|
|
285
|
-
this._electricCharacter = null;
|
|
286
|
-
this._onEnterSupport =
|
|
287
|
-
this.underlyingConfig.brackets ||
|
|
288
|
-
this.underlyingConfig.indentationRules ||
|
|
289
|
-
this.underlyingConfig.onEnterRules
|
|
290
|
-
? new OnEnterSupport(this.underlyingConfig)
|
|
291
|
-
: null;
|
|
292
|
-
this.comments = ResolvedLanguageConfiguration._handleComments(this.underlyingConfig);
|
|
293
|
-
this.characterPair = new CharacterPairSupport(this.underlyingConfig);
|
|
294
|
-
this.wordDefinition = this.underlyingConfig.wordPattern || DEFAULT_WORD_REGEXP;
|
|
295
|
-
this.indentationRules = this.underlyingConfig.indentationRules;
|
|
296
|
-
if (this.underlyingConfig.indentationRules) {
|
|
297
|
-
this.indentRulesSupport = new IndentRulesSupport(this.underlyingConfig.indentationRules);
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
this.indentRulesSupport = null;
|
|
301
|
-
}
|
|
302
|
-
this.foldingRules = this.underlyingConfig.folding || {};
|
|
303
|
-
this.bracketsNew = new LanguageBracketsConfiguration(languageId, this.underlyingConfig);
|
|
304
|
-
}
|
|
305
|
-
getWordDefinition() {
|
|
306
|
-
return ensureValidWordDefinition(this.wordDefinition);
|
|
307
|
-
}
|
|
308
|
-
get brackets() {
|
|
309
|
-
if (!this._brackets && this.underlyingConfig.brackets) {
|
|
310
|
-
this._brackets = new RichEditBrackets(this.languageId, this.underlyingConfig.brackets);
|
|
311
|
-
}
|
|
312
|
-
return this._brackets;
|
|
313
|
-
}
|
|
314
|
-
get electricCharacter() {
|
|
315
|
-
if (!this._electricCharacter) {
|
|
316
|
-
this._electricCharacter = new BracketElectricCharacterSupport(this.brackets);
|
|
317
|
-
}
|
|
318
|
-
return this._electricCharacter;
|
|
319
|
-
}
|
|
320
|
-
onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText) {
|
|
321
|
-
if (!this._onEnterSupport) {
|
|
322
|
-
return null;
|
|
323
|
-
}
|
|
324
|
-
return this._onEnterSupport.onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText);
|
|
325
|
-
}
|
|
326
|
-
getAutoClosingPairs() {
|
|
327
|
-
return new AutoClosingPairs(this.characterPair.getAutoClosingPairs());
|
|
328
|
-
}
|
|
329
|
-
getAutoCloseBeforeSet(forQuotes) {
|
|
330
|
-
return this.characterPair.getAutoCloseBeforeSet(forQuotes);
|
|
331
|
-
}
|
|
332
|
-
getSurroundingPairs() {
|
|
333
|
-
return this.characterPair.getSurroundingPairs();
|
|
334
|
-
}
|
|
335
|
-
static _handleComments(conf) {
|
|
336
|
-
const commentRule = conf.comments;
|
|
337
|
-
if (!commentRule) {
|
|
338
|
-
return null;
|
|
339
|
-
}
|
|
340
|
-
// comment configuration
|
|
341
|
-
const comments = {};
|
|
342
|
-
if (commentRule.lineComment) {
|
|
343
|
-
if (typeof commentRule.lineComment === 'string') {
|
|
344
|
-
comments.lineCommentToken = commentRule.lineComment;
|
|
345
|
-
}
|
|
346
|
-
else {
|
|
347
|
-
comments.lineCommentToken = commentRule.lineComment.comment;
|
|
348
|
-
comments.lineCommentNoIndent = commentRule.lineComment.noIndent;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
if (commentRule.blockComment) {
|
|
352
|
-
const [blockStart, blockEnd] = commentRule.blockComment;
|
|
353
|
-
comments.blockCommentStartToken = blockStart;
|
|
354
|
-
comments.blockCommentEndToken = blockEnd;
|
|
355
|
-
}
|
|
356
|
-
return comments;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
registerSingleton(ILanguageConfigurationService, LanguageConfigurationService, 1 /* InstantiationType.Delayed */);
|
|
360
|
-
|
|
361
|
-
export { ILanguageConfigurationService, LanguageConfigurationChangeEvent, LanguageConfigurationRegistry, LanguageConfigurationService, LanguageConfigurationServiceChangeEvent, ResolvedLanguageConfiguration, getIndentationAtPosition };
|