findSectionHeaders.ts ×4

Frontier kind: Code frontier

unlabeled · c_82191c817574

30 tests · 7285 LOC · 35 files · introduces 0 tests · 58 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
4 ranges58 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
866 ranges7285 lines · 35 files · Browse complete extent
All tests (intent)
30 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.

1 file ranked by introduced lines: 58 introduced LOC across 4 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/services/findSectionHeaders.ts 58 introduced LOC · 4 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- findSectionHeaders.ts
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 > import { IRange } from '../core/range.js';
7 > import { FoldingRules } from '../languages/languageConfiguration.js';
8 > import { isMultilineRegexSource } from '../model/textModelSearch.js';
9 > import { regExpLeadsToEndlessLoop } from '../../../base/common/strings.js';
10 >
11 > export interface ISectionHeaderFinderTarget {
12 > getLineCount(): number;
13 > getLineContent(lineNumber: number): string;
14 > }
15 >
16 > export interface FindSectionHeaderOptions {
17 > foldingRules?: FoldingRules;
18 > findRegionSectionHeaders: boolean;
19 > findMarkSectionHeaders: boolean;
20 > markSectionHeaderRegex: string;
21 > }
22 >
23 > export interface SectionHeader {
24 > /**
25 > * The location of the header text in the text model.
26 > */
27 > range: IRange;
28 > /**
29 > * The section header text.
30 > */
31 > text: string;
32 > /**
33 > * Whether the section header includes a separator line.
34 > */
35 > hasSeparatorLine: boolean;
36 > /**
37 > * This section should be omitted before rendering if it's not in a comment.
38 > */
39 > shouldBeInComments: boolean;
40 > }
41 >
42 > const trimDashesRegex = /^-+|-+$/g;
43 >
44 > const CHUNK_SIZE = 100;
45 > const MAX_SECTION_LINES = 5;
46 >
47 > /**
48 > * Find section headers in the model.
49 > *
50 > * @param model the text model to search in
51 > * @param options options to search with
52 > * @returns an array of section headers
53 > */
54 > export function findSectionHeaders(model: ISectionHeaderFinderTarget, options: FindSectionHeaderOptions): SectionHeader[] {
55 let headers: SectionHeader[] = [];
56 if (options.findRegionSectionHeaders && options.foldingRules?.markers) {
64 return headers;
65 }
67 function collectRegionHeaders(model: ISectionHeaderFinderTarget, options: FindSectionHeaderOptions): SectionHeader[] {
68 const regionHeaders: SectionHeader[] = [];
87 return regionHeaders;
88 }
90 > export function collectMarkHeaders(model: ISectionHeaderFinderTarget, options: FindSectionHeaderOptions): SectionHeader[] {
91 const markHeaders: SectionHeader[] = [];
92 const endLineNumber = model.getLineCount();
173 return markHeaders;
174 }
176 function getHeaderText(text: string): { text: string; hasSeparatorLine: boolean } {
177 text = text.trim();