]> granicus.if.org Git - clang/commitdiff
clang-format: [JS] Add some Closure Compiler JSDoc tags to the default
authorDaniel Jasper <djasper@google.com>
Fri, 8 Jan 2016 08:14:58 +0000 (08:14 +0000)
committerDaniel Jasper <djasper@google.com>
Fri, 8 Jan 2016 08:14:58 +0000 (08:14 +0000)
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

lib/Format/Format.cpp
unittests/Format/FormatTestJS.cpp

index 5068fca5c44dd79349dbb123a083dcc29c64d826..ca3d08fa2cd971a5994d1dc2907b5dcbca020026 100644 (file)
@@ -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) {
index cbfa2a33205400d1f3d774b6373ebd18e4fb3205..4600d7feb3d8d046db0d2c851c9f4fa788e4239b 100644 (file)
@@ -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