fix(37431): allow only one space between async keyword and method name (#37504)

This commit is contained in:
Alexander T 2020-04-02 18:30:05 +03:00 committed by GitHub
parent 78a99241d8
commit 72a0411776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 1 deletions

View File

@ -129,7 +129,7 @@ namespace ts.formatting {
// Async-await
rule("SpaceBetweenAsyncAndOpenParen", SyntaxKind.AsyncKeyword, SyntaxKind.OpenParenToken, [isArrowFunctionContext, isNonJsxSameLineTokenContext], RuleAction.InsertSpace),
rule("SpaceBetweenAsyncAndFunctionKeyword", SyntaxKind.AsyncKeyword, SyntaxKind.FunctionKeyword, [isNonJsxSameLineTokenContext], RuleAction.InsertSpace),
rule("SpaceBetweenAsyncAndFunctionKeyword", SyntaxKind.AsyncKeyword, [SyntaxKind.FunctionKeyword, SyntaxKind.Identifier], [isNonJsxSameLineTokenContext], RuleAction.InsertSpace),
// Template string
rule("NoSpaceBetweenTagAndTemplateString", [SyntaxKind.Identifier, SyntaxKind.CloseParenToken], [SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead], [isNonJsxSameLineTokenContext], RuleAction.DeleteSpace),

View File

@ -0,0 +1,12 @@
///<reference path="fourslash.ts"/>
////class Foo {
//// async foo() {}
////}
format.document();
verify.currentFileContentIs(
`class Foo {
async foo() { }
}`
);

View File

@ -0,0 +1,12 @@
///<reference path="fourslash.ts"/>
////class Foo {
//// private async foo() {}
////}
format.document();
verify.currentFileContentIs(
`class Foo {
private async foo() { }
}`
);