Page MenuHomePhabricator

[clang-format] Disable string literal breaking for text protos
ClosedPublic

Authored by krasimir on Jan 22 2018, 7:04 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

krasimir created this revision.Jan 22 2018, 7:04 AM

I am not sure we should actually do this. I agree that badly reflowing multiline string literals is not ideal, but neither is violating the column limit. In any case, proper reflowing would probably the best solution. How hard would it be to implement that (for proto as well as C++)?

Let's not do this then. For reflowing string literals, it could take a two-three months.

So, we found out other cases where this is especially painful:

  • breaking long URLs into multiple lines
  • updating the text of a paragraph and breaking again with combination of no-reflow

We could disable it for now and enable it when we have string literal reflow.

djasper accepted this revision.Jan 24 2018, 2:34 AM

Change the comment and possibly also the patch description along the lines of what I have suggested. Other than that, looks good to me.

lib/Format/Format.cpp
679 ↗(On Diff #130888)

Make this comment:

// Text protos are currently mostly formatted inside C++ raw string literals and
// often the current breaking behavior of string literals is not beneficial there.
// Investigate turning this on once proper string reflow has been implemented.
This revision is now accepted and ready to land.Jan 24 2018, 2:34 AM
krasimir updated this revision to Diff 131216.Jan 24 2018, 3:18 AM
  • Update comment
krasimir marked an inline comment as done.Jan 24 2018, 3:18 AM
This revision was automatically updated to reflect the committed changes.