[PATCH] D116638: [ClangFormat] Fix ignoring JavaScriptWrapImport when ColumnWidth: 0

Andrey Mishchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 4 18:19:28 PST 2022


andmis created this revision.
andmis added a reviewer: MyDeveloperDay.
andmis added a project: clang-format.
andmis requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Prior to this patch, when ColumnWidth: 0, all JS imports of the form `import {aaa, bbb, ccc} from "def";` would be formatted as multi-line, and the JavaScriptWrapImport flag had no effect (in most cases). This patch makes it so that when ColumnWidth: 0, the JavaScriptWrapImport flag causes multi-line imports, for example

  import {
    aaa,
    bbb,
    ccc
  } from "jkl";

to be left alone. If JavaScriptWrapImport: false, then imports of this form are unwrapped to a single line in all cases, regardless of ColumnWidth. The behavior for ColumnWidth > 0 is unchanged.

Fixes: https://github.com/llvm/llvm-project/issues/52935


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116638

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/lib/Format/ContinuationIndenter.cpp
  clang/unittests/Format/FormatTestJS.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116638.397392.patch
Type: text/x-patch
Size: 5444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220105/8f88da4f/attachment.bin>


More information about the cfe-commits mailing list