llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-format Author: Owen Pan (owenca) <details> <summary>Changes</summary> Fixes #<!-- -->107401. --- Full diff: https://github.com/llvm/llvm-project/pull/107506.diff 2 Files Affected: - (modified) clang/lib/Format/ContinuationIndenter.cpp (+1-1) - (modified) clang/unittests/Format/FormatTestJS.cpp (+8) ``````````diff diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 5843571718b3a2..f65c1640a8765a 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -861,7 +861,7 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, // or // caaaaaaaaaaaaaaaaaaaaal( // new SomethingElseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee()); - !IsSimpleFunction(Current)) { + Current.isNot(tok::comment) && !IsSimpleFunction(Current)) { CurrentState.NoLineBreak = true; } diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 4b29ba720f6823..a0b663170c7b33 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -2850,5 +2850,13 @@ TEST_F(FormatTestJS, DontBreakFieldsAsGoToLabels) { "};"); } +TEST_F(FormatTestJS, BreakAfterOpenBracket) { + auto Style = getGoogleStyle(FormatStyle::LK_JavaScript); + EXPECT_EQ(Style.AlignAfterOpenBracket, FormatStyle::BAS_AlwaysBreak); + verifyFormat("ctrl.onCopy(/** @type {!WizEvent}*/ (\n" + " {event, targetElement: {el: () => selectedElement}}));", + Style); +} + } // namespace format } // end namespace clang `````````` </details> https://github.com/llvm/llvm-project/pull/107506 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits