<div dir="ltr"><div>Yes, this is something that clang-format currently cannot do. It would take a bit longer to explain why this is architecturally difficult (based on the penalties).</div><div><br></div>However, we have already disabled string breaking for Java and JavaScript (see <a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20141208/119958.html" target="_blank" class="cremed">http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20141208/119958.html</a>). This could be turned into a configuration option. Would you be willing to contribute a patch?</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 17, 2015 at 9:24 AM, Neumann, Adrian <span dir="ltr"><<a href="mailto:adrian.neumann@siemens.com" target="_blank">adrian.neumann@siemens.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I would like to configure clang-format (version 3.6.0) not to break long<br>
string literals despite the ColumnLimit. I tried setting PenaltyBreakString<br>
to a large value and PenaltyExcessCharacter to a small value. This doesn't<br>
seem to have any effect.<br>
<br>
This is an example program:<br>
<br>
#include <string><br>
<br>
int main() {<br>
        std::string s = "this is a really long string that"<br>
                "i really would like to have formatted differently, in<br>
particular I want this line to stay like this";<br>
}<br>
<br>
clang-format --dump-config reports<br>
<br>
ColumnLimit:     80<br>
PenaltyBreakBeforeFirstCallParameter: 19<br>
PenaltyBreakComment: 300<br>
PenaltyBreakString: 2000000<br>
PenaltyBreakFirstLessLess: 120<br>
PenaltyExcessCharacter: 1<br>
PenaltyReturnTypeOnItsOwnLine: 60<br>
<br>
yet the program is formatted as such:<br>
<br>
#include <string><br>
<br>
int main() {<br>
  std::string s = "this is a really long string that"<br>
                  "i really would like to have formatted differently, in "<br>
                  "particular I want this line to stay like this";<br>
}<br>
<br>
I there a way to solve this problem, or is this something clang can't do?<br>
<br>
Greets,<br>
<br>
Adrian<br>
<br>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>