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

Put implicit parameter list in new line if characters in line exceeds the limit #196

Closed
jvican opened this issue Feb 23, 2016 · 8 comments
Closed

Comments

@jvican
Copy link

jvican commented Feb 23, 2016

I think it would be very useful to have this configuration. Most of the times, when a method signature is very long, one wants to put in a new line a part of the declaration (and most of the times that's an implicit parameter list). Also, this new line is usually indented.

Example:

def thisIsALongMethod[T](foo: String, bar: String, baz: Traversable[T])(implicit anotherArg: Foo[T]): Unit = { ??? }

would be converted into

def thisIsALongMethod[T](foo: String, bar: String, baz: Traversable[T])
  (implicit anotherArg: Foo[T]): Unit = { ??? }
@fommil
Copy link
Contributor

fommil commented Feb 23, 2016

yes!!! So much yes

@fommil
Copy link
Contributor

fommil commented Feb 23, 2016

but maybe with aligned (

def thisIsALongMethod[T](foo: String, bar: String, baz: Traversable[T])
                        (implicit anotherArg: Foo[T]): Unit = { ??? }

@jvican
Copy link
Author

jvican commented Feb 23, 2016

Both options could be accepted. What I don't like about the aligned ( is that the start of the implicit parameter list will depend on the function name and function type signature, which most of the times ends up being huge because of type bounds. Therefore it would be like doing nothing as the parameter list will surpass the char limit anyway.

@jkinkead
Copy link
Collaborator

Line limits in general would be really, really nice. It's something I've halfheartedly looked into in the past.

@mjaghouri
Copy link

I want this feature too. Any news about whether anything like would be available soon?

@godenji
Copy link
Collaborator

godenji commented Oct 25, 2017

@mjaghouri a fix for #77 is in progress. It won't be enforced automatically, but will allow param groups to exist on multiple lines (vs. forcing to single line as is the case now).

def foo[T]
  (a: A)
  (b: B)
  (implicit c: C)

This is in place on local dev branch. Working on Scala IDE integration, hope to have available within next couple of days, time permitting.

@fommil
Copy link
Contributor

fommil commented Oct 25, 2017

/me checks the scalafmt docs...

@godenji
Copy link
Collaborator

godenji commented Oct 25, 2017

Fixed in 0.2.4, see the readme and this comment for details

@godenji godenji closed this as completed Oct 25, 2017
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

No branches or pull requests

5 participants