diff options
author | Krasimir Georgiev <krasimir@google.com> | 2020-11-06 10:33:23 +0100 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2020-11-06 10:34:10 +0100 |
commit | 2dbcbd357d1da1adf9c512d150e68424faa46d75 (patch) | |
tree | 9c891399e47b9b983be339fcea2d46921547b083 /clang/unittests/Format/FormatTestJS.cpp | |
parent | 5ee9ef85190cff09c4d3718d8683af1900a33348 (diff) | |
download | llvm-2dbcbd357d1da1adf9c512d150e68424faa46d75.zip llvm-2dbcbd357d1da1adf9c512d150e68424faa46d75.tar.gz llvm-2dbcbd357d1da1adf9c512d150e68424faa46d75.tar.bz2 |
[clang-format] do not break before { in JS comments
In JavaScript some @tags can be followed by `{`, and machinery that parses
these comments will fail to understand the comment if followed by a line break.
clang-format already handles this case by not breaking before `{` in comments.
However this was not working in cases when the column limit falls within `@tag`
or between `@tag` and `{`. This adapts clang-format for this case.
Reviewed By: mprobst
Differential Revision: https://reviews.llvm.org/D90908
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index da26a9b..d140fe5 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -2184,6 +2184,16 @@ TEST_F(FormatTestJS, JSDocAnnotations) { " * @lala {lala {lalala\n" " */\n", getGoogleJSStyleWithColumns(20)); + // cases where '{' is around the column limit + for (int ColumnLimit = 6; ColumnLimit < 13; ++ColumnLimit) { + verifyFormat("/**\n" + " * @param {type}\n" + " */", + "/**\n" + " * @param {type}\n" + " */", + getGoogleJSStyleWithColumns(ColumnLimit)); + } verifyFormat("/**\n" " * @see http://very/very/long/url/is/long\n" " */", |