mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
added for* statements to isCompletedNode
This commit is contained in:
parent
76dcfb660b
commit
4b955ee91a
@ -461,6 +461,12 @@ module ts.formatting {
|
||||
case SyntaxKind.DefaultClause:
|
||||
// there is no such thing as terminator token for CaseClause\DefaultClause so for simplicitly always consider them non-completed
|
||||
return false;
|
||||
case SyntaxKind.ForStatement:
|
||||
return isCompletedNode((<ForStatement>n).statement, sourceFile);
|
||||
case SyntaxKind.ForInStatement:
|
||||
return isCompletedNode((<ForInStatement>n).statement, sourceFile);
|
||||
case SyntaxKind.ForOfStatement:
|
||||
return isCompletedNode((<ForOfStatement>n).statement, sourceFile);
|
||||
case SyntaxKind.WhileStatement:
|
||||
return isCompletedNode((<WhileStatement>n).statement, sourceFile);
|
||||
case SyntaxKind.DoStatement:
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
//// /*insideStatement*/
|
||||
//// }
|
||||
//// /*afterStatement*/
|
||||
//// for (var i = 0;;)
|
||||
//// /*insideStatement2*/
|
||||
////}
|
||||
|
||||
goTo.marker('insideStatement');
|
||||
@ -12,3 +14,6 @@ verify.indentationIs(8);
|
||||
|
||||
goTo.marker('afterStatement');
|
||||
verify.indentationIs(4);
|
||||
|
||||
goTo.marker('insideStatement2');
|
||||
verify.indentationIs(8);
|
||||
|
||||
@ -6,6 +6,8 @@
|
||||
//// /*insideStatement*/
|
||||
//// }
|
||||
//// /*afterStatement*/
|
||||
//// for (var i in [])
|
||||
//// /*insideStatement2*/
|
||||
////}
|
||||
|
||||
goTo.marker('insideStatement');
|
||||
@ -13,3 +15,6 @@ verify.indentationIs(8);
|
||||
|
||||
goTo.marker('afterStatement');
|
||||
verify.indentationIs(4);
|
||||
|
||||
goTo.marker('insideStatement2');
|
||||
verify.indentationIs(8);
|
||||
|
||||
20
tests/cases/fourslash/smartIndentStatementForOf.ts
Normal file
20
tests/cases/fourslash/smartIndentStatementForOf.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////function Foo() {
|
||||
//// for (var i of [])
|
||||
//// {
|
||||
//// /*insideStatement*/
|
||||
//// }
|
||||
//// /*afterStatement*/
|
||||
//// for (var i of [])
|
||||
//// /*insideStatement2*/
|
||||
////}
|
||||
|
||||
goTo.marker('insideStatement');
|
||||
verify.indentationIs(8);
|
||||
|
||||
goTo.marker('afterStatement');
|
||||
verify.indentationIs(4);
|
||||
|
||||
goTo.marker('insideStatement2');
|
||||
verify.indentationIs(8);
|
||||
Loading…
x
Reference in New Issue
Block a user