indentation.ts ×4

Frontier kind: Joint frontier

unlabeled · c_3aa8c3ed38e8

3 tests · 48609 LOC · 266 files · introduces 1 test · 41 LOC · 4 files

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges41 lines · 4 files
Tests
1 test

Contains — complete concept membership

All code (extent)
5875 ranges48609 lines · 266 files · Browse complete extent
All tests (intent)
3 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.

1 test introduced at this concept.

Introduced code

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

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

src/vs/editor/common/commands/shiftCommand.ts 23 introduced LOC · 3 ranges

Open complete file

25
26 const repeatCache: { [str: string]: string[] } = Object.create(null);
27 > function cachedStringRepeat(str: string, count: number): string { shiftCommand.ts
28 > if (count <= 0) {
29 > return '';
30 > }
31 > if (!repeatCache[str]) {
32 > repeatCache[str] = ['', str];
33 > }
34 > const cache = repeatCache[str];
35 > for (let i = cache.length; i <= count; i++) {
36 > cache[i] = cache[i - 1] + str;
37 > }
38 > return cache[count];
39 > }
40
41 export class ShiftCommand implements ICommand {
59
60 public static shiftIndent(line: string, column: number, tabSize: number, indentSize: number, insertSpaces: boolean): string {
61 > // Determine the visible column where the content starts shiftCommand.ts
62 > const contentStartVisibleColumn = CursorColumns.visibleColumnFromColumn(line, column, tabSize);
63 >
64 > if (insertSpaces) {
65 > const indent = cachedStringRepeat(' ', indentSize);
66 > const desiredTabStop = CursorColumns.nextIndentTabStop(contentStartVisibleColumn, indentSize);
67 > const indentCount = desiredTabStop / indentSize; // will be an integer
68 > return cachedStringRepeat(indent, indentCount);
69 > } else {
70 const indent = '\t';
71 const desiredTabStop = CursorColumns.nextRenderTabStop(contentStartVisibleColumn, tabSize);
73 return cachedStringRepeat(indent, indentCount);
74 }
76
77 private readonly _opts: IShiftCommandOpts;
src/vs/editor/contrib/indentation/common/indentation.ts 12 introduced LOC · 4 ranges

Open complete file

43 const { tabSize, indentSize, insertSpaces } = model.getOptions();
44 const shiftIndent = (indentation: string, count?: number) => {
45 > count = count || 1; indentation.ts
46 > return ShiftCommand.shiftIndent(indentation, indentation.length + count, tabSize, indentSize, insertSpaces);
47 > };
48 const unshiftIndent = (indentation: string, count?: number) => {
49 > count = count || 1; indentation.ts
50 > return ShiftCommand.unshiftIndent(indentation, indentation.length + count, tabSize, indentSize, insertSpaces);
51 > };
52 const indentEdits: ISingleEditOperation[] = [];
53
62
63 if (processedIndentRulesSupport.shouldIncrease(startLineNumber)) {
64 > idealIndentForNextLine = shiftIndent(idealIndentForNextLine); indentation.ts
65 > globalIndent = shiftIndent(globalIndent);
66 > }
67 else if (processedIndentRulesSupport.shouldIndentNextLine(startLineNumber)) {
68 idealIndentForNextLine = shiftIndent(idealIndentForNextLine);
81
82 if (processedIndentRulesSupport.shouldDecrease(lineNumber, currentIdealIndent)) {
83 > idealIndentForNextLine = unshiftIndent(idealIndentForNextLine); indentation.ts
84 > globalIndent = unshiftIndent(globalIndent);
85 > }
86
87 if (oldIndentation !== idealIndentForNextLine) {
src/vs/editor/common/languages/supports/indentRules.ts 4 introduced LOC · 2 ranges

Open complete file

32 if (this._indentationRules) {
33 if (this._indentationRules.increaseIndentPattern && resetGlobalRegex(this._indentationRules.increaseIndentPattern) && this._indentationRules.increaseIndentPattern.test(text)) {
34 > return true; indentRules.ts
35 > }
36 // if (this._indentationRules.indentNextLinePattern && this._indentationRules.indentNextLinePattern.test(text)) {
37 // return true;
43 public shouldDecrease(text: string): boolean {
44 if (this._indentationRules && this._indentationRules.decreaseIndentPattern && resetGlobalRegex(this._indentationRules.decreaseIndentPattern) && this._indentationRules.decreaseIndentPattern.test(text)) {
45 > return true; indentRules.ts
46 > }
47 return false;
48 }
src/vs/editor/common/model/tokens/tokenizerSyntaxTokenBackend.ts 2 introduced LOC · 1 range

Open complete file

272 public isCheapToTokenize(lineNumber: number): boolean {
273 if (!this._tokenizer) {
274 > return true; tokenizerSyntaxTokenBackend.ts
275 > }
276 return this._tokenizer.isCheapToTokenize(lineNumber);
277 }