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

Off-by-one error in maxColumn #976

Closed
alexnixon opened this Issue Jun 16, 2017 · 1 comment

Comments

3 participants
@alexnixon

alexnixon commented Jun 16, 2017

This template is a guideline, not a strict requirement.

  • Version: 1.0.0-RC3
  • Integration: IntelliJ
  • Configuration:
align = true
maxColumn = 80

Firstly - I've just started using scalafmt and it seems like a fantastic tool. Thanks!

Given maxColumn = 80 I would expect scalafmt to allow a character in the 80th column. However scalafmt reformats

object Wat {
  val a = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}

as

object Wat {
  val a =
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}

Despite the line not exceeding 80 characters in length. It's particularly noticeable when you have Intellij's margin marker enabled which shows your code as being within bounds:

image

olafurpg added a commit to olafurpg/scalafmt that referenced this issue Jun 17, 2017

Fix off-by-one error, #976.
Interestingly, this had not been pointed out before.
@olafurpg

This comment has been minimized.

Show comment
Hide comment
@olafurpg

olafurpg Jun 17, 2017

Member

Thank you for reporting! You are correct, I've opened #982 changing it so that scalafmt allows a character on the n-th column.

Member

olafurpg commented Jun 17, 2017

Thank you for reporting! You are correct, I've opened #982 changing it so that scalafmt allows a character on the n-th column.

olafurpg added a commit to olafurpg/scalafmt that referenced this issue Jun 18, 2017

pjrt added a commit that referenced this issue Jun 18, 2017

Merge pull request #982 from olafurpg/976
Fix off-by-one error, #976.

@pjrt pjrt closed this Jun 30, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment