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

[tall] Allow an unsplit method target on the same line as an assignment #1466

Open
munificent opened this issue May 6, 2024 · 0 comments
Open
Labels
common difficult meh risky tall Issues related to the new "tall" style (#1253)

Comments

@munificent
Copy link
Member

This issue is somewhat similar to #1465. Where that one relates to conditional expressions on the right-hand side of "assignments" (=, :, =>), this is about method chains. A method chain can split in a few ways:

// Unsplit:
target.method(arg).another(arg);

// Block split:
target.method(arg).another(
  arg,
);

// Chain split:
target
    .method(arg)
    .another(arg);

Currently, if the right-hand side of an assignment is a method chain that chain splits, it also splits the assignment, like:

thing = 
    target
        .method(arg)
        .another(arg);

It would be nice to allow the target to stay on the same line as the assignment:

thing = target
    .method(arg)
    .another(arg);

This would only apply if the target itself doesn't split. A split in the target would still force the assignment to split. So:

// Disallowed:
thing = (veryLong +
        targetExpression)
    .method(arg)
    .another(arg);

// Allowed:
thing =
    (veryLong +
            targetExpression)
        .method(arg)
        .another(arg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common difficult meh risky tall Issues related to the new "tall" style (#1253)
Projects
None yet
Development

No branches or pull requests

1 participant