fix(56699): [Formatting] Missing space after implements / extends generic (#56707)

This commit is contained in:
Oleksandr T 2023-12-15 19:05:25 +02:00 committed by GitHub
parent 22bee05d8f
commit 2c134db31d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 2 deletions

View File

@ -88,7 +88,7 @@ export function getAllRules(): RuleSpec[] {
const functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments;
// Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc)
const typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([SyntaxKind.Identifier, SyntaxKind.MultiLineCommentTrivia, SyntaxKind.ClassKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ImportKeyword]);
const typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([SyntaxKind.Identifier, SyntaxKind.GreaterThanToken, SyntaxKind.MultiLineCommentTrivia, SyntaxKind.ClassKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ImportKeyword]);
// Place a space before open brace in a control flow construct
const controlOpenBraceLeftTokenRange = tokenRangeFrom([SyntaxKind.CloseParenToken, SyntaxKind.MultiLineCommentTrivia, SyntaxKind.DoKeyword, SyntaxKind.TryKeyword, SyntaxKind.FinallyKeyword, SyntaxKind.ElseKeyword, SyntaxKind.CatchKeyword]);

View File

@ -0,0 +1,27 @@
///<reference path="fourslash.ts"/>
////class C1 implements Array<string>{
////}
////
////class C2 implements Number{
////}
////
////class C3 extends Array<string>{
////}
////
////class C4 extends Number{
////}
format.document();
verify.currentFileContentIs(
`class C1 implements Array<string> {
}
class C2 implements Number {
}
class C3 extends Array<string> {
}
class C4 extends Number {
}`);

View File

@ -26,7 +26,7 @@
format.document();
goTo.marker("inClassDeclaration");
verify.currentLineContentIs("class Foo<T1, T2> {");
verify.currentLineContentIs("class Foo<T1, T2> {");
goTo.marker("inMethodDeclaration");
verify.currentLineContentIs(" public method<T3, T4>(a: T1, b: Array<T4>): Map<T1, T2, Array<T3>> {");