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,128 +0,0 @@
|
|
|
1
|
-
import { isMultilineRegexSource } from '../model/textModelSearch.js';
|
|
2
|
-
import { regExpLeadsToEndlessLoop } from '../../../base/common/strings.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
|
-
const trimDashesRegex = /^-+|-+$/g;
|
|
9
|
-
const CHUNK_SIZE = 100;
|
|
10
|
-
const MAX_SECTION_LINES = 5;
|
|
11
|
-
/**
|
|
12
|
-
* Find section headers in the model.
|
|
13
|
-
*
|
|
14
|
-
* @param model the text model to search in
|
|
15
|
-
* @param options options to search with
|
|
16
|
-
* @returns an array of section headers
|
|
17
|
-
*/
|
|
18
|
-
function findSectionHeaders(model, options) {
|
|
19
|
-
let headers = [];
|
|
20
|
-
if (options.findRegionSectionHeaders && options.foldingRules?.markers) {
|
|
21
|
-
const regionHeaders = collectRegionHeaders(model, options);
|
|
22
|
-
headers = headers.concat(regionHeaders);
|
|
23
|
-
}
|
|
24
|
-
if (options.findMarkSectionHeaders) {
|
|
25
|
-
const markHeaders = collectMarkHeaders(model, options);
|
|
26
|
-
headers = headers.concat(markHeaders);
|
|
27
|
-
}
|
|
28
|
-
return headers;
|
|
29
|
-
}
|
|
30
|
-
function collectRegionHeaders(model, options) {
|
|
31
|
-
const regionHeaders = [];
|
|
32
|
-
const endLineNumber = model.getLineCount();
|
|
33
|
-
for (let lineNumber = 1; lineNumber <= endLineNumber; lineNumber++) {
|
|
34
|
-
const lineContent = model.getLineContent(lineNumber);
|
|
35
|
-
const match = lineContent.match(options.foldingRules.markers.start);
|
|
36
|
-
if (match) {
|
|
37
|
-
const range = { startLineNumber: lineNumber, startColumn: match[0].length + 1, endLineNumber: lineNumber, endColumn: lineContent.length + 1 };
|
|
38
|
-
if (range.endColumn > range.startColumn) {
|
|
39
|
-
const sectionHeader = {
|
|
40
|
-
range,
|
|
41
|
-
...getHeaderText(lineContent.substring(match[0].length)),
|
|
42
|
-
shouldBeInComments: false
|
|
43
|
-
};
|
|
44
|
-
if (sectionHeader.text || sectionHeader.hasSeparatorLine) {
|
|
45
|
-
regionHeaders.push(sectionHeader);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return regionHeaders;
|
|
51
|
-
}
|
|
52
|
-
function collectMarkHeaders(model, options) {
|
|
53
|
-
const markHeaders = [];
|
|
54
|
-
const endLineNumber = model.getLineCount();
|
|
55
|
-
// Validate regex to prevent infinite loops
|
|
56
|
-
if (!options.markSectionHeaderRegex || options.markSectionHeaderRegex.trim() === '') {
|
|
57
|
-
return markHeaders;
|
|
58
|
-
}
|
|
59
|
-
// Create regex with flags for:
|
|
60
|
-
// - 'd' for indices to get proper match positions
|
|
61
|
-
// - 'm' for multi-line mode so ^ and $ match line starts/ends
|
|
62
|
-
// - 's' for dot-all mode so . matches newlines
|
|
63
|
-
const multiline = isMultilineRegexSource(options.markSectionHeaderRegex);
|
|
64
|
-
const regex = new RegExp(options.markSectionHeaderRegex, `gdm${multiline ? 's' : ''}`);
|
|
65
|
-
// Check if the regex would lead to an endless loop
|
|
66
|
-
if (regExpLeadsToEndlessLoop(regex)) {
|
|
67
|
-
return markHeaders;
|
|
68
|
-
}
|
|
69
|
-
// Process text in overlapping chunks for better performance
|
|
70
|
-
for (let startLine = 1; startLine <= endLineNumber; startLine += CHUNK_SIZE - MAX_SECTION_LINES) {
|
|
71
|
-
const endLine = Math.min(startLine + CHUNK_SIZE - 1, endLineNumber);
|
|
72
|
-
const lines = [];
|
|
73
|
-
// Collect lines for the current chunk
|
|
74
|
-
for (let i = startLine; i <= endLine; i++) {
|
|
75
|
-
lines.push(model.getLineContent(i));
|
|
76
|
-
}
|
|
77
|
-
const text = lines.join('\n');
|
|
78
|
-
regex.lastIndex = 0;
|
|
79
|
-
let match;
|
|
80
|
-
while ((match = regex.exec(text)) !== null) {
|
|
81
|
-
// Calculate which line this match starts on by counting newlines before it
|
|
82
|
-
const precedingText = text.substring(0, match.index);
|
|
83
|
-
const lineOffset = (precedingText.match(/\n/g) || []).length;
|
|
84
|
-
const lineNumber = startLine + lineOffset;
|
|
85
|
-
// Calculate match height to check overlap properly
|
|
86
|
-
const matchLines = match[0].split('\n');
|
|
87
|
-
const matchHeight = matchLines.length;
|
|
88
|
-
const matchEndLine = lineNumber + matchHeight - 1;
|
|
89
|
-
// Calculate start column - need to find the start of the line containing the match
|
|
90
|
-
const lineStartIndex = precedingText.lastIndexOf('\n') + 1;
|
|
91
|
-
const startColumn = match.index - lineStartIndex + 1;
|
|
92
|
-
// Calculate end column - need to handle multi-line matches
|
|
93
|
-
const lastMatchLine = matchLines[matchLines.length - 1];
|
|
94
|
-
const endColumn = matchHeight === 1 ? startColumn + match[0].length : lastMatchLine.length + 1;
|
|
95
|
-
const range = {
|
|
96
|
-
startLineNumber: lineNumber,
|
|
97
|
-
startColumn,
|
|
98
|
-
endLineNumber: matchEndLine,
|
|
99
|
-
endColumn
|
|
100
|
-
};
|
|
101
|
-
const text2 = (match.groups ?? {})['label'] ?? '';
|
|
102
|
-
const hasSeparatorLine = ((match.groups ?? {})['separator'] ?? '') !== '';
|
|
103
|
-
const sectionHeader = {
|
|
104
|
-
range,
|
|
105
|
-
text: text2,
|
|
106
|
-
hasSeparatorLine,
|
|
107
|
-
shouldBeInComments: true
|
|
108
|
-
};
|
|
109
|
-
if (sectionHeader.text || sectionHeader.hasSeparatorLine) {
|
|
110
|
-
// only push if the previous one doesn't have this same linbe
|
|
111
|
-
if (markHeaders.length === 0 || markHeaders[markHeaders.length - 1].range.endLineNumber < sectionHeader.range.startLineNumber) {
|
|
112
|
-
markHeaders.push(sectionHeader);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
// Move lastIndex past the current match to avoid infinite loop
|
|
116
|
-
regex.lastIndex = match.index + match[0].length;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return markHeaders;
|
|
120
|
-
}
|
|
121
|
-
function getHeaderText(text) {
|
|
122
|
-
text = text.trim();
|
|
123
|
-
const hasSeparatorLine = text.startsWith('-');
|
|
124
|
-
text = text.replace(trimDashesRegex, '');
|
|
125
|
-
return { text, hasSeparatorLine };
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export { collectMarkHeaders, findSectionHeaders };
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { LanguageAgnosticBracketTokens } from './bracketPairsTree/brackets.js';
|
|
2
|
-
import { lengthAdd, lengthGetColumnCountIfZeroLineCount, lengthZero } from './bracketPairsTree/length.js';
|
|
3
|
-
import { parseDocument } from './bracketPairsTree/parser.js';
|
|
4
|
-
import { DenseKeyProvider } from './bracketPairsTree/smallImmutableSet.js';
|
|
5
|
-
import { TextBufferTokenizer } from './bracketPairsTree/tokenizer.js';
|
|
6
|
-
|
|
7
|
-
/*---------------------------------------------------------------------------------------------
|
|
8
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
10
|
-
*--------------------------------------------------------------------------------------------*/
|
|
11
|
-
function fixBracketsInLine(tokens, languageConfigurationService) {
|
|
12
|
-
const denseKeyProvider = new DenseKeyProvider();
|
|
13
|
-
const bracketTokens = new LanguageAgnosticBracketTokens(denseKeyProvider, (languageId) => languageConfigurationService.getLanguageConfiguration(languageId));
|
|
14
|
-
const tokenizer = new TextBufferTokenizer(new StaticTokenizerSource([tokens]), bracketTokens);
|
|
15
|
-
const node = parseDocument(tokenizer, [], undefined, true);
|
|
16
|
-
let str = '';
|
|
17
|
-
const line = tokens.getLineContent();
|
|
18
|
-
function processNode(node, offset) {
|
|
19
|
-
if (node.kind === 2 /* AstNodeKind.Pair */) {
|
|
20
|
-
processNode(node.openingBracket, offset);
|
|
21
|
-
offset = lengthAdd(offset, node.openingBracket.length);
|
|
22
|
-
if (node.child) {
|
|
23
|
-
processNode(node.child, offset);
|
|
24
|
-
offset = lengthAdd(offset, node.child.length);
|
|
25
|
-
}
|
|
26
|
-
if (node.closingBracket) {
|
|
27
|
-
processNode(node.closingBracket, offset);
|
|
28
|
-
offset = lengthAdd(offset, node.closingBracket.length);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
const singleLangBracketTokens = bracketTokens.getSingleLanguageBracketTokens(node.openingBracket.languageId);
|
|
32
|
-
const closingTokenText = singleLangBracketTokens.findClosingTokenText(node.openingBracket.bracketIds);
|
|
33
|
-
str += closingTokenText;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
else if (node.kind === 3 /* AstNodeKind.UnexpectedClosingBracket */) ;
|
|
37
|
-
else if (node.kind === 0 /* AstNodeKind.Text */ || node.kind === 1 /* AstNodeKind.Bracket */) {
|
|
38
|
-
str += line.substring(lengthGetColumnCountIfZeroLineCount(offset), lengthGetColumnCountIfZeroLineCount(lengthAdd(offset, node.length)));
|
|
39
|
-
}
|
|
40
|
-
else if (node.kind === 4 /* AstNodeKind.List */) {
|
|
41
|
-
for (const child of node.children) {
|
|
42
|
-
processNode(child, offset);
|
|
43
|
-
offset = lengthAdd(offset, child.length);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
processNode(node, lengthZero);
|
|
48
|
-
return str;
|
|
49
|
-
}
|
|
50
|
-
class StaticTokenizerSource {
|
|
51
|
-
constructor(lines) {
|
|
52
|
-
this.lines = lines;
|
|
53
|
-
this.tokenization = {
|
|
54
|
-
getLineTokens: (lineNumber) => {
|
|
55
|
-
return this.lines[lineNumber - 1];
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
getLineCount() {
|
|
60
|
-
return this.lines.length;
|
|
61
|
-
}
|
|
62
|
-
getLineLength(lineNumber) {
|
|
63
|
-
return this.lines[lineNumber - 1].getLineContent().length;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export { fixBracketsInLine };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { arrayInsert } from '../../../base/common/arrays.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
|
-
* An array that avoids being sparse by always
|
|
9
|
-
* filling up unused indices with a default value.
|
|
10
|
-
*/
|
|
11
|
-
class FixedArray {
|
|
12
|
-
constructor(_default) {
|
|
13
|
-
this._default = _default;
|
|
14
|
-
this._store = [];
|
|
15
|
-
}
|
|
16
|
-
get(index) {
|
|
17
|
-
if (index < this._store.length) {
|
|
18
|
-
return this._store[index];
|
|
19
|
-
}
|
|
20
|
-
return this._default;
|
|
21
|
-
}
|
|
22
|
-
set(index, value) {
|
|
23
|
-
while (index >= this._store.length) {
|
|
24
|
-
this._store[this._store.length] = this._default;
|
|
25
|
-
}
|
|
26
|
-
this._store[index] = value;
|
|
27
|
-
}
|
|
28
|
-
replace(index, oldLength, newLength) {
|
|
29
|
-
if (index >= this._store.length) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (oldLength === 0) {
|
|
33
|
-
this.insert(index, newLength);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
else if (newLength === 0) {
|
|
37
|
-
this.delete(index, oldLength);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const before = this._store.slice(0, index);
|
|
41
|
-
const after = this._store.slice(index + oldLength);
|
|
42
|
-
const insertArr = arrayFill(newLength, this._default);
|
|
43
|
-
this._store = before.concat(insertArr, after);
|
|
44
|
-
}
|
|
45
|
-
delete(deleteIndex, deleteCount) {
|
|
46
|
-
if (deleteCount === 0 || deleteIndex >= this._store.length) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
this._store.splice(deleteIndex, deleteCount);
|
|
50
|
-
}
|
|
51
|
-
insert(insertIndex, insertCount) {
|
|
52
|
-
if (insertCount === 0 || insertIndex >= this._store.length) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const arr = [];
|
|
56
|
-
for (let i = 0; i < insertCount; i++) {
|
|
57
|
-
arr[i] = this._default;
|
|
58
|
-
}
|
|
59
|
-
this._store = arrayInsert(this._store, insertIndex, arr);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function arrayFill(length, value) {
|
|
63
|
-
const arr = [];
|
|
64
|
-
for (let i = 0; i < length; i++) {
|
|
65
|
-
arr[i] = value;
|
|
66
|
-
}
|
|
67
|
-
return arr;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { FixedArray };
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { isMacintosh, isWindows } from '../../../base/common/platform.js';
|
|
2
|
-
import { EditorZoom } from './editorZoom.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
|
-
* Determined from empirical observations.
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
const GOLDEN_LINE_HEIGHT_RATIO = isMacintosh ? 1.5 : 1.35;
|
|
13
|
-
/**
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
const MINIMUM_LINE_HEIGHT = 8;
|
|
17
|
-
class BareFontInfo {
|
|
18
|
-
/**
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
static _create(fontFamily, fontWeight, fontSize, fontFeatureSettings, fontVariationSettings, lineHeight, letterSpacing, pixelRatio, ignoreEditorZoom) {
|
|
22
|
-
if (lineHeight === 0) {
|
|
23
|
-
lineHeight = GOLDEN_LINE_HEIGHT_RATIO * fontSize;
|
|
24
|
-
}
|
|
25
|
-
else if (lineHeight < MINIMUM_LINE_HEIGHT) {
|
|
26
|
-
// Values too small to be line heights in pixels are in ems.
|
|
27
|
-
lineHeight = lineHeight * fontSize;
|
|
28
|
-
}
|
|
29
|
-
// Enforce integer, minimum constraints
|
|
30
|
-
lineHeight = Math.round(lineHeight);
|
|
31
|
-
if (lineHeight < MINIMUM_LINE_HEIGHT) {
|
|
32
|
-
lineHeight = MINIMUM_LINE_HEIGHT;
|
|
33
|
-
}
|
|
34
|
-
const editorZoomLevelMultiplier = 1 + (ignoreEditorZoom ? 0 : EditorZoom.getZoomLevel() * 0.1);
|
|
35
|
-
fontSize *= editorZoomLevelMultiplier;
|
|
36
|
-
lineHeight *= editorZoomLevelMultiplier;
|
|
37
|
-
if (fontVariationSettings === FONT_VARIATION_TRANSLATE) {
|
|
38
|
-
if (fontWeight === 'normal' || fontWeight === 'bold') {
|
|
39
|
-
fontVariationSettings = FONT_VARIATION_OFF;
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
const fontWeightAsNumber = parseInt(fontWeight, 10);
|
|
43
|
-
fontVariationSettings = `'wght' ${fontWeightAsNumber}`;
|
|
44
|
-
fontWeight = 'normal';
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return new BareFontInfo({
|
|
48
|
-
pixelRatio: pixelRatio,
|
|
49
|
-
fontFamily: fontFamily,
|
|
50
|
-
fontWeight: fontWeight,
|
|
51
|
-
fontSize: fontSize,
|
|
52
|
-
fontFeatureSettings: fontFeatureSettings,
|
|
53
|
-
fontVariationSettings,
|
|
54
|
-
lineHeight: lineHeight,
|
|
55
|
-
letterSpacing: letterSpacing
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* @internal
|
|
60
|
-
*/
|
|
61
|
-
constructor(opts) {
|
|
62
|
-
this._bareFontInfoBrand = undefined;
|
|
63
|
-
this.pixelRatio = opts.pixelRatio;
|
|
64
|
-
this.fontFamily = String(opts.fontFamily);
|
|
65
|
-
this.fontWeight = String(opts.fontWeight);
|
|
66
|
-
this.fontSize = opts.fontSize;
|
|
67
|
-
this.fontFeatureSettings = opts.fontFeatureSettings;
|
|
68
|
-
this.fontVariationSettings = opts.fontVariationSettings;
|
|
69
|
-
this.lineHeight = opts.lineHeight | 0;
|
|
70
|
-
this.letterSpacing = opts.letterSpacing;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* @internal
|
|
74
|
-
*/
|
|
75
|
-
getId() {
|
|
76
|
-
return `${this.pixelRatio}-${this.fontFamily}-${this.fontWeight}-${this.fontSize}-${this.fontFeatureSettings}-${this.fontVariationSettings}-${this.lineHeight}-${this.letterSpacing}`;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* @internal
|
|
80
|
-
*/
|
|
81
|
-
getMassagedFontFamily() {
|
|
82
|
-
const fallbackFontFamily = EDITOR_FONT_DEFAULTS.fontFamily;
|
|
83
|
-
const fontFamily = BareFontInfo._wrapInQuotes(this.fontFamily);
|
|
84
|
-
if (this.fontFamily !== fallbackFontFamily) {
|
|
85
|
-
return `${fontFamily}, ${fallbackFontFamily}`;
|
|
86
|
-
}
|
|
87
|
-
return fontFamily;
|
|
88
|
-
}
|
|
89
|
-
static _wrapInQuotes(fontFamily) {
|
|
90
|
-
if (/[,"']/.test(fontFamily)) {
|
|
91
|
-
// Looks like the font family might be already escaped
|
|
92
|
-
return fontFamily;
|
|
93
|
-
}
|
|
94
|
-
if (/[+ ]/.test(fontFamily)) {
|
|
95
|
-
// Wrap a font family using + or <space> with quotes
|
|
96
|
-
return `"${fontFamily}"`;
|
|
97
|
-
}
|
|
98
|
-
return fontFamily;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
// change this whenever `FontInfo` members are changed
|
|
102
|
-
const SERIALIZED_FONT_INFO_VERSION = 2;
|
|
103
|
-
class FontInfo extends BareFontInfo {
|
|
104
|
-
/**
|
|
105
|
-
* @internal
|
|
106
|
-
*/
|
|
107
|
-
constructor(opts, isTrusted) {
|
|
108
|
-
super(opts);
|
|
109
|
-
this._editorStylingBrand = undefined;
|
|
110
|
-
this.version = SERIALIZED_FONT_INFO_VERSION;
|
|
111
|
-
this.isTrusted = isTrusted;
|
|
112
|
-
this.isMonospace = opts.isMonospace;
|
|
113
|
-
this.typicalHalfwidthCharacterWidth = opts.typicalHalfwidthCharacterWidth;
|
|
114
|
-
this.typicalFullwidthCharacterWidth = opts.typicalFullwidthCharacterWidth;
|
|
115
|
-
this.canUseHalfwidthRightwardsArrow = opts.canUseHalfwidthRightwardsArrow;
|
|
116
|
-
this.spaceWidth = opts.spaceWidth;
|
|
117
|
-
this.middotWidth = opts.middotWidth;
|
|
118
|
-
this.wsmiddotWidth = opts.wsmiddotWidth;
|
|
119
|
-
this.maxDigitWidth = opts.maxDigitWidth;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* @internal
|
|
123
|
-
*/
|
|
124
|
-
equals(other) {
|
|
125
|
-
return (this.fontFamily === other.fontFamily
|
|
126
|
-
&& this.fontWeight === other.fontWeight
|
|
127
|
-
&& this.fontSize === other.fontSize
|
|
128
|
-
&& this.fontFeatureSettings === other.fontFeatureSettings
|
|
129
|
-
&& this.fontVariationSettings === other.fontVariationSettings
|
|
130
|
-
&& this.lineHeight === other.lineHeight
|
|
131
|
-
&& this.letterSpacing === other.letterSpacing
|
|
132
|
-
&& this.typicalHalfwidthCharacterWidth === other.typicalHalfwidthCharacterWidth
|
|
133
|
-
&& this.typicalFullwidthCharacterWidth === other.typicalFullwidthCharacterWidth
|
|
134
|
-
&& this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow
|
|
135
|
-
&& this.spaceWidth === other.spaceWidth
|
|
136
|
-
&& this.middotWidth === other.middotWidth
|
|
137
|
-
&& this.wsmiddotWidth === other.wsmiddotWidth
|
|
138
|
-
&& this.maxDigitWidth === other.maxDigitWidth);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* @internal
|
|
143
|
-
*/
|
|
144
|
-
const FONT_VARIATION_OFF = 'normal';
|
|
145
|
-
/**
|
|
146
|
-
* @internal
|
|
147
|
-
*/
|
|
148
|
-
const FONT_VARIATION_TRANSLATE = 'translate';
|
|
149
|
-
/**
|
|
150
|
-
* @internal
|
|
151
|
-
*/
|
|
152
|
-
const DEFAULT_WINDOWS_FONT_FAMILY = 'Consolas, \'Courier New\', monospace';
|
|
153
|
-
/**
|
|
154
|
-
* @internal
|
|
155
|
-
*/
|
|
156
|
-
const DEFAULT_MAC_FONT_FAMILY = 'Menlo, Monaco, \'Courier New\', monospace';
|
|
157
|
-
/**
|
|
158
|
-
* @internal
|
|
159
|
-
*/
|
|
160
|
-
const DEFAULT_LINUX_FONT_FAMILY = '\'Droid Sans Mono\', \'monospace\', monospace';
|
|
161
|
-
/**
|
|
162
|
-
* @internal
|
|
163
|
-
*/
|
|
164
|
-
const EDITOR_FONT_DEFAULTS = {
|
|
165
|
-
fontFamily: (isMacintosh ? DEFAULT_MAC_FONT_FAMILY : (isWindows ? DEFAULT_WINDOWS_FONT_FAMILY : DEFAULT_LINUX_FONT_FAMILY)),
|
|
166
|
-
fontWeight: 'normal',
|
|
167
|
-
fontSize: (isMacintosh ? 12 : 14),
|
|
168
|
-
lineHeight: 0,
|
|
169
|
-
letterSpacing: 0,
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export { BareFontInfo, DEFAULT_LINUX_FONT_FAMILY, DEFAULT_MAC_FONT_FAMILY, DEFAULT_WINDOWS_FONT_FAMILY, EDITOR_FONT_DEFAULTS, FONT_VARIATION_OFF, FONT_VARIATION_TRANSLATE, FontInfo, GOLDEN_LINE_HEIGHT_RATIO, MINIMUM_LINE_HEIGHT, SERIALIZED_FONT_INFO_VERSION };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { EditorOptions } from './editorOptions.js';
|
|
2
|
-
import { BareFontInfo } from './fontInfo.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
|
-
function createBareFontInfoFromValidatedSettings(options, pixelRatio, ignoreEditorZoom) {
|
|
9
|
-
const fontFamily = options.get(58 /* EditorOption.fontFamily */);
|
|
10
|
-
const fontWeight = options.get(62 /* EditorOption.fontWeight */);
|
|
11
|
-
const fontSize = options.get(61 /* EditorOption.fontSize */);
|
|
12
|
-
const fontFeatureSettings = options.get(60 /* EditorOption.fontLigatures */);
|
|
13
|
-
const fontVariationSettings = options.get(63 /* EditorOption.fontVariations */);
|
|
14
|
-
const lineHeight = options.get(75 /* EditorOption.lineHeight */);
|
|
15
|
-
const letterSpacing = options.get(72 /* EditorOption.letterSpacing */);
|
|
16
|
-
return BareFontInfo._create(fontFamily, fontWeight, fontSize, fontFeatureSettings, fontVariationSettings, lineHeight, letterSpacing, pixelRatio, ignoreEditorZoom);
|
|
17
|
-
}
|
|
18
|
-
function createBareFontInfoFromRawSettings(opts, pixelRatio, ignoreEditorZoom = false) {
|
|
19
|
-
const fontFamily = EditorOptions.fontFamily.validate(opts.fontFamily);
|
|
20
|
-
const fontWeight = EditorOptions.fontWeight.validate(opts.fontWeight);
|
|
21
|
-
const fontSize = EditorOptions.fontSize.validate(opts.fontSize);
|
|
22
|
-
const fontFeatureSettings = EditorOptions.fontLigatures2.validate(opts.fontLigatures);
|
|
23
|
-
const fontVariationSettings = EditorOptions.fontVariations.validate(opts.fontVariations);
|
|
24
|
-
const lineHeight = EditorOptions.lineHeight.validate(opts.lineHeight);
|
|
25
|
-
const letterSpacing = EditorOptions.letterSpacing.validate(opts.letterSpacing);
|
|
26
|
-
return BareFontInfo._create(fontFamily, fontWeight, fontSize, fontFeatureSettings, fontVariationSettings, lineHeight, letterSpacing, pixelRatio, ignoreEditorZoom);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { createBareFontInfoFromRawSettings, createBareFontInfoFromValidatedSettings };
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { Schemas } from '../../../base/common/network.js';
|
|
2
|
-
import { DataUri } from '../../../base/common/resources.js';
|
|
3
|
-
import { URI } from '../../../base/common/uri.js';
|
|
4
|
-
import { PLAINTEXT_LANGUAGE_ID } from '../languages/modesRegistry.js';
|
|
5
|
-
import { FileKind } from '../../../platform/files/common/files.js';
|
|
6
|
-
import { ThemeIcon } from '../../../base/common/themables.js';
|
|
7
|
-
|
|
8
|
-
/*---------------------------------------------------------------------------------------------
|
|
9
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
11
|
-
*--------------------------------------------------------------------------------------------*/
|
|
12
|
-
const fileIconDirectoryRegex = /(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;
|
|
13
|
-
function getIconClasses(modelService, languageService, resource, fileKind, icon) {
|
|
14
|
-
if (ThemeIcon.isThemeIcon(icon)) {
|
|
15
|
-
return [`codicon-${icon.id}`, 'predefined-file-icon'];
|
|
16
|
-
}
|
|
17
|
-
if (URI.isUri(icon)) {
|
|
18
|
-
return [];
|
|
19
|
-
}
|
|
20
|
-
// we always set these base classes even if we do not have a path
|
|
21
|
-
const classes = fileKind === FileKind.ROOT_FOLDER ? ['rootfolder-icon'] : fileKind === FileKind.FOLDER ? ['folder-icon'] : ['file-icon'];
|
|
22
|
-
if (resource) {
|
|
23
|
-
// Get the path and name of the resource. For data-URIs, we need to parse specially
|
|
24
|
-
let name;
|
|
25
|
-
if (resource.scheme === Schemas.data) {
|
|
26
|
-
const metadata = DataUri.parseMetaData(resource);
|
|
27
|
-
name = metadata.get(DataUri.META_DATA_LABEL);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
const match = resource.path.match(fileIconDirectoryRegex);
|
|
31
|
-
if (match) {
|
|
32
|
-
name = fileIconSelectorEscape(match[2].toLowerCase());
|
|
33
|
-
if (match[1]) {
|
|
34
|
-
classes.push(`${fileIconSelectorEscape(match[1].toLowerCase())}-name-dir-icon`); // parent directory
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
name = fileIconSelectorEscape(resource.authority.toLowerCase());
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
// Root Folders
|
|
42
|
-
if (fileKind === FileKind.ROOT_FOLDER) {
|
|
43
|
-
classes.push(`${name}-root-name-folder-icon`);
|
|
44
|
-
}
|
|
45
|
-
// Folders
|
|
46
|
-
else if (fileKind === FileKind.FOLDER) {
|
|
47
|
-
classes.push(`${name}-name-folder-icon`);
|
|
48
|
-
}
|
|
49
|
-
// Files
|
|
50
|
-
else {
|
|
51
|
-
// Name & Extension(s)
|
|
52
|
-
if (name) {
|
|
53
|
-
classes.push(`${name}-name-file-icon`);
|
|
54
|
-
classes.push(`name-file-icon`); // extra segment to increase file-name score
|
|
55
|
-
// Avoid doing an explosive combination of extensions for very long filenames
|
|
56
|
-
// (most file systems do not allow files > 255 length) with lots of `.` characters
|
|
57
|
-
// https://github.com/microsoft/vscode/issues/116199
|
|
58
|
-
if (name.length <= 255) {
|
|
59
|
-
const dotSegments = name.split('.');
|
|
60
|
-
for (let i = 1; i < dotSegments.length; i++) {
|
|
61
|
-
classes.push(`${dotSegments.slice(i).join('.')}-ext-file-icon`); // add each combination of all found extensions if more than one
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
classes.push(`ext-file-icon`); // extra segment to increase file-ext score
|
|
65
|
-
}
|
|
66
|
-
// Detected Mode
|
|
67
|
-
const detectedLanguageId = detectLanguageId(modelService, languageService, resource);
|
|
68
|
-
if (detectedLanguageId) {
|
|
69
|
-
classes.push(`${fileIconSelectorEscape(detectedLanguageId)}-lang-file-icon`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return classes;
|
|
74
|
-
}
|
|
75
|
-
function detectLanguageId(modelService, languageService, resource) {
|
|
76
|
-
if (!resource) {
|
|
77
|
-
return null; // we need a resource at least
|
|
78
|
-
}
|
|
79
|
-
let languageId = null;
|
|
80
|
-
// Data URI: check for encoded metadata
|
|
81
|
-
if (resource.scheme === Schemas.data) {
|
|
82
|
-
const metadata = DataUri.parseMetaData(resource);
|
|
83
|
-
const mime = metadata.get(DataUri.META_DATA_MIME);
|
|
84
|
-
if (mime) {
|
|
85
|
-
languageId = languageService.getLanguageIdByMimeType(mime);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
// Any other URI: check for model if existing
|
|
89
|
-
else {
|
|
90
|
-
const model = modelService.getModel(resource);
|
|
91
|
-
if (model) {
|
|
92
|
-
languageId = model.getLanguageId();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
// only take if the language id is specific (aka no just plain text)
|
|
96
|
-
if (languageId && languageId !== PLAINTEXT_LANGUAGE_ID) {
|
|
97
|
-
return languageId;
|
|
98
|
-
}
|
|
99
|
-
// otherwise fallback to path based detection
|
|
100
|
-
return languageService.guessLanguageIdByFilepathOrFirstLine(resource);
|
|
101
|
-
}
|
|
102
|
-
function fileIconSelectorEscape(str) {
|
|
103
|
-
return str.replace(/[\s]/g, '/'); // HTML class names can not contain certain whitespace characters (https://dom.spec.whatwg.org/#interface-domtokenlist), use / instead, which doesn't exist in file names.
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export { fileIconSelectorEscape, getIconClasses };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import './positionToOffset.js';
|
|
2
|
-
import { PositionOffsetTransformerBase } from './positionToOffsetImpl.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
|
-
function getPositionOffsetTransformerFromTextModel(textModel) {
|
|
9
|
-
return new PositionOffsetTransformerWithTextModel(textModel);
|
|
10
|
-
}
|
|
11
|
-
class PositionOffsetTransformerWithTextModel extends PositionOffsetTransformerBase {
|
|
12
|
-
constructor(_textModel) {
|
|
13
|
-
super();
|
|
14
|
-
this._textModel = _textModel;
|
|
15
|
-
}
|
|
16
|
-
getOffset(position) {
|
|
17
|
-
return this._textModel.getOffsetAt(position);
|
|
18
|
-
}
|
|
19
|
-
getPosition(offset) {
|
|
20
|
-
return this._textModel.getPositionAt(offset);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { getPositionOffsetTransformerFromTextModel };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { GlyphMarginLane } from '../model.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 MAX_LANE = GlyphMarginLane.Right;
|
|
8
|
-
class GlyphMarginLanesModel {
|
|
9
|
-
constructor(maxLine) {
|
|
10
|
-
this.persist = 0;
|
|
11
|
-
this._requiredLanes = 1; // always render at least one lane
|
|
12
|
-
this.lanes = new Uint8Array(Math.ceil(((maxLine + 1) * MAX_LANE) / 8));
|
|
13
|
-
}
|
|
14
|
-
reset(maxLine) {
|
|
15
|
-
const bytes = Math.ceil(((maxLine + 1) * MAX_LANE) / 8);
|
|
16
|
-
if (this.lanes.length < bytes) {
|
|
17
|
-
this.lanes = new Uint8Array(bytes);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
this.lanes.fill(0);
|
|
21
|
-
}
|
|
22
|
-
this._requiredLanes = 1;
|
|
23
|
-
}
|
|
24
|
-
get requiredLanes() {
|
|
25
|
-
return this._requiredLanes;
|
|
26
|
-
}
|
|
27
|
-
push(lane, range, persist) {
|
|
28
|
-
if (persist) {
|
|
29
|
-
this.persist |= (1 << (lane - 1));
|
|
30
|
-
}
|
|
31
|
-
for (let i = range.startLineNumber; i <= range.endLineNumber; i++) {
|
|
32
|
-
const bit = (MAX_LANE * i) + (lane - 1);
|
|
33
|
-
this.lanes[bit >>> 3] |= (1 << (bit % 8));
|
|
34
|
-
this._requiredLanes = Math.max(this._requiredLanes, this.countAtLine(i));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
getLanesAtLine(lineNumber) {
|
|
38
|
-
const lanes = [];
|
|
39
|
-
let bit = MAX_LANE * lineNumber;
|
|
40
|
-
for (let i = 0; i < MAX_LANE; i++) {
|
|
41
|
-
if (this.persist & (1 << i) || this.lanes[bit >>> 3] & (1 << (bit % 8))) {
|
|
42
|
-
lanes.push(i + 1);
|
|
43
|
-
}
|
|
44
|
-
bit++;
|
|
45
|
-
}
|
|
46
|
-
return lanes.length ? lanes : [GlyphMarginLane.Center];
|
|
47
|
-
}
|
|
48
|
-
countAtLine(lineNumber) {
|
|
49
|
-
let bit = MAX_LANE * lineNumber;
|
|
50
|
-
let count = 0;
|
|
51
|
-
for (let i = 0; i < MAX_LANE; i++) {
|
|
52
|
-
if (this.persist & (1 << i) || this.lanes[bit >>> 3] & (1 << (bit % 8))) {
|
|
53
|
-
count++;
|
|
54
|
-
}
|
|
55
|
-
bit++;
|
|
56
|
-
}
|
|
57
|
-
return count;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export { GlyphMarginLanesModel };
|