Hi,
Just made a small plugin for sublime. It uses php_beautifier from pear channel http://pear.php.net/package/PHP_Beautifier/
You can grab it here https://github.com/SublimeText/PhpBeautifier or via package controle
Regards
Hi,
Just made a small plugin for sublime. It uses php_beautifier from pear channel http://pear.php.net/package/PHP_Beautifier/
You can grab it here https://github.com/SublimeText/PhpBeautifier or via package controle
Regards
I just updated the plugin with options that add newlines in the code.
-s4 -l \'ArrayNested() NewLines(before=switch:while:for:foreach:T_CLASS:return:break,after=T_COMMENT:protected:private)\'
I’m trying to add a newline just before comment block, but doesn’t seem to work. More on that later
The command-line on a script of PHP Code Beautifier i downloaded recently appears to be a closed-source app and is not available for Mac OS X. That’s embarrassing. Do not know what to do.
Hi Arnorld,
I’m aware that my plugin do not work well on macos. I’m in the process of refactoring the plugin to use ‘subprocess’ instead of ‘commands’, which will improve compatibility.
The php script used by the plugin is open source, under php licence. You can grab it here pear.php.net/package/PHP_Beautifier/.
Just push a new version of the plug-in. It now use the subprocess library, and call directly pear php_beautifier, so it should resolve the problem with MacOS (not tested yet, need feedback).
The plug-in currently format all current file content and I redirect stderr to a custom panel (so no more errors in place of the code \o/).
The next step is a decent config file with configurable php_beautifier path and filter. You can also edit the options directly in the python file. Default options are :
indent = “-s4” # 4 spaces
filters = “ArrayNested() NewLines(before=switch:while:for:foreach:T_CLASS:return:break) Pear(add-header=false)”
Does this work with Sublime Text 2 (portable) under Windows (instead of linux / macos)?
If yes, can you provide the information how to install (or where to copy) the necessary php_beautifier components?
Tia,
Highend