Open Darkein opened 6 years ago
Please post your phpcbf settings
yes!
"phpcbf.executablePath": "${workspaceRoot}/fuel/vendor/bin/phpcbf",
"phpcbf.standard": "/Users/pierrefiorelli/repos/visiotalent/api/phpcs.xml",
"phpcbf.debug": true,
"phpcbf.onsave": true,
"phpcbf.documentFormattingProvider": true
It works with this config, but i want to use ${workspaceRoot}/api/phpcs.xml
instead of the full path
thanks :)
ok, I'll fix this in the next release
It's worth noting that ${workspaceRoot}/
, ${workspaceFolder}/
and ./
currently all essentially resolve to the same thing (when used for the executablePath setting), but we should probably just prefer the ./
prefix.
Details:
${workspaceRoot}
is deprecated but should always resolve to the first (top most) folder defined in the multi-root project, or the only folder in single-folder projects, regardless of where the setting is defined.
${workspaceFolder}
and .
should work identically, and resolve relative to the settings folder that they are defined in. If these are used in the xxxxx.code-workspace
file (this is likely a mis-configuration since the file is location independent) we should fallback to the first folder like ${workspaceRoot}
does.
Since ${workspaceRoot}
is deprecated, and relies on strange fallback behavior (its a good fallback, but it depends on the order of the folders defined in the xxxxx.code-workspace
file which is a bit weird for users) we should discourage its use.
We should also discourage setting relative path configurations in the xxxxx.code-workspace
file for similar reasons.
Since ${workspaceFolder}
and .
should work identically, the former is redundant, and we should simply encourage .
for all relative path settings. And we should encourage these settings to be defined in the .vscode/settings.json
files only. Setting the paths project wide, for all folders, is valid, but strange, since the files would need to be installed in each directory anyway.
TLDR; there is no real Project Root in VSCode. If one is really needed, you should probably define an absolute path, not a relative one, or rely on the hack of using the ${workspaceRoot}
fallback, keeping in mind it relies on the first defined folder.
Just in case, I've created a PR #29 to automatically add the phpcs.xml as standard.
Hello,
i'm using my own phpcs.xml, and unfortunately vscode-phpcbf doesn't find it if i don't pass the full path of it. Because i'm working with a team, i need to use the ${workspaceRoot} variable inside the phpcbf.debug variable.
I have the following error:
ERROR: the "${workspaceRoot}/phpcs.xml" coding standard is not installed.