Bug 85096

Summary: Source->Toggle Comment and Source->{Format/Indent} poorly integrated
Product: [Eclipse Project] JDT Reporter: Macneil Shonle <mshonle>
Component: CoreAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0.1   
Target Milestone: 3.3 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Macneil Shonle CLA 2005-02-12 20:40:59 EST
The source code formatter (and indenter) shouldn't indent lines that were
commented out via Source->Toggle Comment.

For example, suppose you had the following code:

  if (!newPattern.equals("")) {
    parent.addPattern(newPattern);
  }

and then commented out the statement (via toggle comment):

  if (!newPattern.equals("")) {
//  parent.addPattern(newPattern);
  }

If you then apply "format" to this, you'll get:

  if (!newPattern.equals("")) {
    //    parent.addPattern(newPattern);
  }

When code is large, this effect can be quite annoying. The automatic formatter
shouldn't affect lines of code like this. As an alternative to ignoring these
lines, at least the extra indentation after the "//" could be removed:

  if (!newPattern.equals("")) {
    //parent.addPattern(newPattern);
  }

since the same level of indentation has already been added before the "//".
Comment 1 Dani Megert CLA 2005-02-14 04:38:56 EST

*** This bug has been marked as a duplicate of 20793 ***
Comment 2 Maxime Daniel CLA 2007-04-27 07:20:34 EDT
Verified for 3.3 M7 using build I20070418-1012.