====== Netbeans 8.0.2 error formatting comments ====== There is a bug in Netbeans 8 when formatting PHP code (maybe other kind of code). ===== Scenario ===== function x() { if(1==1){ if(2 == 2){ //comment 1 do{ //comment 2 echo 'hello'; }while($a == $b); //comment 3 } } } Let's say you forget the ";" after the while($a==$b) or you type while($a=$b) instead of while($a==$b). Try to format now and you'll obtain this. function x() { if(1==1){ if(2 == 2){ //comment 1 do{ //comment 2 echo 'hello'; }while($a == $b) //comment 3 } } } Let's say at this point you realize the mistake so you correct the error anche format again... but surprise... this is what you get: function x() { if(1 == 1){ if(2 == 2){ //comment 1 do{ //comment 2 echo 'hello'; }while($a == $b); //comment 3 } } } All the comments remains on colum 1. You have to fix them manually one by one! 8-O ===== SOLUTION ===== CTRL+A (select all) TAB (Move every line on the right) ALT+SHIFT+F (format) Now it's all OK again! 8-) ===== Explanation ===== Netbeans doesn't indent/format comments on column 1. Moving everything on the right makes Netbeans reformat everything properly.