diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index f29f8796ea9290..4e9ae41b566f49 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -809,7 +809,8 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, if (Tok.Previous->isIf()) return Style.AlignAfterOpenBracket == FormatStyle::BAS_AlwaysBreak; return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, - tok::kw_switch); + tok::kw_switch) && + !(Style.isJavaScript() && Tok.Previous->is(Keywords.kw_await)); }; auto IsFunctionCallParen = [](const FormatToken &Tok) { return Tok.is(tok::l_paren) && Tok.ParameterCount > 0 && Tok.Previous && diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 57c021c76867f7..4b15e7b7da3393 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -2870,6 +2870,11 @@ TEST_F(FormatTestJS, BreakAfterOpenBracket) { verifyFormat("failedUserIds.push(await subscriptioxxxxxxxxxxxxnSubset.map(\n" " subscxxxxxxxxxxxxription => subscription.getUserId()));", Style); + verifyFormat("for await (const packageId of ops.api.iterateEmbeddedFiles(\n" + " this.getFileId().getDriveFile(),\n" + " )) {\n" + "}", + Style); } } // namespace format