vysker / vscode-php-formatter

Visual Studio Code extension. A wrapper for the Sensiolabs PHP CS Fixer. Analyzes some PHP source code and tries to fix coding standards issues (PSR-1 and PSR-2 compatible).
MIT License
92 stars 11 forks source link

Unable to find the php-cs-fixer tool. #25

Open Pymous opened 6 years ago

Pymous commented 6 years ago

Hello,

Fresh install of VSCode, with only this extension installed.

PHP-CS-Fixer is available globally (installed with Composer), the extension is configured to reflect this (phpformatter.composer: "true").

I properly restarted every instance of VSCode, even the computer (meh), and when hitting SHIFT + ALT + F, nothing happen.

AbbaouiAmine commented 6 years ago

same problem !!

bernhardriegler commented 6 years ago

have you edited the user settings (File/Code > Preferences > Settings)? You will have to set "phpformatter.composer": true It is false by default.

have you checked the VSCode developer console for log output? Go to Help >> Toggle Developer Tools Then run again.

For me the issue was that command executed looked something like this (this is logged to console):

Full command being executed: "php" "/usr/local/Cellar/php-cs-fixer/2.10.0/php-cs-fixer" fix "/var/folders/tv/86fqy1d13lz7w7b11cdgb0s00000gp/T/phpfmt-117507h8wliK4etYc.tmp" --level=psr2

and there was also an error message logged:

The "--level" option does not exist.  

It turns out version 1.13 of the underlying https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/1.13 still had this flag available. In newer versions this was removed in favor for --rules

AbbaouiAmine commented 6 years ago

thanks is fixed

2018-01-24 6:55 GMT-08:00 Bernhard Riegler notifications@github.com:

have you edited the user settings (File/Code > Preferences > Settings)? You will have to set "phpformatter.composer": true It is false by default.

have you checked the VSCode developer console for log output? Go to Help >> Toggle Developer Tools Then run again.

For me the issue was that command executed looked something like this (this is logged to console):

Full command being executed: "php" "/usr/local/Cellar/php-cs-fixer/2.10.0/php-cs-fixer" fix "/var/folders/tv/86fqy1d13lz7w7b11cdgb0s00000gp/T/phpfmt-117507h8wliK4etYc.tmp" --level=psr2

and there was also an error message logged:

The "--level" option does not exist.

It turns out version 1.13 of the underlying https://github.com/ FriendsOfPHP/PHP-CS-Fixer/tree/1.13 still had this flag available. In newer versions this was removed in favor for --rules

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Dickurt/vscode-php-formatter/issues/25#issuecomment-360160473, or mute the thread https://github.com/notifications/unsubscribe-auth/AaWvjCOXe26zG1B-qF7DfzZ8vBkrEtUaks5tN0RngaJpZM4Q4Iga .

MikeVelazcoMtz commented 6 years ago

I'm getting the same error and the console of developer tools is empty.

I installed the phar file inside /usr/local/bin and with not saved files I'm getting the message, and with files I don't get errors and not messages, but doesn't makes any format.

UPDATE I reloaded VSCode and formatting on normal files works, but I still get the message on unsaved files.

bardware commented 6 years ago

The "--level" option does not exist.

How to get rid of this "warning"? It's not a mere warning. The plugin does not work because the underlying tool does not do anything instead of ignoring this superfluos argument.

Sejiko commented 6 years ago

have you edited the user settings (File/Code > Preferences > Settings)? You will have to set "phpformatter.composer": true It is false by default.

have you checked the VSCode developer console for log output? Go to Help >> Toggle Developer Tools Then run again.

For me the issue was that command executed looked something like this (this is logged to console):

Full command being executed: "php" "/usr/local/Cellar/php-cs-fixer/2.10.0/php-cs-fixer" fix "/var/folders/tv/86fqy1d13lz7w7b11cdgb0s00000gp/T/phpfmt-117507h8wliK4etYc.tmp" --level=psr2

and there was also an error message logged:

The "--level" option does not exist.  

It turns out version 1.13 of the underlying https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/1.13 still had this flag available. In newer versions this was removed in favor for --rules

Thank you i removed this and it worked perfect!