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

Indented if condition is incorrectly unindented #3204

Closed
Katrix opened this issue May 3, 2022 · 2 comments · Fixed by #3206
Closed

Indented if condition is incorrectly unindented #3204

Katrix opened this issue May 3, 2022 · 2 comments · Fixed by #3206

Comments

@Katrix
Copy link

Katrix commented May 3, 2022

Configuration (required)

version = "3.5.2"
runner.dialect = scala3

NB: before submitting, please confirm that the problem is observed in the
latest published version of the formatter! We don't publish hotfixes for older
versions, and the problem you have observed in an older version may have already
been fixed.

Command-line parameters (required)

When I run scalafmt via CLI like this: scalafmt -i

Steps

Given code like this:

if
  val x = 4  
  4 == 3
then 5 
else 4

Problem

Scalafmt formats code like this:

if
val x = 4  
4 == 3
then 5 
else 4

Expectation

I would like the formatted output to look like this:

if
  val x = 4  
  4 == 3
then 5 
else 4

Workaround

Disable scalafmt for the if condition with comments

@kitbellew
Copy link
Collaborator

@tgodzik is this a parser issue?

@dos65
Copy link
Member

dos65 commented May 4, 2022

@kitbellew this code is parsed correctly. Looks like an issue with scalafmt

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