mprobst added inline comments.
================ Comment at: clang/docs/ClangFormatStyleOptions.rst:2827 -**JavaScriptWrapImports** (``Boolean``) :versionbadge:`clang-format 3.9` - Whether to wrap JavaScript import/export statements. + * If ``ColumnWidth`` is 0 (no limit on the number of columns), then import + statements will keep the number of lines they start with. ---------------- andmis wrote: > HazardyKnusperkeks wrote: > > mprobst wrote: > > > this seems odd to me: my understanding is that clang-format always > > > reflows the entire document, there's no logic to ever "keep" whitespace. > > > > > > Are you sure you are seeing this behaviour? The logic change below sounds > > > more as if the ColumnWidth: 0, import lines might not break (mustBreak > > > returns false), but might still break? > > From what I can tell with `ColumnLimit` (and not `ColumnWidth`) 0, then > > `clang-format` does many things differently. If by design or by accident > > I'm not sure. I can see that often, since I format my code with a limit, > > but my tests without. > I just double-checked and yes, as-implemented, with `ColumnLimit: 0` and > `JavaScriptWrapImports: true`, import statements retain the number of lines > they started with. > > It is explicit in the code that with `ColumnLimit: 0`, we decide whether to > break on a token based on whether there was a preexisting line break. (Check > out `NoColumnLimitLineFormatter`.) I think you're right that usually > clang-format reflows everything and I was also confused about this point. > > There are other options that do similar things, for example > `EmptyLineAfterAccessModifier`. Can you check with code that would normally cause reformatting? E.g. ``` import { A, B, C, } from 'url'; ``` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116638/new/ https://reviews.llvm.org/D116638 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits