-
-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chained method arguments split up unnecessarily #1545
Comments
Same in latest version. Looks bad, especially in IF statements. |
I totally agree. Potentially, we could check how Prettier for JS handles this and port some of the logic to the plugin. cc @evilebottnawi |
Good idea |
Any news on this? Would be really great to only split chained methods if we're running out of space |
Hi @arnoson, I agree it would be nice to get this fixed. I currently don’t have time to work on this it myself, but I’d do my best to help anyone who’d be interested in taking this on. |
Thanks for the reply @czosel , unfortunanetly I'm also busy at the moment, might take a look into this if I find some time. Can you show me where exactly the linebreaks get inserted? |
Also hoping for an update on this issue. We recently began using Prettier for our codebase, both our PHP and JS code. Successive chained method calls on the JS side get wrapped to one method call per line only if the full line exceeds the line length limit, but the same thing occurs on the PHP side with >2 chained method calls, regardless of how long the line is. It's had an adverse affect on our codebase. It would be great if the PHP behavior could be consistent with the JS behavior. Thanks for your consideration! |
@prettier/plugin-php v0.14.3
Playground link
Input:
Output:
I'm specifically referring to the second
where
call. Prettier leaves this alone, so I assume it must be caused by the php plugin. It's behaving as if the print-width is much less. (I use 120, but this even fits in 80.)Prettier 2.1.2
Playground link
Input:
Output:
The text was updated successfully, but these errors were encountered: