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

de-indent for Newline immediately following "(" #31

Open
cgay opened this issue Nov 30, 2018 · 4 comments
Open

de-indent for Newline immediately following "(" #31

cgay opened this issue Nov 30, 2018 · 4 comments

Comments

@cgay
Copy link
Member

cgay commented Nov 30, 2018

What we have now:

let foo = really-long-function-name(
                                    long-argument-1(),
                                    long-argument-2())

What I want:

let foo = really-long-function-name(
             long-argument-1(),
             long-argument-2())

Note, never this:

let foo = really-long-function-name(argument-0-on-same-line(),
             long-argument-1(),
             long-argument-2())

If there's an argument immediately following the open paren then subsequent args should line up under the first (as they do currently):

let foo = really-long-function-name(long-argument-1(),
                                    long-argument-2())
@waywardmonkeys
Copy link
Member

Another language has gone for not doing things that line up like your last example ... that way, people can use non-monospace fonts if they like!

@cgay
Copy link
Member Author

cgay commented Dec 1, 2018

Do not want.

@cgay
Copy link
Member Author

cgay commented Mar 5, 2019

There's also a fair amount of this style, and Peter Housel prefers it over my first choice above:

let foo = really-long-function-name
              (long-argument-1(),
               long-argument-2())

and I think it should be possible to support both styles depending on whether the open paren is (a) preceded by all whitespace or (b) followed by only whitespace and comments.

@cgay
Copy link
Member Author

cgay commented Jul 21, 2023

I recently learned the term for what I want, and it is https://github.com/google/google-java-format/wiki/The-Rectangle-Rule

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants