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
Long names cause strange line-breaks with Arrow Functions #61
Comments
I think you should just move it into a proper block: var oneLongVariableName = (foo, bar) => {
return this.longerMethodName(c, service).forEach(otherLongFunctionName);
} We don't really support arrow functions without blocks with code on the next line. It would be a hard special-case to format correctly without breaking other formats that involve arrow expressions. |
(Watching the twitch live stream) I possible solution that would respect the case above, and the chains of - for example - promises, could be to align on the period, like:
|
I would really love to see this re-opened... cool if I try to tackle it as a first contribution? 😉 (EDIT: he is working on it again) |
@rattrayalex Sure! If I didn't just solve it, I'll leave it up to you :) I think I may have something works. |
Ok, let's try this. I'm curious if this causes any other awkward formatting, but I think this works. |
I've found a strange case when using Arrow functions, chaining methods off an object inside the arrow function.
If I shorten the length of the variable name
or shorten the first method name
then it collapses and displays more correctly.
I also noticed that changing the name of the
otherLongfunctionName
doesn't have any effect. In either case above, both long names push the line length beyond the acceptable length. This causes the arrow function parameters to be put on a new line, even though line-breaking afterthis
would lead to a better result. IMO the "problem" examples I provided are already formatted ideally.The text was updated successfully, but these errors were encountered: