Bug 85096 - Source->Toggle Comment and Source->{Format/Indent} poorly integrated
Summary: Source->Toggle Comment and Source->{Format/Indent} poorly integrated
Status: VERIFIED DUPLICATE of bug 20793
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M7   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-12 20:40 EST by Macneil Shonle CLA
Modified: 2007-04-27 07:20 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.