History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-4451
Type: Bug Bug
Status: Reopened Reopened
Priority: Normal Normal
Assignee: Bas Leijdekkers
Reporter: Esko Luontola
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

"Replace with end-of-line comment" removes empty lines and indentation that follow the comment

Created: 02 Feb 06 21:58   Updated: 16 Oct 07 00:14
Component/s: Editor. Intention Actions, Code Formatting and Code Style
Fix Version/s: Demetra 5281, Diana Final

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
File Attachments: None
Image Attachments:

1. incorrect formatting.png
(9 kb)
Environment: Windows XP SP2, AMD64, jdk1.5.0_06, IDEA builds 3542 and 4137

Build: 4,137
Fixed in build: 6,041
Severity: Medium


 Description  « Hide
If I have the following code and use the "Replace with end-of-line comment" intention action on COMMENT ONE...
public void foo() {
        /* COMMENT ONE */

        /* COMMENT TWO */
}

...it will be formatted like this:

public void foo() {
        // COMMENT ONE 
/* COMMENT TWO */
}

All empty lines after the comment are removed. If it is followed by another comment, the indentation of the latter comment will be removed. If it is followed by code, only the empty lines are removed.

The "Replace with C-style comment" intention action does not have this problem - it leaves all whitespace after the comment untouched. However, both of these intention actions remove unnecessary empty lines (2 or more) that are before the comment (maybe because of the coding style settings).



 All   Comments   Work Log   Change History      Sort Order:
Esko Luontola - 06 Oct 06 01:22
This bug still exists in build 5766.

If "Replace with end-of-line comment" is invoked on the first comment:

public class Test1 {
    public void foo() {
        /* COMMENT ONE */

        /* COMMENT TWO */
    }
}

..it will create the following code:

public class Test1 {
    public void foo() {// COMMENT ONE 
/* COMMENT TWO */
    }
}

Bas Leijdekkers - 06 Oct 06 01:45
It must have regressed