soderlind / vscode-phpcbf

PHP Code Beautifier and Fixer for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=persoderlind.vscode-phpcbf
GNU General Public License v3.0
28 stars 10 forks source link

Search for phpcs.xml file in workspace root folder #29

Open arisanguinetti opened 5 years ago

arisanguinetti commented 5 years ago

This is my first time with vscode extensions, I think this change this might be useful.

danieliser commented 3 years ago

@soderlind Any chance this could be merged and extrapolated on?

There isn't really a reason why this shouldn't be automated entirely at this point, simply traversing from . relative to the file being formatted, to the workspace root checking for common phpcs file names and defaulting to them.

I'm in a situation currently that I have a default set in the workspace, but each submodule has its own gettext domains which we have rules for detecting when they are incorrect.

So we end up having to make a .vscode/settings.json file in each module to point to that modules rules file.

A standard traversal and search for common files would mean it always uses the closes, most relevant rules to the file being formatted.