Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 325785

Summary: [formatter] When line wrapping is needed, the line is wrapped after assignment, not at function call argument list
Product: [Tools] CDT Reporter: Dmitry Katsubo <dma_k>
Component: cdt-editorAssignee: Project Inbox <cdt-editor-inbox>
Status: RESOLVED INVALID QA Contact: Anton Leherbauer <aleherb+eclipse>
Severity: normal    
Priority: P3    
Version: 7.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Result of actual formatting
none
Result of expected formatting
none
Result of actual formatting v2
none
Result of expected formatting v2 none

Description Dmitry Katsubo CLA 2010-09-20 15:03:59 EDT
Build Identifier: CDT Build id: 201006141710

It looks like the formatter tries to keep the the function call argument list untouched (higher priority?). See attachments.

Reproducible: Always
Comment 1 Dmitry Katsubo CLA 2010-09-20 15:04:49 EDT
Created attachment 179270 [details]
Result of actual formatting
Comment 2 Dmitry Katsubo CLA 2010-09-20 15:05:11 EDT
Created attachment 179271 [details]
Result of expected formatting
Comment 3 Anton Leherbauer CLA 2010-09-29 04:51:12 EDT
The example is not complete, it parses with a syntax error.
If I fix the syntax error, the example does wrap correctly with default code style, and also with the style attached to bug 325783 (after changing the maximum line width to 80).
Comment 4 Dmitry Katsubo CLA 2010-10-18 11:57:03 EDT
Created attachment 181107 [details]
Result of actual formatting v2
Comment 5 Dmitry Katsubo CLA 2010-10-18 11:57:25 EDT
Created attachment 181108 [details]
Result of expected formatting v2
Comment 6 Dmitry Katsubo CLA 2010-10-18 11:58:25 EDT
Better example is attached.
Comment 7 Anton Leherbauer CLA 2010-10-22 04:52:22 EDT
(In reply to comment #6)
> Better example is attached.

This specific example is a corner case, as the wrapping occurs on the semicolon and not inside the function call expression, i.e. in this case it is correct to wrap the assignment.

Unfortunately there is no option to control the wrapping of assignments, but that's a different issue.