mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
fix(37431): allow only one space between async keyword and method name (#37504)
This commit is contained in:
parent
78a99241d8
commit
72a0411776
@ -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),
|
||||
|
||||
12
tests/cases/fourslash/formatAsyncClassMethod1.ts
Normal file
12
tests/cases/fourslash/formatAsyncClassMethod1.ts
Normal file
@ -0,0 +1,12 @@
|
||||
///<reference path="fourslash.ts"/>
|
||||
|
||||
////class Foo {
|
||||
//// async foo() {}
|
||||
////}
|
||||
|
||||
format.document();
|
||||
verify.currentFileContentIs(
|
||||
`class Foo {
|
||||
async foo() { }
|
||||
}`
|
||||
);
|
||||
12
tests/cases/fourslash/formatAsyncClassMethod2.ts
Normal file
12
tests/cases/fourslash/formatAsyncClassMethod2.ts
Normal file
@ -0,0 +1,12 @@
|
||||
///<reference path="fourslash.ts"/>
|
||||
|
||||
////class Foo {
|
||||
//// private async foo() {}
|
||||
////}
|
||||
|
||||
format.document();
|
||||
verify.currentFileContentIs(
|
||||
`class Foo {
|
||||
private async foo() { }
|
||||
}`
|
||||
);
|
||||
Loading…
x
Reference in New Issue
Block a user