Discussion:
PHP Code Beautifier On Netbeans?
SNaRe
2009-08-21 08:33:18 UTC
Permalink
Hello,

I'm using PHPdesigner right now. It has PHP Code Beautifier module on it.

If you ask what is it for ?

For example you wrote very complicated code and you want to indent it.

On php designer when you press php code beautifer it automaticly formats that code and gives you nice result.

You don't have to check line by line.

Is there any modlu like this at netbeans? If i can find something like this i want to pass to netbeans.

Thanks for comments
Peter Ford
2009-08-21 10:42:24 UTC
Permalink
Post by SNaRe
Hello,
I'm using PHPdesigner right now. It has PHP Code Beautifier module on it.
If you ask what is it for ?
For example you wrote very complicated code and you want to indent it.
On php designer when you press php code beautifer it automaticly formats that code and gives you nice result.
You don't have to check line by line.
Is there any modlu like this at netbeans? If i can find something like this i want to pass to netbeans.
Thanks for comments
---------------------------------------------------------------------
Doesn't Alt-Shift-F do what you want?

You can also configure some of the behaviour in the
Tools->Options->Editor->Formatting panel
--
Peter Ford, Developer phone: 01580 893333 fax: 01580 893399
Justcroft International Ltd. www.justcroft.com
Justcroft House, High Street, Staplehurst, Kent TN12 0AH United Kingdom
Registered in England and Wales: 2297906
Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS
Filip Zamboj
2009-08-21 10:45:55 UTC
Permalink
Hi,

well, I don't really know how code beautifier in PHPDesigner works but
you can check Format action in NetBeans, you can use ALT+F or Source ->
Format.


Filip.
Post by SNaRe
Hello,
I'm using PHPdesigner right now. It has PHP Code Beautifier module on it.
If you ask what is it for ?
For example you wrote very complicated code and you want to indent it.
On php designer when you press php code beautifer it automaticly formats that code and gives you nice result.
You don't have to check line by line.
Is there any modlu like this at netbeans? If i can find something like this i want to pass to netbeans.
Thanks for comments
---------------------------------------------------------------------
SNaRe
2009-08-21 11:14:45 UTC
Permalink
Let me give a small example

Let's say we have a code like this


Code:
<?php

$x=1;

if($x==0){

if($x==0){

echo "y";

}

echo "x"; }

?>



As you see it's not indented(Maybe you will say indent it when coding. But i have many many if's foreach etc.

With PHP code beautifier in PHPdesigner i have just convert it to this witnh one click


Code:
<?php

$x = 1;

if ($x == 0) {

if ($x == 0) {

echo "y";

}

echo "x";

}

?>



I'm looking a property smilar to this.
Filip Zamboj
2009-08-21 11:22:43 UTC
Permalink
that's the same netbeans can do invoking Source -> Format from menu or
using alt+shift+f (it's not alt+f, sorry).


-------------
Filip Zamboj
Sun Microsystems

http://www.netbeans.org/community/issues.html
http://qa.netbeans.org
Post by SNaRe
Let me give a small example
Let's say we have a code like this
<?php
$x=1;
if($x==0){
if($x==0){
echo "y";
}
echo "x"; }
?>
As you see it's not indented(Maybe you will say indent it when coding. But i have many many if's foreach etc.
With PHP code beautifier in PHPdesigner i have just convert it to this witnh one click
<?php
$x = 1;
if ($x == 0) {
if ($x == 0) {
echo "y";
}
echo "x";
}
?>
I'm looking a property smilar to this.
---------------------------------------------------------------------
SNaRe
2009-08-21 11:22:59 UTC
Permalink
Just tried source->format it works pretty well.

Thank you very much.

It's not so good like phpdesigner but it's working for me now.



For example this can be fixed for other versions of netbeans. Let's say we have


Code:
<?php

if($a==1) {

echo "x"; }

?>



When i click format it gives me same result .

But it must give me this

<?php

if ($a == 1) {

echo "x";

}

?>
SNaRe
2009-08-21 11:27:38 UTC
Permalink
I have just sent a reply blow , 1 seconds before from you :) Please check the problem i wrote at the end of my post.

Thank you for your help. It seems i will be new fan of netbeans
Filip Zamboj
2009-08-21 12:31:36 UTC
Permalink
it looks like a bug. Don't hesitate to file a bug agains php ->
formatting on http://www.netbeans.org/community/issues.html.

Thanks.

-------------
Filip Zamboj
Sun Microsystems

http://www.netbeans.org/community/issues.html
http://qa.netbeans.org
Post by SNaRe
I have just sent a reply blow , 1 seconds before from you :) Please check the problem i wrote at the end of my post.
Thank you for your help. It seems i will be new fan of netbeans
---------------------------------------------------------------------
Tomasz Slota
2009-08-24 11:12:19 UTC
Permalink
Hi,

This functionality has been already requested, you may want to vote for
this issue:

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

Best regards,
-TS
Post by SNaRe
I have just sent a reply blow , 1 seconds before from you :) Please check the problem i wrote at the end of my post.
Thank you for your help. It seems i will be new fan of netbeans
---------------------------------------------------------------------
Loading...