First of all, thank you so so so much for supporting PHP. I have recently lost formatting support in php-cs-fixer w/ PHP 7.2.x and been frustrated.
I need to make a few adjustments to the the formatting rules for Prettier, do you happen to have a sample .prettierrc file which supports PHP?
Thanks for opening @mikeerickson! This should be supported out-of-the-box, we just don't have many options supported for php yet. If you try creating a .prettierrc file with this just to test
{
"printWidth": 50
}
does that work?
@mgrip I already have a file in place for all my JavaScript rules, but I am guessing there would be something different for PHP files (for example, 2 spaces for JS, 4 for PHP)
@mikeerickson Look at the overrides key
https://prettier.io/docs/en/configuration.html#configuration-overrides
@adamroyle awesome, thx a bunch!
I thought doing this:
{
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"overrides": [
{
"files": "*.php",
"options": {
"tabWidth": 4
}
}
]
}
But it's not taken in account when parsing PHP. The tabWidth:4 is only taken in account if I directly modify the option. Am I doing something wrong here?
@Einenlum Maybe check your prettier version is up to date? I did a test with your exact config and it worked.
Prettier is version 1.13.7
@adamroyle But I also have vim/prettier installed. Maybe there is a conflict somehow? Is there a way to know where the prettier executable does come from?