Previously r223367 introduced stylistic change, where all top-level dict
literals will never be compacted to single line. Since this changes formatting,
some who want previous formatting now can bring it back setting
AllowTopLevelDictLiteralsOnASingleLine: true.
Details
- Reviewers
djasper
Diff Detail
Event Timeline
This needs tests.
Also, I am wondering whether we should straight away introduce this as "AllowDictLiteralsOnASingleLine" with an enum value of (None, All, TopLevel). What do you think?
Yeah, but I think this should be rather None, All, SubLevel, since SubLevel will represent current behavior and All will represent previous behavior.
Preparing updated patch.
- Introduced SingleLineStyle enum of None, Nested, All
- Replaced previous setting with AllowDictLiteralsOnASingleLine with value of enum above
- Added unit tests for this setting
Unfortunately, this interacts non-trivially with http://reviews.llvm.org/rL232320. I can fix the merge, but I am not sure what the proposed behavior is. Could you outline what you would want the flag to do in these cases? Or does the other commit possibly fix your use case?
unittests/Format/FormatTestJS.cpp | ||
---|---|---|
161–162 | We probably should be testing 'nested' here, too. |
I think the mentioned commit obsoletes this change. So I am marking this to be abandoned.
We probably should be testing 'nested' here, too.