This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 162586 - wrong formatting comments created using ctrl+/
Summary: wrong formatting comments created using ctrl+/
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Tomasz Slota
Depends on:
Reported: 2009-04-14 13:30 UTC by Filip Zamboj
Modified: 2009-10-09 22:54 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Filip Zamboj 2009-04-14 13:30:59 UTC
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. 

        elseif (!strcmp($message, 'USG_BUGTRACKING_QUERY')) {
< 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:
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: 
                              $itineraryData = getItinerary(0);

                              for($index=0;$index < count($itineraryData);$index++){

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

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

                            //                            $itineraryData = getItinerary(0);
                            //                            for($index=0;$index < count($itineraryData);$index++){
                            //                            }
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

will be formatted to 

if (1){
       // comment
Comment 6 Tomasz Slota 2009-08-17 15:04:45 UTC
fixed & unit tested
Comment 7 Quality Engineering 2009-08-21 06:02:26 UTC
Integrated into 'main-golden', will be available in build *200908210201* on (upload may still be in progress)
User: Tomasz Slota <>
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 (upload may still be in progress)
User: Filip Zamboj <>
Log: unit test for #162586 added