Skip to content

Commit 30ada4c

Browse files
committed
conditionals are now introduce indentation scope
1 parent cd2016c commit 30ada4c

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

src/services/smartIndenter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ module ts.formatting {
342342
case SyntaxKind.VariableDeclaration:
343343
case SyntaxKind.ExportAssignment:
344344
case SyntaxKind.ReturnStatement:
345+
case SyntaxKind.ConditionalExpression:
345346
return true;
346347
}
347348
return false;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
4+
////var v =
5+
/////*0*/a === b
6+
/////*1*/? c
7+
/////*2*/: d;
8+
9+
////var v = a === b
10+
/////*3*/? c
11+
/////*4*/: d;
12+
13+
function verifyLine(marker: string, content: string) {
14+
goTo.marker(marker);
15+
verify.currentLineContentIs(content);
16+
}
17+
18+
format.document();
19+
verifyLine("0", " a === b");
20+
verifyLine("1", " ? c");
21+
verifyLine("2", " : d;");
22+
verifyLine("3", " ? c");
23+
verifyLine("4", " : d;");

0 commit comments

Comments
 (0)