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

ScalafmtSbtReporter$ScalafmtSbtError: scalafmt: Search state exploded #3141

Closed
AlexITC opened this issue Feb 25, 2022 · 7 comments · Fixed by #3144
Closed

ScalafmtSbtReporter$ScalafmtSbtError: scalafmt: Search state exploded #3141

AlexITC opened this issue Feb 25, 2022 · 7 comments · Fixed by #3144

Comments

@AlexITC
Copy link

AlexITC commented Feb 25, 2022

This template is a guideline, not a strict requirement.

  • Version: 3.4.3
  • Integration: sbt
  • Configuration: In the linked repo

Steps

Unfortunately, I haven't had enough time to isolate the problem but I'm linking a Scala file that crashes scalafmt, the problem seems related to snippets like:

set("&$disabled", CSSProperties()

Going to the linked repository and running sbt scalafmtCheckAll reproduces the problem.

Problem

Scalafmt formats code like this:

[info] scalafmt: Formatting 45 Scala sources (/home/dell/projects/mine/scala-webapp-template/web)...
[error] org.scalafmt.sbt.ScalafmtSbtReporter$ScalafmtSbtError: scalafmt: Search state exploded on '(∙Colors[3824:3830]', line 91 [/scala-webapp-template/web/src/main/scala/net/wiringbits/AppTheme.scala]
[error] (web / Compile / scalafmt) org.scalafmt.sbt.ScalafmtSbtReporter$ScalafmtSbtError: scalafmt: Search state exploded on '(∙Colors[3824:3830]', line 91 [/scala-webapp-template/web/src/main/scala/net/wiringbits/AppTheme.scala]

Workaround

I have had to disable scalafmt for such file.

@tusharmath
Copy link

Facing the same issue. Trying to re-create a build will post it here shortly.

@tusharmath
Copy link

@kitbellew
Copy link
Collaborator

@AlexITC @tusharmath where in the documentation did you look fo ways to deal with this? i will make sure the answer is there.

@AlexITC
Copy link
Author

AlexITC commented Mar 1, 2022

@kitbellew
Copy link
Collaborator

perhaps that's not a good place to explain this problem. ok, I'll add it somewhere in that file, hopefully that will solve the problem

@tusharmath
Copy link

tusharmath commented Mar 2, 2022

The documentation is here https://scalameta.org/scalafmt/docs/known-issues.html#deeply-nested-code

However, I don't know if my code qualifies for "deeply nested code".
I have tried all the mentioned approaches, none of them seem to work.

@tusharmath
Copy link

The other thing that I have observed is that it is happening on line number 267 in Http.scala. It doesn't matter what's on that line number, even if there is a comment, scalafmt throws this exception.

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 a pull request may close this issue.

3 participants