X

An Oracle blog about NetBeans for PHP

  • News
    October 19, 2009

Formatting and Indentation

I attended this weekend WebExpo 2009 in Prague. I had one session there
about developing web applications in NetBeans. Originally I though that
the presentation should be divided into two main parts. One part about
PHP and second part about Java Web. Because the bulk of the audience
were PHP developers, I spent  talking about PHP development in NetBeans
almost whole session. After the session there was a long discussion
(more than 1 hour) and some people complained about formatting.


As a result I have decided to look at this and to try to fix as many
bugs as possible. Because there is not much time for NetBeans 6.8, I
would like to ask you for help. I have created task in our
Issuezilla, where you can put the cases, when formatting or indentation
doesn't work correctly. If you don't have Issuezilla account and you don't want to create it, you can paste the cases here as a
comment. A case should contain an example of the code before formatting
/ indentation and also the same code, but in the right form.


I can not promise that we can fix all these cases, but we will try as many as possible.


Thanks for your help.

Join the discussion

Comments ( 23 )
  • Michal Tuesday, October 20, 2009

    Are new nightly builds broken or something? After some time netbeans uses almost 100% of cpu. You can't close it (you must kill it).

    It happens on windows and linux (on two different symfony projects).


  • Yasir M Turk Tuesday, October 20, 2009

    I started using Netbeans 6.7.1 for Java ME and it drive my efficiency to zero.

    with only one project loaded in the IDE the Memory usage goes upto 400+ MB and when the code file grow bit larger it takes full cpu even if i edit a line of code.

    Visual Studio 2008 with 4-6 projects loaded at the same dont consume more than 300 MB.

    I am running Core 2 duo 3 GHz with 2GB RAM


  • gaga Tuesday, October 20, 2009

    uhhhh, post with no pictures. Sad.


  • Tomas Mysik Tuesday, October 20, 2009

    To Michal:

    File an issue, please. Thanks.


  • Keith Davis Wednesday, October 21, 2009

    Task won't open (times out.) Why do the Continuation Indentation and Label Indentation options not work? If I change them, they are not saved, neither is the override for PHP

    6.7.1.


  • Keith Davis Wednesday, October 21, 2009

    Well, the link to the task is working...but very sloooow.


  • Jaime Wednesday, October 21, 2009

    For me happens the same thing: after some time using netbeans 6.8 m2, it uses 100% of the CPU and the collapse.

    6.8 has many good features that I love, but I have to go back to 6.7 until the CPU matter is fixed.

    Thank for all


  • Anton Danilchenko Friday, October 23, 2009

    I found bad situation.

    I have see autocompletion of jQuery in html and js files. But see non-jquery completion.

    Please, fix this bug. And remove option from menu with old "external libraries".

    Thanks!


  • Alexander Biryukov Sunday, October 25, 2009

    Hi guys.

    Yesterday I installed NB 6.8 Beta (for PHP) and found bug related with Code Templates completion and formating.

    I use Debian GNU/Linux 'lenny'.

    Here is my steps:

    1. Go to Tools->Options. Switch Editor section and next choose Code Templates tab.

    2. Add new template.

    I add template for PHP language. Set abbreviation: dump.

    And for Expanded Text I set next ONE LINE:

    echo '<pre>'; print_r(${cursor}); exit();

    3. Save this template.

    4. Go to editor and in .php file I type dump and immediately press TAB button.

    Here is results:

    echo '<pre>';

    print_r(${cursor});

    exit();

    After each ";" symbol I see a new line. But my template contains only one line! without any line breaks.

    I don't know where I can post this bug. Can anybody says where I can post this bug?

    Sorry if I created offtop post.

    Thank you.


  • Petr Pisl Tuesday, October 27, 2009

    This is issue of the formatter. When there is a template placed to the editor, then it's formatted. So probably we need to introduce new option in the formatter.


  • street light Thursday, October 29, 2009

    street light street light street light


  • nik Saturday, October 31, 2009

    (1)

    Other editors:

    write line<ENTER>

    | Cursor goes there

    __write indented line<ENTER>

    __| Cursor stays on indentation

    <ENTER><TAB>

    __| Cursor remembers indentation range

    This feature would resolve the most problems, in my opinion.

    (2)

    You cannot set the "Number of Spaces per Indent" to Zero, so it is impossible to use a ind.-schemes like Whitesmiths/Banner Style.

    (3)

    A really imortant option would be: Disable PHPDoc-Syntax for multiple line comments. I really _hate it_, if my IDE forces me to use a asterisk in every line of my multiple line comment.


  • Snake Monday, November 2, 2009

    just some comments:

    I have add some custom code template for PHP templating in HTML file type.

    such as:

    <?php echo '${cursor}'; ?>

    but the output turns out:

    <?php echo '<CURSOR HERE>'

    <LINEBRAK>; ?>

    Just some formatting issue.


  • Snake Monday, November 2, 2009
  • Alexander Biryukov Tuesday, November 3, 2009

    I created bug related with this problem

    http://www.netbeans.org/issues/show_bug.cgi?id=175493

    But I received answer that this is "a feature".


  • Martin Vrkljan Thursday, November 5, 2009

    Nested code formatting breaks when Alt+Shift+F is pressed.

    Example:

    Before Alt+Shift+F:

    $ar = array (

    __array (

    ____'foo' => 'bar',

    ____'foo' => 'bar',

    ____array (

    ______'foo' => 'bar'

    ____)

    __)

    );

    After Alt+Shift+F:

    $ar = array (

    __array (

    __'foo' => 'bar',

    __'foo' => 'bar',

    __array (

    __'foo' => 'bar'

    __)

    __)

    );


  • Agus Suhartono Wednesday, November 11, 2009

    I request for PHP Braces

    currenly there are 3 option:

    1. new line

    2. same line

    3. preserve existing

    Zend framework have coding standard:

    - new line for class and method

    - same line for if, for, while, switch and other

    i think this style must add to Netbean

    thank you

    regards


  • Anton Friday, November 27, 2009

    Zend Framework coding standard support

    would be nice.

    Actually its not possible in netbeans.

    If I "Format" my php code I would like

    to be able to transform:

    $a='text1'.'text2';

    to

    $a = 'text1' . 'text2';

    I mean add spaces to the '=' and '.'

    (adding spaces to the '=' works in java files!)


  • Max Thursday, December 10, 2009

    Having code formatting/indentation options or rules is a definate must-have.

    I'd love to see something along the lines of the java implementation found in NB or the PHP code formatting options found in Zend Studio.


  • Wixiweb Thursday, March 25, 2010

    Zend Framework coding standard support please !

    - new line for class and method

    - same line for if, for, while, switch and other

    Thanks !


  • Sesli Chat Friday, March 26, 2010

    I know you the engineers working on product are supper busy. Is there a way for us the user of NetBeans to be able to contribute? The more people are involved the more NetBeans becomes popular.


  • one dollar item Sunday, September 19, 2010

    Yesterday I installed NB 6.8 Beta (for PHP) and found bug related with Code Templates completion and formating.

    I use Debian GNU/Linux 'lenny'.

    Here is my steps:

    1. Go to Tools->Options. Switch Editor section and next choose Code Templates tab.

    2. Add new template.

    I add template for PHP language. Set abbreviation: dump.

    And for Expanded Text I set next ONE LINE:

    echo '<pre>'; print_r(${cursor}); exit();

    3. Save this template.

    4. Go to editor and in .php file I type dump and immediately press TAB button.

    Here is results:

    echo '<pre>';

    print_r(${cursor});

    exit();

    After each ";" symbol I see a new line. But my template contains only one line! without any line breaks.

    I don't know where I can post this bug. Can anybody says where I can post this bug?

    Sorry if I created offtop post.


  • Murat Boz Tuesday, November 22, 2011

    Task won't open (times out.) Why do the Continuation Indentation and Label Indentation options not work? If I change them, they are not saved, neither is the override for PHP


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.