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

SearchStateExploded error #605

Closed
cb372 opened this issue Dec 5, 2016 · 5 comments
Closed

SearchStateExploded error #605

cb372 opened this issue Dec 5, 2016 · 5 comments

Comments

@cb372
Copy link
Contributor

cb372 commented Dec 5, 2016

Version: 0.4.10
Integration: coursier, via my poor man's sbt plugin
Configuration: maxColumn = 120; project.git = true

[warn] Error in /Users/chris.birchall/code/mailgun-api-client/src/test/scala/com/ovoenergy/mailgun/model/events/EventsResponseSpec.scala: org.scalafmt.Error$SearchStateExploded: Search state exploded around line 59

The input is this ridiculously verbose test I just wrote.

@olafurpg
Copy link
Member

olafurpg commented Dec 5, 2016

This is a known issue, see #140 for an explanation. #582 is related. For config style arguments (like in your test) I don't think this should be too hard to fix. Turns out this is a blocker for #588, so I might take a look at it soon.

ps. 120 max column is a lot, you must have a wide display :p

@cb372
Copy link
Contributor Author

cb372 commented Dec 5, 2016

120 max column is a lot

I thought you would pick up on this. I know, I'm a monster!

Thanks for the quick response.

@olafurpg
Copy link
Member

Good news @cb372, see https://github.com/olafurpg/scalafmt/pull/621

Your ridiculously verbose test has now become a scalafmt unit test :D The change is limited to Term.Apply with a large number of arguments and large bodies. In those cases, scalafmt will force "config style" and dequeue the search space at the start of every argument. The optimization is controlled by two magic numbers, which are configurable inside runner.optimizer. I have no idea if the defaults are any good.

I'll include this for v0.5!

@olafurpg
Copy link
Member

Closing this since your particular example now formats easily.

@cb372
Copy link
Contributor Author

cb372 commented Dec 19, 2016

Yay! Thanks for the fix! I love your flamegraph-style test output by the way.

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

2 participants