[PATCH] D20198: clang-format: [JS] sort ES6 imports.

Martin Probst via cfe-commits cfe-commits at lists.llvm.org
Thu May 19 08:22:12 PDT 2016


mprobst marked 2 inline comments as done.
mprobst added a comment.

Thanks for the review, appreciated!


================
Comment at: lib/Format/SortJavaScriptImports.cpp:160
@@ +159,3 @@
+      if (i + 1 < e) {
+        // Insert breaks between imports.
+        ReferencesText += "\n";
----------------
klimek wrote:
> Between categories of imports and imports and exports, right?
Added a comment.

================
Comment at: lib/Format/SortJavaScriptImports.cpp:170-171
@@ +169,4 @@
+    // Separate references from the main code body of the file.
+    if (FirstNonImportLine && FirstNonImportLine->First->NewlinesBefore < 2)
+      ReferencesText += "\n";
+
----------------
klimek wrote:
> Shouldn't we add 2 if NewlinesBefore is 0? Or is that syntactically impossible?
The next token is on a new line, so it gets a wrap just from that already. I've added a test though.


http://reviews.llvm.org/D20198





More information about the cfe-commits mailing list