guidesTextModelPart.ts ×17

Frontier kind: Code frontier

unlabeled · c_8e883301ba10

18 tests · 40948 LOC · 239 files · introduces 0 tests · 114 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
17 ranges114 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5038 ranges40948 lines · 239 files · Browse complete extent
All tests (intent)
18 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: 114 introduced LOC across 17 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/model/guidesTextModelPart.ts 114 introduced LOC · 17 ranges

Open complete file

25
26 private getLanguageConfiguration(
27 > languageId: string guidesTextModelPart.ts
28 > ): ResolvedLanguageConfiguration {
29 > return this.languageConfigurationService.getLanguageConfiguration(
30 > languageId
31 > );
32 > }
33
34 private _computeIndentLevel(lineIndex: number): number {
35 > return computeIndentLevel( guidesTextModelPart.ts
36 > this.textModel.getLineContent(lineIndex + 1),
37 > this.textModel.getOptions().tabSize
38 > );
39 > }
40
41 public getActiveIndentGuide(
42 > lineNumber: number, guidesTextModelPart.ts
43 > minLineNumber: number,
44 > maxLineNumber: number
45 > ): IActiveIndentGuideInfo {
46 > this.assertNotDisposed();
47 > const lineCount = this.textModel.getLineCount();
48 >
49 > if (lineNumber < 1 || lineNumber > lineCount) {
50 throw new BugIndicatingError('Illegal value for lineNumber');
51 }
53 > const foldingRules = this.getLanguageConfiguration(
54 > this.textModel.getLanguageId()
55 > ).foldingRules;
56 > const offSide = Boolean(foldingRules && foldingRules.offSide);
57 >
58 > let up_aboveContentLineIndex =
59 > -2; /* -2 is a marker for not having computed it */
60 > let up_aboveContentLineIndent = -1;
61 > let up_belowContentLineIndex =
62 > -2; /* -2 is a marker for not having computed it */
63 > let up_belowContentLineIndent = -1;
64 > const up_resolveIndents = (lineNumber: number) => {
65 if (
66 up_aboveContentLineIndex !== -1 &&
97 }
98 };
100 > let down_aboveContentLineIndex =
101 > -2; /* -2 is a marker for not having computed it */
102 > let down_aboveContentLineIndent = -1;
103 > let down_belowContentLineIndex =
104 > -2; /* -2 is a marker for not having computed it */
105 > let down_belowContentLineIndent = -1;
106 > const down_resolveIndents = (lineNumber: number) => {
107 if (down_aboveContentLineIndex === -2) {
108 down_aboveContentLineIndex = -1;
139 }
140 };
142 > let startLineNumber = 0;
143 > let goUp = true;
144 > let endLineNumber = 0;
145 > let goDown = true;
146 > let indent = 0;
147 >
148 > let initialIndent = 0;
149 >
150 > for (let distance = 0; goUp || goDown; distance++) {
151 > const upLineNumber = lineNumber - distance;
152 > const downLineNumber = lineNumber + distance;
153 >
154 > if (distance > 1 && (upLineNumber < 1 || upLineNumber < minLineNumber)) {
155 goUp = false;
156 }
158 > distance > 1 &&
159 (downLineNumber > lineCount || downLineNumber > maxLineNumber)
161 goDown = false;
162 }
163 > if (distance > 50000) { guidesTextModelPart.ts
164 // stop processing
165 goUp = false;
166 goDown = false;
167 }
169 > let upLineIndentLevel: number = -1;
170 > if (goUp && upLineNumber >= 1) {
171 > // compute indent level going up
172 > const currentIndent = this._computeIndentLevel(upLineNumber - 1);
173 > if (currentIndent >= 0) {
174 > // This line has content (besides whitespace)
175 > // Use the line's indent
176 > up_belowContentLineIndex = upLineNumber - 1;
177 > up_belowContentLineIndent = currentIndent;
178 > upLineIndentLevel = Math.ceil(
179 > currentIndent / this.textModel.getOptions().indentSize
180 > );
181 > } else {
182 up_resolveIndents(upLineNumber);
183 upLineIndentLevel = this._getIndentLevelForWhitespaceLine(
187 );
188 }
190 >
191 > let downLineIndentLevel = -1;
192 > if (goDown && downLineNumber <= lineCount) {
193 > // compute indent level going down
194 > const currentIndent = this._computeIndentLevel(downLineNumber - 1);
195 > if (currentIndent >= 0) {
196 > // This line has content (besides whitespace)
197 > // Use the line's indent
198 > down_aboveContentLineIndex = downLineNumber - 1;
199 > down_aboveContentLineIndent = currentIndent;
200 > downLineIndentLevel = Math.ceil(
201 > currentIndent / this.textModel.getOptions().indentSize
202 > );
203 > } else {
204 down_resolveIndents(downLineNumber);
205 downLineIndentLevel = this._getIndentLevelForWhitespaceLine(
209 );
210 }
212 >
213 > if (distance === 0) {
214 > initialIndent = upLineIndentLevel;
215 > continue;
216 > }
217 >
218 > if (distance === 1) {
219 > if (
220 > downLineNumber <= lineCount &&
221 > downLineIndentLevel >= 0 &&
222 > initialIndent + 1 === downLineIndentLevel
223 > ) {
224 // This is the beginning of a scope, we have special handling here, since we want the
225 // child scope indent to be active, not the parent scope
230 continue;
231 }
233 > if (
234 > upLineNumber >= 1 &&
235 > upLineIndentLevel >= 0 &&
236 > upLineIndentLevel - 1 === initialIndent
237 > ) {
238 // This is the end of a scope, just like above
239 goDown = false;
243 continue;
244 }
246 > startLineNumber = lineNumber;
247 > endLineNumber = lineNumber;
248 > indent = initialIndent;
249 > if (indent === 0) {
250 // No need to continue
251 return { startLineNumber, endLineNumber, indent };
252 }
254
255 if (goUp) {