File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -405,6 +405,7 @@ namespace ts.formatting {
405405
406406 function nodeContentIsAlwaysIndented ( kind : SyntaxKind ) : boolean {
407407 switch ( kind ) {
408+ case SyntaxKind . ExpressionStatement :
408409 case SyntaxKind . ClassDeclaration :
409410 case SyntaxKind . ClassExpression :
410411 case SyntaxKind . InterfaceDeclaration :
Original file line number Diff line number Diff line change @@ -128,7 +128,8 @@ namespace ts {
128128 return isCompletedNode ( ( < IfStatement > n ) . thenStatement , sourceFile ) ;
129129
130130 case SyntaxKind . ExpressionStatement :
131- return isCompletedNode ( ( < ExpressionStatement > n ) . expression , sourceFile ) ;
131+ return isCompletedNode ( ( < ExpressionStatement > n ) . expression , sourceFile ) ||
132+ hasChildOfKind ( n , SyntaxKind . SemicolonToken ) ;
132133
133134 case SyntaxKind . ArrayLiteralExpression :
134135 case SyntaxKind . ArrayBindingPattern :
Original file line number Diff line number Diff line change 1+ /// <reference path="fourslash.ts"/>
2+
3+ ////let t: number;
4+ ////t
5+ /////*nextlineWithEqual*/=2+2;
6+ ////t=
7+ /////*nextlineWithoutEqual*/2
8+ /////*nextline2*/+2;
9+ ////t
10+ /////*addition*/+= 22
11+ /////*nextlineSemicolon*/;
12+ ////t
13+ ////=t
14+ /////*chained*/=t+ 4;
15+
16+ format . document ( ) ;
17+
18+ goTo . marker ( "nextlineWithEqual" ) ;
19+ verify . indentationIs ( 4 ) ;
20+ verify . currentLineContentIs ( " = 2 + 2;" ) ;
21+ goTo . marker ( "nextlineWithoutEqual" ) ;
22+ verify . indentationIs ( 4 ) ;
23+ verify . currentLineContentIs ( " 2" ) ;
24+ goTo . marker ( "nextline2" ) ;
25+ verify . indentationIs ( 4 ) ;
26+ verify . currentLineContentIs ( " + 2;" ) ;
27+ goTo . marker ( "addition" ) ;
28+ verify . indentationIs ( 4 ) ;
29+ verify . currentLineContentIs ( " += 22" ) ;
30+ goTo . marker ( "nextlineSemicolon" ) ;
31+ verify . indentationIs ( 4 ) ;
32+ verify . currentLineContentIs ( " ;" ) ;
33+ goTo . marker ( "chained" ) ;
34+ verify . indentationIs ( 4 ) ;
35+ verify . currentLineContentIs ( " = t + 4;" ) ;
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ verify.currentLineContentIs(" else");
155155goTo . marker ( "61" ) ;
156156verify . currentLineContentIs ( " x += 2" ) ;
157157goTo . marker ( "62" ) ;
158- verify . currentLineContentIs ( " ;" ) ;
158+ verify . currentLineContentIs ( " ;" ) ;
159159goTo . marker ( "63" ) ;
160160verify . currentLineContentIs ( "do do do do" ) ;
161161goTo . marker ( "64" ) ;
You can’t perform that action at this time.
0 commit comments