[ 
https://issues.apache.org/jira/browse/NETBEANS-36?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16084893#comment-16084893
 ] 

Niklas Matthies edited comment on NETBEANS-36 at 7/16/17 1:57 PM:
------------------------------------------------------------------

A related misbehavior is the following: When you have a line comment that is 
indented, i.e. it does not start in column 0, and the caret is right at the 
initial slash, then pressing {{Return}} removes the indentation in front of the 
line comment instead of maintaining the indentation.


was (Author: matthies):
A related misbehavior is the following: When you have a line comment that is 
indenten, i.e. it does not start in column 0, and the caret is right at the 
initial slash, then pressing {{Return}} removes the indentation in front of the 
line comment instead of maintaining it.

> Statement indentation after commented-out Java statements
> ---------------------------------------------------------
>
>                 Key: NETBEANS-36
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-36
>             Project: NetBeans
>          Issue Type: Bug
>          Components: java - Editor
>    Affects Versions: 8.2
>            Reporter: Niklas Matthies
>
> Within a method body, when pressing {{Return}} at the start of a statement 
> behind a comment, the resulting indentation is set to the start of the 
> comment line. As illustrated by the following example, this generally isn't 
> useful. Comments should be ignored when determining indentation outside of a 
> comment.
> Example:
> {code:java}
>     void someMethod() {
>         someStatement();
>         someOtherStatement();
>     }
> {code}
> Commenting out the first statement by pressing {{Ctrl+/}} results in:
> {code:java}
>     void someMethod() {
> //        someStatement();
>         someOtherStatement();
>     }
> {code}
> I.e. the comment is placed at the very beginning of the line. Then, pressing 
> {{Return}} when the caret is right at the beginning of the second statement 
> (e.g. to add an empty line behind the comment) results in the following:
> {code:java}
>     void someMethod() {
> //        someStatement();
> someOtherStatement();
>     }
> {code}
> I.e. the second statement is indented to the start of the comment above. This 
> should not happen. Instead, indentation should be determined as if the 
> comment wasn't there (because it's a comment and not code). In other words, 
> the expected result is:
> {code:java}
>     void someMethod() {
> //        someStatement();
>         someOtherStatement();
>     }
> {code}
> Note that, on the other hand, when pressing {{Return}} when the caret is at 
> the end of the comment line, then it makes sense to indent the new line to 
> the start of the comment, for continuation of the comment. The difference to 
> the situation above is that here the caret is within the comment when 
> {{Return}} is being pressed, while in the case above the caret is outside the 
> comment.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to