Better auto format rules

General questions regarding the usage of CodeLite
AcsPrime
CodeLite Curious
Posts: 2
Joined: Mon Dec 14, 2015 4:57 pm
Genuine User: Yes
IDE Question: PHP
Contact:

Better auto format rules

Post by AcsPrime »

Hey guys,

Your ide really seems like a great piece of software.

I am coming from netbeans and in netbeans it would be possible to configure the auto format to format according to some rules.

For example, I would go to this website: https://maniaplanet.github.io/netbeans-psr/ and just import the settings for the formater and have my php code all nicely formated according to the PSR conventions.
I did look at the plugin "Source code formatter" but the options seemed a bit simple. Is there any other plugin that would allow me to customize how the auto formatter works a bit more in-depth?
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Better auto format rules

Post by eranif »

CodeLite supports 2 foramtters for PHP:

The built-in formatter which is a simple formatter with not much rules
The second is called PHP-CS-Fixer https://github.com/FriendsOfPHP/PHP-CS-Fixer which you can configure with many options

Have you tried using the later?

Eran
Make sure you have read the HOW TO POST thread
AcsPrime
CodeLite Curious
Posts: 2
Joined: Mon Dec 14, 2015 4:57 pm
Genuine User: Yes
IDE Question: PHP
Contact:

Re: Better auto format rules

Post by AcsPrime »

I can try, but you pointed to a php github repo.
I am confused.. does code lite have some configuration dialog for this?
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Better auto format rules

Post by eranif »

plugins->source code formatter
In the "General" page, select under "PHP Formatter" select the "PHP-CS-Fixer" option.
Next, configure the the code PHP-CS-Fixer: plugins->source code formatter->php->php-cs-fixer:

PHP Executable: select the PHP executable
PHP-CS-Fixer phar file: select the path to the phar file

and then you can add arguments from the link I provided

Eran
Make sure you have read the HOW TO POST thread
Post Reply