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

Bug 490652

Summary: [formatter] Single line comment gets formatted into multiple lines
Product: [Eclipse Project] JDT Reporter: Sarika Sinha <sarika.sinha>
Component: CoreAssignee: Mateusz Matela <mateusz.matela>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, noopur_gupta
Version: 4.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Before Formatting
none
After Formatting none

Description Sarika Sinha CLA 2016-03-29 23:37:11 EDT
Created attachment 260619 [details]
Before Formatting

Attaching the sample file before and after formatting. Formatting converts the single line comment into multiple lines.

In the attached file, even if I move the comment to next line it gets formatted into 2 lines.
Comment 1 Sarika Sinha CLA 2016-03-29 23:37:44 EDT
Created attachment 260620 [details]
After Formatting
Comment 2 Jay Arthanareeswaran CLA 2016-03-30 00:50:35 EDT
Sarika, which build are you using? Can you please attach your formatter settings too?
Comment 3 Sarika Sinha CLA 2016-03-30 02:38:06 EDT
Jay,
I am using 
Version: Neon (4.6)
Build id: N20160327-2000

with default formatter settings i.e Eclipse [built-in]
Comment 4 Mateusz Matela CLA 2016-03-30 03:04:21 EDT
This is the expected behavior. If you don't want comments to be wrapped, increase the 'Maximum line width for comments'.
Comment 5 Sarika Sinha CLA 2016-03-30 03:28:50 EDT
Maximum line width for Comments is 120 by default , and If a place the comment on a new line, still it breaks it into 2 line at location 80.
Comment 6 Jesper Moller CLA 2016-03-30 03:34:40 EDT
There is a separate line width for comments in the Comments-tab of the formatter editor.
Comment 7 Jesper Moller CLA 2016-03-30 03:35:22 EDT
... and it defaults to 80 characters, which I guess is kind of odd.
Comment 8 Sarika Sinha CLA 2016-03-30 03:38:05 EDT
Yes, IMHO both the width should be defaulted to same value.
Comment 9 Mateusz Matela CLA 2016-03-30 03:40:44 EDT
There's a proposition to change it to 120 in bug 472688.
I raise an argument there about why it makes sense to have shorter lines for comments. Feel free to join the discussion.

*** This bug has been marked as a duplicate of bug 472688 ***