Formatting - Spaces I

The next  categories, where you can set up the formatting of PHP code is category Spaces. Currently there are implemented more then 40 options that are separated into six groups. All these options as other options, which were mentioned in previous posts about formatting are available in development builds (NetBeans 6.9). The formatting has to be tested properly, if you find a problem, please report it in our database or at least write as a comment here.

The first group Before Keywords defines spaces before a keyword that are usually after '}' char. By default all these properties are switched on. 

The second group Before Parentheses contains options that defines spaces before left parentheses. All options in this group are by default switch on except Method / Function Declaration and Method / Function Call.

The last group mentioned in this post is Before Left Braces. In this group you can define whether the formatting handles space between open brace and an element. All the properties in this group are switched on by default.

Continue the next time.

Comments:

uff too many formating options, this will satisfy everybody :) but it will be nice future if user can select from some predefined formatings, like PEAR, Zend, ...

Posted by bimbo on February 16, 2010 at 02:51 AM CET #

Too bimbo: It's on my plan. But at first I have to implement more options to satisfy the mentioned styles.

Posted by Petr Pisl on February 16, 2010 at 02:53 AM CET #

Hello,

I allready mentioned this in an earlier post:

it would be great to have an option to add spaces between parentheses like this:

For functions( calls and definitions ):
function( $param1, $param2 );

For Arrays:
$array[ $value ];

Hope this will be possible...

Thanks and greetings,
Urkman

Posted by Urkman on February 16, 2010 at 02:55 AM CET #

To Urkman: It's already implemented, it will be mentioned in the next post. Both properties belong to Within Parentheses group.

Posted by Petr Pisl on February 16, 2010 at 03:22 AM CET #

Why does it format one way when I highlight a section of code and select Format, and another way when I format the whole file?

Posted by Keith Davis on February 16, 2010 at 06:40 AM CET #

To Keith: Could you write an example? It will be much easier to answer your question for a case. There can be many reasons, why the behavior is different. Also it can be just a bug.

Because the formatting use also AST for obtaining information, the file should be without errors. And it depends which part of text you select, etc.

Posted by Petr Pisl on February 16, 2010 at 09:02 AM CET #

Hey,

it would be cool, if these settings could be applied to project specific configurations. Without those, the latter don't help much.

Posted by Franz Liedke on March 05, 2010 at 10:16 AM CET #

To Franz Liedke:

A project can use global option or overwrite with the project setting. So, yes the options can be project specific.

Posted by Petr Pisl on March 11, 2010 at 08:49 AM CET #

Sometimes I use multiple spaces to make code more readable (multiline strings). In such cases it would be nice to either be able to turn off space formatting or - even better - opt to leave spaces as they are, e.g. for string concatenation.

Thank you!

Posted by Ron on June 21, 2010 at 06:40 AM CEST #

Ok with Ron,
Concerning to assignations, I used to tabulate (with spaces) to align variables, operators and values on several lines. Formatting removes all of preciously added spaces!
I really need to disable the [Formatting / PHP / Spaces / Around Operators / Assignment Operators].

Thanx

Posted by Buu-Lam on August 10, 2010 at 12:01 PM CEST #

this is very diffrent from the earlier versions!!

I was a little disapointment when using the previos versions

Posted by florida cpa on January 15, 2011 at 01:43 PM CET #

It would be nice if Eclipse settings could be imported so they can be shared between team-members with different taste of IDE.

Posted by gkforcare on March 29, 2011 at 06:16 AM CEST #

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