Previously clang-format would not break after any !. However in TypeScript, ! can be used as a post fix operator for non-nullability:
x.foo()!.bar()!;
With this change, clang-format will wrap after the ! if it is likely a post-fix non null operator.
Paths
| Differential D30705
clang-format: [JS] allow breaking after non-null assertions. ClosedPublic Authored by mprobst on Mar 7 2017, 10:30 AM.
Details Summary Previously clang-format would not break after any !. However in TypeScript, ! can be used as a post fix operator for non-nullability: x.foo()!.bar()!; With this change, clang-format will wrap after the ! if it is likely a post-fix non null operator.
Diff Detail
Event Timeline
djasper added inline comments.
This revision is now accepted and ready to land.Mar 8 2017, 1:41 AM mprobst marked an inline comment as done. Comment Actions
Closed by commit rL297606: clang-format: [JS] allow breaking after non-null assertions. (authored by mprobst). · Explain WhyMar 13 2017, 2:26 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 90889 lib/Format/FormatToken.h
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTestJS.cpp
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I wonder whether we should do this logic "inside out", i.e. have language-specific parts at the top (or in a separate function). We have started that in mustBreakBefore and I think that's helpful.
I can do this in a follow-up, though.