guidesTextModelPart.ts ×14

Frontier kind: Code frontier

unlabeled · c_5dbe3c7e916d

5 tests · 41245 LOC · 239 files · introduces 0 tests · 117 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
14 ranges117 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5111 ranges41245 lines · 239 files · Browse complete extent
All tests (intent)
5 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: 117 introduced LOC across 14 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/model/guidesTextModelPart.ts 117 introduced LOC · 14 ranges

Open complete file

63 let up_belowContentLineIndent = -1;
64 const up_resolveIndents = (lineNumber: number) => {
66 > up_aboveContentLineIndex !== -1 &&
67 > (up_aboveContentLineIndex === -2 ||
68 up_aboveContentLineIndex > lineNumber - 1)
70 > up_aboveContentLineIndex = -1;
71 > up_aboveContentLineIndent = -1;
72 >
73 > // must find previous line with content
74 > for (let lineIndex = lineNumber - 2; lineIndex >= 0; lineIndex--) {
75 > const indent = this._computeIndentLevel(lineIndex);
76 > if (indent >= 0) {
77 > up_aboveContentLineIndex = lineIndex;
78 > up_aboveContentLineIndent = indent;
79 > break;
80 > }
81 > }
82 > }
83 >
84 > if (up_belowContentLineIndex === -2) {
85 > up_belowContentLineIndex = -1;
86 > up_belowContentLineIndent = -1;
87 >
88 > // must find next line with content
89 > for (let lineIndex = lineNumber; lineIndex < lineCount; lineIndex++) {
90 > const indent = this._computeIndentLevel(lineIndex);
91 > if (indent >= 0) {
92 > up_belowContentLineIndex = lineIndex;
93 > up_belowContentLineIndent = indent;
94 > break;
95 > }
96 > }
97 > }
98 > };
99
100 let down_aboveContentLineIndex =
105 let down_belowContentLineIndent = -1;
106 const down_resolveIndents = (lineNumber: number) => {
107 > if (down_aboveContentLineIndex === -2) { guidesTextModelPart.ts
108 > down_aboveContentLineIndex = -1;
109 > down_aboveContentLineIndent = -1;
110 >
111 > // must find previous line with content
112 > for (let lineIndex = lineNumber - 2; lineIndex >= 0; lineIndex--) {
113 > const indent = this._computeIndentLevel(lineIndex);
114 > if (indent >= 0) {
115 > down_aboveContentLineIndex = lineIndex;
116 > down_aboveContentLineIndent = indent;
117 > break;
118 > }
119 > }
120 > }
121 >
122 > if (
123 > down_belowContentLineIndex !== -1 &&
124 > (down_belowContentLineIndex === -2 ||
125 down_belowContentLineIndex < lineNumber - 1)
127 > down_belowContentLineIndex = -1;
128 > down_belowContentLineIndent = -1;
129 >
130 > // must find next line with content
131 > for (let lineIndex = lineNumber; lineIndex < lineCount; lineIndex++) {
132 > const indent = this._computeIndentLevel(lineIndex);
133 > if (indent >= 0) {
134 > down_belowContentLineIndex = lineIndex;
135 > down_belowContentLineIndent = indent;
136 > break;
137 > }
138 > }
139 > }
140 > };
141
142 let startLineNumber = 0;
180 );
181 } else {
182 > up_resolveIndents(upLineNumber); guidesTextModelPart.ts
183 > upLineIndentLevel = this._getIndentLevelForWhitespaceLine(
184 > offSide,
185 > up_aboveContentLineIndent,
186 > up_belowContentLineIndent
187 > );
188 > }
189 }
190
202 );
203 } else {
204 > down_resolveIndents(downLineNumber); guidesTextModelPart.ts
205 > downLineIndentLevel = this._getIndentLevelForWhitespaceLine(
206 > offSide,
207 > down_aboveContentLineIndent,
208 > down_belowContentLineIndent
209 > );
210 > }
211 }
212
517 continue;
518 }
520 > if (aboveContentLineIndex === -2) {
521 aboveContentLineIndex = -1;
522 aboveContentLineIndent = -1;
532 }
533 }
535 > if (
536 > belowContentLineIndex !== -1 &&
537 > (belowContentLineIndex === -2 || belowContentLineIndex < lineNumber - 1)
538 ) {
539 > belowContentLineIndex = -1; guidesTextModelPart.ts
540 > belowContentLineIndent = -1;
541 >
542 > // must find next line with content
543 > for (let lineIndex = lineNumber; lineIndex < lineCount; lineIndex++) {
544 > const indent = this._computeIndentLevel(lineIndex);
545 > if (indent >= 0) {
546 > belowContentLineIndex = lineIndex;
547 > belowContentLineIndent = indent;
548 > break;
549 > }
550 > }
551 > }
552 >
553 > result[resultIndex] = this._getIndentLevelForWhitespaceLine(
554 > offSide,
555 > aboveContentLineIndent,
556 > belowContentLineIndent
557 > );
558 > }
559 return result;
560 }
561
562 private _getIndentLevelForWhitespaceLine(
563 > offSide: boolean, guidesTextModelPart.ts
564 > aboveContentLineIndent: number,
565 > belowContentLineIndent: number
566 > ): number {
567 > const options = this.textModel.getOptions();
568 >
569 > if (aboveContentLineIndent === -1 || belowContentLineIndent === -1) {
570 // At the top or bottom of the file
571 return 0;
572 > } else if (aboveContentLineIndent < belowContentLineIndent) { guidesTextModelPart.ts
573 // we are inside the region above
574 return 1 + Math.floor(aboveContentLineIndent / options.indentSize);
575 > } else if (aboveContentLineIndent === belowContentLineIndent) { guidesTextModelPart.ts
576 // we are in between two regions
577 return Math.ceil(belowContentLineIndent / options.indentSize);
578 > } else { guidesTextModelPart.ts
579 if (offSide) {
580 // same level as region below