vscode-php-cs-fixer
vscode-php-cs-fixer copied to clipboard
php-cs-fixer.executablePath works, but not in combination with ${workspaceFolder} that contains a SPACE
Context
https://github.com/junstyle/vscode-php-cs-fixer/pull/182 I see this previous ticket resulted in making it so that ${workspaceFolder} can be used, which is great since i have about 100 sites that all have a local version of php-cs-fixer. For those in the config i use
"php-cs-fixer.executablePath": "${workspaceFolder}/app/public/vendor/friendsofphp/php-cs-fixer/php-cs-fixer",
Which equals to
"/Users/name/Local Sites/client/app/public/vendor/friendsofphp/php-cs-fixer/php-cs-fixer"
The issue
However the issue is that the file path contains a space in the "Local Sites" directory, and yes its stupid that it contains a space, but its not a directory name i can change since im using "Local by Flywheel" which creates and expects the directory to be that way.
Thus resulting in this error:
runAsync: spawn /Users/name/Local Sites/client/app/public/web/app/themes/sage/app/public/vendor/friendsofphp/php-cs-fixer/php-cs-fixer
[
"fix",
"--using-cache=no",
"--format=json",
"--rules=@PSR12",
"--path-mode=override",
"/var/folders/cs/_xsxqrm14d3b3_mw0svyscdh0000gn/T/pcf-tmp0.18446464208639424/functions.php"
]
{
"cwd": "/Users/name/Local Sites/client/app/public/web/app/themes/sage",
"shell": true
}
runAsync: error
{
"exitCode": 126,
"stdout": null,
"stderr": "/bin/sh: /Users/name/Local: Permission denied\n"
}
runAsync: reject promise
/bin/sh: /Users/name/Local: Permission denied
As you can see it gets confused by the space in the foldername and aborts early.
Is there any way you can modify the way that executablePath is taken in? Since
- i cannot change the directory name
- putting quotes around the entire string, makes it so that ${workspaceFolder} is no longer interpreted
- i have no other ways to modify workspaceFolder so that it escapes the space in the path.
I have found this other issue where someone else is having the same issue, and there they modified the internal command the extension uses i believe.
https://github.com/microsoft/vscode/issues/57148
Extra info:
-
macos m1
-
PHP 8.1.29 (cli)
-
Version of php-cs-fixer vscode extension 0.3.14 - 4 days ago (current)
-
Local version of php-cs-fixer in project "v3.61.1"
-
Path to local php-cs-fixer /Users/name/Local Sites/client/app/public/vendor/friendsofphp/php-cs-fixer/php-cs-fixer
-
Path to local php-cs-fixer config file /Users/name/Local Sites/client/app/public/.php-cs-fixer.php
-
config file: https://pastebin.com/9dQuesWu