mansoorkhan96 / php-cs-fixer

PHP CS Fixer extension for VS Code with zero config
https://marketplace.visualstudio.com/items?itemName=mansoorkhan96.php-cs-fixer
MIT License
11 stars 4 forks source link

Specify multiple config files #10

Closed YummYume closed 2 years ago

YummYume commented 2 years ago

Hello,

Thanks for this extension, it works like a charm and is currently the only one that works for me. However, I would suggest adding the possibility to specify multiple config files as the php-cs-fixer config file does not always have the same name across various projects (eg: '.php-cs-fixer.php|php-cs-fixer.dist.php' would first look for .php-cs-fixer.php and then php-cs-fixer.dist.php if the first one does not exist. Do you think that would be possible?

mansoorkhan96 commented 2 years ago

Hello,

Thanks for this extension, it works like a charm and is currently the only one that works for me. However, I would suggest adding the possibility to specify multiple config files as the php-cs-fixer config file does not always have the same name across various projects (eg: '.php-cs-fixer.php|php-cs-fixer.dist.php' would first look for .php-cs-fixer.php and then php-cs-fixer.dist.php if the first one does not exist. Do you think that would be possible?

If I am getting you right, you can name your config file as you want.

If you are having trouble loading the config file from your workspace/project. You can use php-cs-fixer.config option to load it.

"php-cs-fixer.config": "./.php-cs-fixer.php"

The above setting would try to load the config file from the opened project/folder.

If you want to load a global config file i.e. single config file for all projects. You can load it from any location, but I have it inside .vscode dir

"php-cs-fixer.config": "C:\\Users\\username\\.vscode\\.php-cs-fixer.php"

I hope this helps.

mansoorkhan96 commented 2 years ago

11

@YummYume I have added support to define workspace-based config files.

YummYume commented 2 years ago

@mansoorkhan96 This is amazing! This solves all problems, thank you :smiley: