-
Notifications
You must be signed in to change notification settings - Fork 42
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
Incorrect indent when methods are chained to inline new instance #435
Comments
Thanks for the issue! This is indeed a difficult one to write a title for 🤣 I'll take a look at this soon-ish, right now I'm rewriting this library in TypeScript so formatting changes need to take a bit of a back seat, but hopefully that won't take too long. |
@dangmai - No problem! I just wanted to let you know about the bug with no expectations beyond that. You are an excellent maintainer and THANK YOU for this library and the ongoing work you put into it. As for Typescript, that is awesome! The only JavaScript I write these days is for Salesforce, but aside from that I am 100% sold on using TypeScript for everything because it is so amazing. 😍 |
Looking at this issue now, there's actually some complexity to it. Your expected output has Basically, if there's only 1 method call, it's always attached directly to the parent expression with no line break, no matter how long it is. If there are more than 1, new lines with another level of indentation is added. Going down this route will also make it less of a cognitive switch when looking at formatted JS code and formatted Apex code, because they will have the same formatting behavior. |
Sorry for the cryptic title!
Everything is indented as if the
new
keyword does not exist.Input:
Actual output:
Additional example
Expected output:
Additional information (please fill this out):
"prettier-plugin-apex": "^1.10.0"
The text was updated successfully, but these errors were encountered: