From ec45bc2feaa43dffc5e2aa01825dee422487aac3 Mon Sep 17 00:00:00 2001 From: Martin Probst Date: Fri, 3 Aug 2018 09:34:41 +0000 Subject: clang-format: [JS] don't break comments before any '{' Summary: Previously, clang-format would avoid breaking before the first `{` found, but then happily break before subsequent '{'s on the line. This change fixes that by looking for the first location that has no opening curly, if any. Reviewers: krasimir Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50230 llvm-svn: 338837 --- clang/unittests/Format/FormatTestJS.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'clang/unittests/Format/FormatTestJS.cpp') diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index fe148393b98..58a900352a2 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -2067,6 +2067,14 @@ TEST_F(FormatTestJS, JSDocAnnotations) { " * @param {canWrap onSpace}\n" " */", getGoogleJSStyleWithColumns(20)); + // make sure clang-format doesn't break before *any* '{' + verifyFormat("/**\n" + " * @lala {lala {lalala\n" + " */\n", + "/**\n" + " * @lala {lala {lalala\n" + " */\n", + getGoogleJSStyleWithColumns(20)); verifyFormat("/**\n" " * @see http://very/very/long/url/is/long\n" " */", -- cgit v1.2.3