Fix formatting between for and await (#21254)

* Fix issue 21084

* Removed unwanted rules.
This commit is contained in:
Esakki Raj
2018-01-21 23:15:58 +05:30
committed by Mohamed Hegazy
parent a7c53c70d2
commit 92bde084c1
2 changed files with 21 additions and 0 deletions

View File

@@ -321,6 +321,9 @@ namespace ts.formatting {
rule("NoSpaceAfterCloseBracket", SyntaxKind.CloseBracketToken, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], RuleAction.Delete),
rule("SpaceAfterSemicolon", SyntaxKind.SemicolonToken, anyToken, [isNonJsxSameLineTokenContext], RuleAction.Space),
// Remove extra space between for and await
rule("SpaceBetweenForAndAwaitKeyword", SyntaxKind.ForKeyword, SyntaxKind.AwaitKeyword, [isNonJsxSameLineTokenContext], RuleAction.Space),
// Add a space between statements. All keywords except (do,else,case) has open/close parens after them.
// So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any]
rule(

View File

@@ -0,0 +1,18 @@
/// <reference path='fourslash.ts'/>
////async function f() {
//// for await (const x of g()) {
//// console.log(x);
//// }
////}
format.document();
verify.currentFileContentIs(
`async function f() {
for await (const x of g()) {
console.log(x);
}
}`
);