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

ident behavior change when upgrading to 0.46.0 #1510

Closed
vanniktech opened this issue Jun 20, 2022 · 3 comments · Fixed by #1513
Closed

ident behavior change when upgrading to 0.46.0 #1510

vanniktech opened this issue Jun 20, 2022 · 3 comments · Fixed by #1513
Milestone

Comments

@vanniktech
Copy link
Contributor

This is my editorconfig file:

[*.{kt,kts}]
indent_size=2
continuation_indent_size=2

and this is my snippet:

  private val locale: Locale by option(help = "Locale")
    .convert { Locale(it) }
    .default(Locale.getDefault())

When running ktlint with 0.45.2 all is fine. However when running ktlintFormat with 0.46.0, the spacings change:

  private val locale: Locale by option(help = "Locale")
-   .convert { Locale(it) }
+     .convert { Locale(it) }
-   .default(Locale.getDefault())
+     .default(Locale.getDefault())

The continuation ident seems to be changing (from 4 to 6). Is this change wanted? Looking at my editorconfig file, the previous behavior seems to be correct.

@vanniktech
Copy link
Contributor Author

Public repo is here: BeLabs/appstatistics#43

@shashachu
Copy link
Contributor

@vanniktech can you run lint with the --verbose flag to confirm which rule it is that's making that change? Unfortunately a number of rules can affect indentation.

@paul-dingemans
Copy link
Collaborator

It is indeed a regression bug. Output with snippet above in a file called Foo.kt:

src/main/kotlin/Foo.kt:2:1: Unexpected indentation (2) (should be 4) (indent)
src/main/kotlin/Foo.kt:3:1: Unexpected indentation (2) (should be 4) (indent)

@paul-dingemans paul-dingemans added this to the 0.46.1 milestone Jun 20, 2022
paul-dingemans added a commit to paul-dingemans/ktlint that referenced this issue Jun 21, 2022
…laration should not have an extra indentation. This fixes a regression bug introduced by the fix of pinterest#1340.

Closes pinterest#1510
paul-dingemans added a commit that referenced this issue Jun 21, 2022
…laration should not have an extra indentation (#1513)

*  This fixes a regression bug introduced by the fix of #1340.

Closes #1510
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