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.
Comments:

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).

Posted by Michal on October 20, 2009 at 02:16 AM CEST #

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

Posted by Yasir M Turk on October 20, 2009 at 02:41 AM CEST #

uhhhh, post with no pictures. Sad.

Posted by gaga on October 20, 2009 at 02:44 AM CEST #

To Michal:
File an issue, please. Thanks.

Posted by Tomas Mysik on October 20, 2009 at 03:10 AM CEST #

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.

Posted by Keith Davis on October 21, 2009 at 08:46 AM CEST #

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

Posted by Keith Davis on October 21, 2009 at 08:51 AM CEST #

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

Posted by Jaime on October 21, 2009 at 11:38 AM CEST #

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!

Posted by Anton Danilchenko on October 23, 2009 at 02:51 PM CEST #

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.

Posted by Alexander Biryukov on October 25, 2009 at 01:35 PM CET #

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.

Posted by Petr Pisl on October 27, 2009 at 04:09 AM CET #

street light street light street light

Posted by street light on October 29, 2009 at 09:05 PM CET #

(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.

Posted by nik on October 31, 2009 at 08:59 AM CET #

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.

Posted by Snake on November 02, 2009 at 09:48 AM CET #

sorry, I just noticed that there is a similar report. at http://blogs.sun.com/netbeansphp/entry/formatting_and_indentation#comment-1256499312000

Posted by Snake on November 02, 2009 at 09:49 AM CET #

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".

Posted by Alexander Biryukov on November 03, 2009 at 02:03 AM CET #

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'
__)
__)
);

Posted by Martin Vrkljan on November 05, 2009 at 12:40 PM CET #

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

Posted by Agus Suhartono on November 11, 2009 at 05:54 PM CET #

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!)

Posted by Anton on November 27, 2009 at 01:14 AM CET #

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.

Posted by Max on December 10, 2009 at 05:59 AM CET #

Zend Framework coding standard support please !

- new line for class and method
- same line for if, for, while, switch and other

Thanks !

Posted by Wixiweb on March 25, 2010 at 07:19 AM CET #

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.

Posted by Sesli Chat on March 26, 2010 at 03:55 PM CET #

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.

Posted by one dollar item on September 19, 2010 at 08:31 PM CEST #

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

Posted by Murat Boz on November 22, 2011 at 01:32 PM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
About

This blogs is written by NetBeans developers who contribute to the PHP support mainly.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today