Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!

Bug 162586

Summary: wrong formatting comments created using ctrl+/
Product: php Reporter: Filip Zamboj <fzamboj>
Component: Formatting & IndentationAssignee: Tomasz Slota <tslota>
Status: VERIFIED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P2    
Version: 6.x   
Target Milestone: 6.x   
Hardware: All   
OS: All   
Whiteboard:
Issue Type: DEFECT Exception Report:

Description Filip Zamboj 2009-04-14 13:30:59 UTC
dev: 
Product Version: NetBeans IDE Dev (Build 2009-04-14_12-05-06 )
Java: 1.6.0_13; Java HotSpot(TM) 64-Bit Server VM 11.3-b02

steps to reproduce: 
1. create else if statement 
2. create text after else if statement that you want to comment later
3. use ctrl+/ to comment 
4. continue after comment -> here it should remain indentation before comment even if comments signs '//' are at the
beginning of line. 

example:
 //USG_BUGTRACKING_Query
        elseif (!strcmp($message, 'USG_BUGTRACKING_QUERY')) {
           ...
        }
//        USG_BUGTRACKING_AUTOMATIC_REFRESH
< carret jumps here
        
will be added to unit tests.
Comment 1 Filip Zamboj 2009-04-14 13:33:17 UTC
note status whiteboard: tbd_67. This is used by NB-QA to mark bugs that are supposed to be fixed to 67fcs.   
Comment 2 Tomasz Slota 2009-06-11 15:59:43 UTC
fixed with the PHP indenter rewrite, I added a unit test to prevent future regressions:

http://hg.netbeans.org/web-main/rev/65b364f8cf5d
http://hg.netbeans.org/web-main/rev/ff1c5f92b32d
Comment 3 Filip Zamboj 2009-06-19 16:03:48 UTC
another example in 
Product Version: NetBeans IDE 6.7 (Build release67-19-on-090618)
Java: 1.6.0_13; Java HotSpot(TM) Client VM 11.3-b02

initial state is ok: 
  </tr>
                            <?php
                              $itineraryData = getItinerary(0);

                              for($index=0;$index < count($itineraryData);$index++){
                               }
                            ?>
                        </table>

2. select everything in php tags and press ctrl+/
  </tr>
                            <?php
//                            $itineraryData = getItinerary(0);
//                            
//                            for($index=0;$index < count($itineraryData);$index++){
//                              }
                            ?>
                        </table>

3. invoke formatting and you got comments indented to far. This should stay like in step 2, shouldn't it? 

  </tr>
                            <?php
                            //                            $itineraryData = getItinerary(0);
                            //                            
                            //                            for($index=0;$index < count($itineraryData);$index++){
                            //                            }
                            ?>
                        </table>
Comment 4 Tomasz Slota 2009-08-10 16:01:00 UTC
upgrading to P2
Comment 5 Tomasz Slota 2009-08-17 13:10:39 UTC
We agreed with Filip that it will be implemented in the following way:

1) one line comments starting directly at the beginning of the line will not be touched by the formatted - it will assume they were created with Ctrl+/

2) one line comments preceded by one or more white spaces will be aligned with surrounding code, e.g.

if (1){
   // comment
       foo();
}

will be formatted to 

if (1){
       // comment
       foo();
}
Comment 6 Tomasz Slota 2009-08-17 15:04:45 UTC
fixed & unit tested

http://hg.netbeans.org/web-main/rev/6b8bbead7bc3
Comment 7 Quality Engineering 2009-08-21 06:02:26 UTC
Integrated into 'main-golden', will be available in build *200908210201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/6b8bbead7bc3
User: Tomasz Slota <tslota@netbeans.org>
Log: #162586: wrong formatting comments created using ctrl+/
Comment 8 Filip Zamboj 2009-10-06 19:02:09 UTC
added one more unit test for more complex example 

this issue is verified but new 173899 and 173900
Comment 9 Quality Engineering 2009-10-09 22:54:26 UTC
Integrated into 'main-golden', will be available in build *200910091401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/7493fb185255
User: Filip Zamboj <fzamboj@netbeans.org>
Log: unit test for #162586 added
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo