Sodaware / php-beautifier.el

Integrate Emacs with PHP_Beautifier
https://www.philnewton.net/code/php-beautifier-el/
GNU General Public License v3.0
6 stars 0 forks source link

Missing phpcbf #6

Open djwave28 opened 4 years ago

djwave28 commented 4 years ago

Installed phpcbf on linux box and added this repo in emacs.

PHP_Beautify works, but puts all functions and docblocks together. Deleting all empty lines. Option phpcbf is not found at all. It is installed, but the beatify options do not list for phpcbf. Can the PHP_Beautify be set to keep 1 empty line?

GNU Emacs 26.3

I did some work in the terminal with PHP_Beautify and have a positive result with adding a filter php_beautifier --input unformatted_file.php --output formatted_file.php -s --filters "NewLines(before=if:switch,after=T_CLASS:T_COMMENT:function:T_DOC_COMMENT)"

I don't know enough about emacs (yet) and since this repo already exists...

Sodaware commented 4 years ago

Thank you for the report! I think I can add a configuration option for passing filters to php_beautifier.

Could you please include the following:

  1. Some example PHP code that needs formatting
  2. The same code from step 1, but after running php-beautifier-format-buffer
  3. The same code from step 1, but with the desired format result

It will make writing tests much easier. Thank you!

Cheers, Phil

djwave28 commented 4 years ago

Phil,

Thanks for the quick reply.

I have played with the filters in the terminal to see what would be a minimum and what would be the desired result. I added some files and the command i used to get the result. php-beautify-filters.zip

I don't know if you can have a look at your phpcbf functionality as well. From what I understand this option should be listed when phpcbf is installed, but I do not see it in emacs as an option.

Thanks a lot. And stay safe! Cheers, Daniel

Sodaware commented 4 years ago

Thank you for the example files, they're a huge help! I definitely think I can add filter support.

I'll look into the phpcbf issue as well.

Cheers, Phil