[PATCH] D133589: [clang-format] JSON formatting add new option for controlling newlines in json arrays

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 10 12:47:50 PDT 2022


HazardyKnusperkeks added inline comments.


================
Comment at: clang/.clang-format:2
 BasedOnStyle: LLVM
+RemoveBracesLLVM: true
----------------
Unrelated.


================
Comment at: clang/include/clang/Format/Format.h:2063
+  /// otherwise it will scan until the closing `]` to determine if it should add
+  /// newlines between elements (prettier compatible)
+  ///
----------------



================
Comment at: clang/include/clang/Format/Format.h:2065
+  ///
+  /// NOTE: This is currently only for formatting JSON
+  /// \code
----------------



================
Comment at: clang/include/clang/Format/Format.h:2076
+  /// \version 16
+  bool BreakArrays;
+
----------------
Please sort.


================
Comment at: clang/include/clang/Format/Format.h:2076
+  /// \version 16
+  bool BreakArrays;
+
----------------
HazardyKnusperkeks wrote:
> Please sort.
What about `Leave`?


================
Comment at: clang/include/clang/Format/Format.h:3917
            EmptyLineBeforeAccessModifier == R.EmptyLineBeforeAccessModifier &&
+           BreakArrays == R.BreakArrays &&
            ExperimentalAutoDetectBinPacking ==
----------------
Please sort.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:4402
       return true;
-    // Always break after a JSON array opener.
-    // [
-    // ]
+    // Always break after a JSON array opener based on BreakArrays
     if (Left.is(TT_ArrayInitializerLSquare) && Left.is(tok::l_square) &&
----------------



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133589/new/

https://reviews.llvm.org/D133589



More information about the cfe-commits mailing list