Bug 283140

Summary: [formatter] code formatter does not respect pre and code tags in multi-line comments that are inside code
Product: [Eclipse Project] JDT Reporter: Noel Grandin <noelgrandin>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, Olivier_Thomann
Version: 3.5   
Target Milestone: 3.6 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Noel Grandin CLA 2009-07-10 10:00:49 EDT
Build ID: 20090619-0625

Steps To Reproduce:
1.
Create a multi-line comment inside some code e.g.
public void foo() {
		/*
		 * I do not include <pre> 
		 *   xxx
		 *   xx
		 *   xxx
		 *  </pre> in this list.
		 */
}

2. format the code with the code formatter

3. the formatter merges the lines inside the <pre> block



More information:
Comment 1 Frederic Fusier CLA 2009-07-10 10:23:31 EDT
<pre> tags are only taken into account in Javadoc comments not in multi-lines ones, hence the observed behavior...

Note that there's no meaning for these tags as the Javadoc tool will never put this kind of comment in the generated doc.
Comment 2 Noel Grandin CLA 2009-07-11 08:39:44 EDT
I am re-opening the bug because I respectfully disagree with your line of reasoning.

But if you close it again, I will respect your decision.
I have changed the bug to an enhancement to better reflect our disagreement.

The decision is faulty because the underlying assumption is faulty

For example, I have several kLOC at my place of work. 
We have extensive code documentation. 
We use html tags all over the place. 
And yet we have never ever run the javadoc tool on our code.

So why do we use html tags? 

For 2 reasons
(1) it makes the formatter behave better. <p>, <pre> and <ol> tags tell the formatter how to preserve important structural information in the comment text.
(2) it makes the IDE completion information that shows up more readable, since the IDE generally renders the comments in HTML mode.

So when I use html tags in comments that are inside code, I was quite surprised to discover that the formatter ignores them.

I can see no downside to enabling this ability, and I am willing to dig through the code and produce a patch, if such a patch would be accepted.
Comment 3 Dani Megert CLA 2009-09-15 08:58:29 EDT
Agree with Frédéric.
Comment 4 Olivier Thomann CLA 2010-03-04 11:59:16 EST
Verified.