PHP CS Fixer: executablePath not found, please check your settings. It will set to built-in php-cs-fixer.phar. Try again!
Hey
On Windows, I don't seem to be able to get this to work on a multi-folder workspace, unless I use the absolute path, but then it's not guaranteed to work on other people's machines.
Say I have this setup:
"folders": [
{
"path": "."
},
{
"path": "..\\common-web"
}
],
And the MyProject.code-workspace file is inside the main repo, myproject.
If I open VSCode, and the file that is open is, say, common.php inside the ..\common-web folder, then executablePath not found for anything I try, except if I hardcode my full path.
Examples:
"php-cs-fixer.executablePath": "${workspaceFolder}\\vendor\\bin\\php-cs-fixer.bat",
=>
"syscall": "spawn f:\Files\Git\common-web\vendor\bin\php-cs-fixer.bat", "path": "f:\Files\Git\common-web\vendor\bin\php-cs-fixer.bat",
--
"php-cs-fixer.executablePath": "${workspaceFolder}\\..\\myproject\\vendor\\bin\\php-cs-fixer.bat",
=>
"syscall": "spawn myproject\vendor\bin\php-cs-fixer.bat", "path": "myproject\vendor\bin\php-cs-fixer.bat",
--
"php-cs-fixer.executablePath": "${workspaceFolder}/../myproject/vendor/bin/php-cs-fixer.bat",
=>
"syscall": "spawn myproject\vendor\bin\php-cs-fixer.bat", "path": "myproject\vendor\bin\php-cs-fixer.bat",
--
"php-cs-fixer.executablePath": "../myproject/vendor/bin/php-cs-fixer.bat",
=>
"syscall": "spawn ..\myproject\vendor\bin\php-cs-fixer.bat", "path": "..\myproject\vendor\bin\php-cs-fixer.bat",
--
I've also tried giving names to the folders:
"folders": [
{
"path": ".",
"name": "MyProject"
},
{
"path": "..\\common-web",
"name": "CommonWeb"
}
],
"php-cs-fixer.executablePath": "${workspaceFolder:MyProject}\\vendor\\bin\\php-cs-fixer.bat",
=>
"syscall": "spawn ${workspaceFolder:MyProject}\vendor\bin\php-cs-fixer.bat", "path": "${workspaceFolder:MyProject}\vendor\bin\php-cs-fixer.bat",
--
I assume the same issue would be with php-cs-fixer.config, which is located in myproject folder, but I don't want to hardcode my machine's full path.
--
Other extensions seem to work well with multi-folder.
For example, PHP Sniffer itself has no problem with just this:
"phpSniffer.executablesFolder": "..\\myproject\\vendor\\bin\\",
"phpSniffer.run": "onSave",
"phpSniffer.standard": "..\\myproject\\phpcs.xml",
Thanks!
not support related path, must absolute path
Thank you.
However, to make it work best with different machines and team developers, it would be nice to support relative paths or named filters like ${workspaceFolder:MyProject}.
Regards
For me this works with the current version. I'm on Windows 11 with WSL Ubuntu.
"php-cs-fixer.executablePath": "${workspaceFolder}/packages/laravel/vendor/bin/php-cs-fixer",
"php-cs-fixer.config": "${workspaceFolder}/packages/laravel/.php-cs-fixer.php"