File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,7 +21,17 @@ namespace ts.OutliningElementsCollector {
2121 if ( span ) out . push ( span ) ;
2222
2323 depthRemaining -- ;
24- n . forEachChild ( walk ) ;
24+ if ( isIfStatement ( n ) && isIfStatement ( n . elseStatement ) ) {
25+ // Consider an 'else if' to be on the same depth as the 'if'.
26+ walk ( n . expression ) ;
27+ walk ( n . thenStatement ) ;
28+ depthRemaining ++ ;
29+ walk ( n . elseStatement ) ;
30+ depthRemaining -- ;
31+ }
32+ else {
33+ n . forEachChild ( walk ) ;
34+ }
2535 depthRemaining ++ ;
2636 } ) ;
2737 }
Original file line number Diff line number Diff line change 1+ /// <reference path="fourslash.ts"/>
2+
3+ // Tests that each 'else if' does not count towards a higher nesting depth.
4+
5+ ////if (1)[| {
6+ //// 1;
7+ //// }|] else if (1)[| {
8+ //// 1;
9+ //// }|] else if (1)[| {
10+ //// 1;
11+ //// }|] else if (1)[| {
12+ //// 1;
13+ //// }|] else if (1)[| {
14+ //// 1;
15+ //// }|] else if (1)[| {
16+ //// 1;
17+ //// }|] else if (1)[| {
18+ //// 1;
19+ //// }|] else if (1)[| {
20+ //// 1;
21+ //// }|] else if (1)[| {
22+ //// 1;
23+ //// }|] else if (1)[| {
24+ //// 1;
25+ //// }|] else if (1)[| {
26+ //// 1;
27+ //// }|] else if (1)[| {
28+ //// 1;
29+ //// }|] else if (1)[| {
30+ //// 1;
31+ //// }|] else if (1)[| {
32+ //// 1;
33+ //// }|] else if (1)[| {
34+ //// 1;
35+ //// }|] else if (1)[| {
36+ //// 1;
37+ //// }|] else if (1)[| {
38+ //// 1;
39+ //// }|] else if (1)[| {
40+ //// 1;
41+ //// }|] else if (1)[| {
42+ //// 1;
43+ //// }|] else if (1)[| {
44+ //// 1;
45+ //// }|] else if (1)[| {
46+ //// 1;
47+ //// }|] else if (1)[| {
48+ //// 1;
49+ //// }|] else if (1)[| {
50+ //// 1;
51+ //// }|] else if (1)[| {
52+ //// 1;
53+ //// }|] else if (1)[| {
54+ //// 1;
55+ //// }|] else if (1)[| {
56+ //// 1;
57+ //// }|] else if (1)[| {
58+ //// 1;
59+ //// }|] else if (1)[| {
60+ //// 1;
61+ //// }|] else if (1)[| {
62+ //// 1;
63+ //// }|] else if (1)[| {
64+ //// 1;
65+ //// }|] else if (1)[| {
66+ //// 1;
67+ //// }|] else if (1)[| {
68+ //// 1;
69+ //// }|] else if (1)[| {
70+ //// 1;
71+ //// }|] else if (1)[| {
72+ //// 1;
73+ //// }|] else if (1)[| {
74+ //// 1;
75+ //// }|] else if (1)[| {
76+ //// 1;
77+ //// }|] else if (1)[| {
78+ //// 1;
79+ //// }|] else if (1)[| {
80+ //// 1;
81+ //// }|] else if (1)[| {
82+ //// 1;
83+ //// }|] else if (1)[| {
84+ //// 1;
85+ //// }|] else[| {
86+ //// 1;
87+ //// }|]
88+
89+ verify . outliningSpansInCurrentFile ( test . ranges ( ) ) ;
You can’t perform that action at this time.
0 commit comments