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

Illegal Scala 3 code is produced when align.inInterpolation = true #3113

Closed
Atry opened this issue Feb 6, 2022 · 1 comment · Fixed by #3115
Closed

Illegal Scala 3 code is produced when align.inInterpolation = true #3113

Atry opened this issue Feb 6, 2022 · 1 comment · Fixed by #3115

Comments

@Atry
Copy link

Atry commented Feb 6, 2022

  • Version: 3.4.2
  • Integration: VSCode & Metals
  • Configuration:
runner.dialect = scala3
version = "3.4.2"
maxColumn = 80
align.inInterpolation = true

Steps

Given code like this:

val s = raw"""
          ${
            if true then
              println()
              "1"
            else
              "2"
          }
          ${if false then "3" else "4"}
        """

When I run scalafmt from Format Document command in VSCode:

Problem

Scalafmt formats code like this:

val s = raw"""
          ${if true then
               println()
               "1"
             else "2"}
          ${if false then "3" else "4"}
        """

and the following compile error is raised by the Scala 3 compiler:

end of statement expected but 'else' found

Expectation

I would like the formatted output to compile

@kitbellew
Copy link
Collaborator

looks like scala 3 must use a different newlines.inInterpolation setting. i can add a check and use oneline instead.

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.

2 participants