| Summary: | Formatter should break long strings by splitting them into two, or using a backslash | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | BB <bjoern.kiefer> |
| Component: | cdt-editor | Assignee: | Project Inbox <cdt-editor-inbox> |
| Status: | ASSIGNED --- | QA Contact: | Jonah Graham <jonah> |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | yevshif, zeratul976 |
| Version: | 7.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
You can configure the formatter in the preferences under C/C++ > Code Style. What would you expect? (In reply to comment #1) > You can configure the formatter in the preferences under C/C++ > Code Style. > What would you expect? I would expect one of the following formatting: 1. Do not break the line: std::string strError("This must be a long text in one row ......................" 2. Best looking - break with double quote: std::string strError("This must be a long text " "in one row.........................."); 3. Break with backslash: std::string strError("This must be a long text \ in one row.........................."); (In reply to comment #2) > (In reply to comment #1) > > You can configure the formatter in the preferences under C/C++ > Code Style. > > What would you expect? > > > I would expect one of the following formatting: > > 1. Do not break the line: > std::string strError("This must be a long text in one row > ......................" You can configure this in the preferences by setting the maximum line width to a high value. > > 2. Best looking - break with double quote: > std::string strError("This must be a long text " > "in one row.........................."); This is not supported. The formatter only changes whitespace. > 3. Break with backslash: > std::string strError("This must be a long text \ > in one row.........................."); Same as above. I am marking this as an enhancement request. No plans to work on this in the near future, though. (In reply to BB from comment #0) > If I write this in the c++ editor: > #include <string> > std::string strError("This must be a long text in one row > ..............................................."); > > The result of the formatting (ctrl+shift+f) of the string initialization > takes 3 lines and looks like this: > > #include <string> > std::string > strError( > "This must be a long text in one row > ..............................................."); With CDT 9.2, I'm not seeing 3 lines, only 2: #include <string> std::string strError( "This must be a long text in one row ..............................................."); which looks a lot more reasonable. (In reply to Anton Leherbauer from comment #3) > > 2. Best looking - break with double quote: > > std::string strError("This must be a long text " > > "in one row.........................."); > > This is not supported. The formatter only changes whitespace. > > > 3. Break with backslash: > > std::string strError("This must be a long text \ > > in one row.........................."); > > Same as above. > > I am marking this as an enhancement request. No plans to work on this in the > near future, though. Updated bug title to reflect this enhancement request. |
If I write this in the c++ editor: #include <string> std::string strError("This must be a long text in one row ..............................................."); The result of the formatting (ctrl+shift+f) of the string initialization takes 3 lines and looks like this: #include <string> std::string strError( "This must be a long text in one row ...............................................");