bracketPairsTree.ts ×7

Frontier kind: Code frontier

unlabeled · c_b88f617e994f

32 tests · 41297 LOC · 238 files · introduces 0 tests · 40 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges40 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5128 ranges41297 lines · 238 files · Browse complete extent
All tests (intent)
32 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 40 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/bracketPairsTree.ts 36 introduced LOC · 7 ranges

Open complete file

152
153 public getBracketsInRange(range: Range, onlyColorizedBrackets: boolean): CallbackIterable<BracketInfo> {
154 > this.flushQueue(); bracketPairsTree.ts
155 >
156 > const startOffset = toLength(range.startLineNumber - 1, range.startColumn - 1);
157 > const endOffset = toLength(range.endLineNumber - 1, range.endColumn - 1);
158 > return new CallbackIterable(cb => {
159 > const node = this.initialAstWithoutTokens || this.astWithTokens!;
160 > collectBrackets(node, lengthZero, node.length, startOffset, endOffset, cb, 0, 0, new Map(), onlyColorizedBrackets);
161 > });
162 > }
163
164 public getBracketPairsInRange(range: Range, includeMinIndentation: boolean): CallbackIterable<BracketPairWithMinIndentationInfo> {
245 }
246
247 > function collectBrackets( bracketPairsTree.ts
248 > node: AstNode,
249 > nodeOffsetStart: Length,
250 > nodeOffsetEnd: Length,
251 > startOffset: Length,
252 > endOffset: Length,
253 > push: (item: BracketInfo) => boolean,
254 > level: number,
255 > nestingLevelOfEqualBracketType: number,
256 > levelPerBracketType: Map<string, number>,
257 > onlyColorizedBrackets: boolean,
258 > parentPairIsIncomplete: boolean = false,
259 > ): boolean {
260 > if (level > 200) {
261 return true;
262 }
264 > whileLoop:
265 > while (true) {
266 > switch (node.kind) {
267 > case AstNodeKind.List: {
268 const childCount = node.childrenLength;
269 for (let i = 0; i < childCount; i++) {
293 return true;
294 }
295 > case AstNodeKind.Pair: { bracketPairsTree.ts
296 const colorize = !onlyColorizedBrackets || !node.closingBracket || (node.closingBracket.bracketInfo as ClosingBracketKind).closesColorized(node.openingBracket.bracketInfo as OpeningBracketKind);
297
360 return true;
361 }
362 > case AstNodeKind.UnexpectedClosingBracket: { bracketPairsTree.ts
363 const range = lengthsToRange(nodeOffsetStart, nodeOffsetEnd);
364 return push(new BracketInfo(range, level - 1, 0, true));
365 }
366 > case AstNodeKind.Bracket: { bracketPairsTree.ts
367 const range = lengthsToRange(nodeOffsetStart, nodeOffsetEnd);
368 return push(new BracketInfo(range, level - 1, nestingLevelOfEqualBracketType - 1, parentPairIsIncomplete));
369 }
370 > case AstNodeKind.Text: bracketPairsTree.ts
371 > return true;
372 > }
373 > }
374 > }
375
376 class CollectBracketPairsContext {
src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsImpl.ts 4 introduced LOC · 1 range

Open complete file

114
115 public getBracketsInRange(range: Range, onlyColorizedBrackets: boolean = false): CallbackIterable<BracketInfo> {
116 > this.bracketsRequested = true; bracketPairsImpl.ts
117 > this.updateBracketPairsTree();
118 > return this.bracketPairsTree.value?.object.getBracketsInRange(range, onlyColorizedBrackets) || CallbackIterable.empty;
119 > }
120
121 public findMatchingBracketUp(_bracket: string, _position: IPosition, maxDuration?: number): Range | null {