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

Martin Probst via cfe-commits cfe-commits at lists.llvm.org
Thu May 12 10:57:25 PDT 2016


mprobst added a comment.

PTAL.


================
Comment at: lib/Format/SortJavaScriptImports.cpp:162
@@ +161,3 @@
+    std::string ImportsText;
+    for (unsigned i = 0, e = Indices.size(); i != e; ++i) {
+      JsImportExport ImpExp = Imports[Indices[i]];
----------------
djasper wrote:
> Is there any chance you are changing the total length of an import block?
No, this only ever monotonously increases the length. I'm aware things fall apart if it doesn't ;-)

================
Comment at: lib/Format/SortJavaScriptImports.cpp:226
@@ +225,3 @@
+      ImpExp.URL = Current->TokenText.substr(1, Current->TokenText.size() - 2);
+      if (ImpExp.URL.startswith("..")) {
+        ImpExp.Category = JsImportExport::JsImportCategory::RELATIVE_PARENT;
----------------
djasper wrote:
> No braces.
Just can't get used to that, it feels so wrong...


http://reviews.llvm.org/D20198





More information about the cfe-commits mailing list