From 33ea6c581a260dc217979ce59714dd0ce73ddbca Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 14 Jan 2021 14:48:40 -0800 Subject: [PATCH] Fix indentation for closing > of ExpressionWithTypeArguments (#42341) --- src/services/formatting/formatting.ts | 1 + src/services/formatting/smartIndenter.ts | 2 +- tests/cases/fourslash/formatMultilineExtendsGeneric.ts | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/formatMultilineExtendsGeneric.ts diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index ee32d0a4dfd..de41f3d768f 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -592,6 +592,7 @@ namespace ts.formatting { case SyntaxKind.JsxOpeningElement: case SyntaxKind.JsxClosingElement: case SyntaxKind.JsxSelfClosingElement: + case SyntaxKind.ExpressionWithTypeArguments: return false; } break; diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index b8af97350f7..b759643c87a 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -581,7 +581,7 @@ namespace ts.formatting { if (childKind === SyntaxKind.TypeLiteral || childKind === SyntaxKind.TupleType) { return false; } - // falls through + break; } // No explicit rule for given nodes so the result will follow the default value argument return indentByDefault; diff --git a/tests/cases/fourslash/formatMultilineExtendsGeneric.ts b/tests/cases/fourslash/formatMultilineExtendsGeneric.ts new file mode 100644 index 00000000000..e0cdf54d251 --- /dev/null +++ b/tests/cases/fourslash/formatMultilineExtendsGeneric.ts @@ -0,0 +1,9 @@ +/// + +//// class Favorite extends Array< +//// string +//// > { +//// private foo = 2 +//// } + +verify.formatDocumentChangesNothing();