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

Formatter never satisfied with raw string indentation #682

Closed
artnc opened this issue Jan 7, 2020 · 3 comments · Fixed by #767
Closed

Formatter never satisfied with raw string indentation #682

artnc opened this issue Jan 7, 2020 · 3 comments · Fixed by #767
Assignees
Labels
Milestone

Comments

@artnc
Copy link
Contributor

artnc commented Jan 7, 2020

Source code

val y = 5
val x =
  """
    $y
  """.trimIndent()

Expected behavior

ktlint --experimental --format is a no-op after at most one invocation.

Actual behavior

ktlint always adds 6 additional space characters in front of $y, i.e. running ktlint n times will prepend 6*n spaces to $y.

@Tapchicoma Tapchicoma added the bug label Jan 8, 2020
@goodhoko
Copy link
Contributor

I can confirm this bug.

I tried to disable the rule for the whole file by putting

/* ktlint-disable experimental:indent */

at the start of the file where I use raw strings since the IndentationRule docs state

"all or nothing" (currently, rule can only be disabled for an entire file)

But no luck. Ktlint still complains. How can I disable this rule for a file then? .)

@jzbrooks
Copy link

jzbrooks commented Jun 3, 2020

It seems this bug made it into non-experimental mode as part of 0.37.0. We use raw strings often and it inhibits our ability to upgrade.

@shashachu
Copy link
Contributor

Thanks. We're targeting a 0.37.1 release ASAP to fix this and possibly 1 or 2 more bugs in 0.37.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants