In outliningElementsCollector, treat 'else if' as having same depth as the 'if'
This commit is contained in:
parent
cc6bc763bc
commit
a60caba467
|
@ -21,7 +21,17 @@ namespace ts.OutliningElementsCollector {
|
|||
if (span) out.push(span);
|
||||
|
||||
depthRemaining--;
|
||||
if (isIfStatement(n) && isIfStatement(n.elseStatement)) {
|
||||
// Consider an 'else if' to be on the same depth as the 'if'.
|
||||
walk(n.expression);
|
||||
walk(n.thenStatement);
|
||||
depthRemaining++;
|
||||
walk(n.elseStatement);
|
||||
depthRemaining--;
|
||||
}
|
||||
else {
|
||||
n.forEachChild(walk);
|
||||
}
|
||||
depthRemaining++;
|
||||
});
|
||||
}
|
||||
|
|
89
tests/cases/fourslash/getOutliningSpansDepthElseIf.ts
Normal file
89
tests/cases/fourslash/getOutliningSpansDepthElseIf.ts
Normal file
|
@ -0,0 +1,89 @@
|
|||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
// Tests that each 'else if' does not count towards a higher nesting depth.
|
||||
|
||||
////if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else if (1)[| {
|
||||
//// 1;
|
||||
////}|] else[| {
|
||||
//// 1;
|
||||
////}|]
|
||||
|
||||
verify.outliningSpansInCurrentFile(test.ranges());
|
Loading…
Reference in a new issue