From: Daniel Jasper Date: Fri, 8 Jan 2016 08:14:58 +0000 (+0000) Subject: clang-format: [JS] Add some Closure Compiler JSDoc tags to the default X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52b0a5c753a973a1b0ac0028192a55626389c096;p=clang clang-format: [JS] Add some Closure Compiler JSDoc tags to the default Google configuration so that they aren't line-wrapped. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257159 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 5068fca5c4..ca3d08fa2c 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -583,6 +583,7 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline; GoogleStyle.AlwaysBreakBeforeMultilineStrings = false; GoogleStyle.BreakBeforeTernaryOperators = false; + GoogleStyle.CommentPragmas = "@(export|visibility) {"; GoogleStyle.MaxEmptyLinesToKeep = 3; GoogleStyle.SpacesInContainerLiterals = false; } else if (Language == FormatStyle::LK_Proto) { diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp index cbfa2a3320..4600d7feb3 100644 --- a/unittests/Format/FormatTestJS.cpp +++ b/unittests/Format/FormatTestJS.cpp @@ -1030,5 +1030,15 @@ TEST_F(FormatTestJS, WrapAfterParen) { " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) {\n}"); } +TEST_F(FormatTestJS, JSDocAnnotations) { + EXPECT_EQ("/**\n" + " * @export {this.is.a.long.path.to.a.Type}\n" + " */", + format("/**\n" + " * @export {this.is.a.long.path.to.a.Type}\n" + " */", + getGoogleJSStyleWithColumns(20))); +} + } // end namespace tooling } // end namespace clang