kokororin / vscode-phpfmt

Integrates phpfmt into VS Code
https://marketplace.visualstudio.com/items?itemName=kokororin.vscode-phpfmt
BSD 3-Clause "New" or "Revised" License
130 stars 30 forks source link

Could not open input file error on format #104

Closed gab-globusgroup closed 1 year ago

gab-globusgroup commented 1 year ago

Hello and thank you for this great plugin!

Since the last update, when I format php files it looks like it prepends my current working folder to the path to the formatter, generating this error:

Could not open input file: /Users/gabriele/myprojectfolder/app/Http/Controllers//Users/gabriele/.vscode/extensions/kokororin.vscode-phpfmt-1.1.1/node_modules/use-phpfmt/fmt-external.stub.php

I didn't change anything in the configuration and I tried to restart vscode/reinstall the plugin with no success.

This are my settings for phpfmt:

"phpfmt.enable_auto_align": false,
"phpfmt.php_bin": "/opt/homebrew/opt/php@8.0/bin/php",
"phpfmt.passes": [
    "SpaceAfterExclamationMark",
],
"phpfmt.exclude": [
    "PSR2ModifierVisibilityStaticOrder"
],
"[php]": {
    "editor.defaultFormatter": "kokororin.vscode-phpfmt"
},

Am I missing some new setting? Any help debugging this would be much appreciated, thank you!

kokororin commented 1 year ago

Version 1.1.1 have bug with passes and exclude. Maybe the PR https://github.com/kokororin/vscode-phpfmt/pull/101 breaks this. If you want to use passes and exclude with 1.1.1, as a temporary fix, you can download the previous fmt.phar, extract fmt.phar to /Users/gabriele/.vscode/extensions/kokororin.vscode-phpfmt-1.1.1/node_modules/use-phpfmt/fmt.stub.php.

Or just downgrade the extension version.

kokororin commented 1 year ago

Fixed in 1.1.3