Skip to content
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

Don't break before [ or { in single argument (labeled) function calls. #22

Merged
merged 1 commit into from
Jul 26, 2019

Conversation

allevato
Copy link
Collaborator

This change is like the one in commit 82e3e16, but allows the line break to be omitted if you have a function call with a single labeled argument whose value is an array/dictionary/closure literal.

Getting this to work ended up revealing a couple other bugs around the way open breaks were handled. Previously, they unconditionally increased the indentation level of their scope, which meant that if one break didn't fire but another on the same line did, then the next line would be indented two units from the previous line instead of one. Now, an open break only contributes to indentation if it is not followed by another one on the same line.

As a consequence of this, closure literal handling changed slightly. The changes were positive ones, allowing certain short closure literals to be formatted more compactly than the previous algorithm allowed.

Fixes SR-11106.

…alls.

This change is like the one in commit 82e3e16,
but allows the line break to be omitted if you have a function call with a
single labeled argument whose value is an array/dictionary/closure literal.

Getting this to work ended up revealing a couple other bugs around the way
open breaks were handled. Previously, they *unconditionally* increased the
indentation level of their scope, which meant that if one break didn't fire
but another on the same line did, then the next line would be indented *two*
units from the previous line instead of one. Now, an open break only
contributes to indentation if it is not followed by another one on the same
line.

As a consequence of this, closure literal handling changed slightly. The
changes were positive ones, allowing certain short closure literals to be
formatted more compactly than the previous algorithm allowed.

Fixes SR-11106.
@allevato allevato requested a review from akyrtzi July 26, 2019 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants