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

WRONG_INDENTATION: a newline after ( within an expression should result in the extended indent for the remainder of the expression #1448

Closed
0x6675636b796f75676974687562 opened this issue Jul 13, 2022 · 0 comments · Fixed by #1457, #1470, #1473, #1474 or #1475
Assignees
Labels
bug Something isn't working
Milestone

Comments

@0x6675636b796f75676974687562
Copy link
Member

0x6675636b796f75676974687562 commented Jul 13, 2022

Consider this fragment (extendedIndentForExpressionBodies is off, extendedIndentAfterOperators is on). Note the expressions are wrapped immediately after the opening parenthesis:

val v1 = (
        true)

val v2 = (
        1 + 2)

This is exactly how IDEA with Kotlin style settings applied formats the fragment:

IDEA

For IDEA, the continuation indent is non-configurable and is always on.

diKTat

Expected behaviour

For diKTat, the indent within an expression should depend on the value of extendedIndentAfterOperators.

Actual behaviour

Still, diKTat expects a single indent regardless of extendedIndentAfterOperators. In fact, none of the extendedIndent* flags can change the actual behaviour in this context.

Notes

Environment information

  • diktat version: 1.2.2-SNAPSHOT at a17825a
@0x6675636b796f75676974687562 0x6675636b796f75676974687562 added the bug Something isn't working label Jul 13, 2022
@0x6675636b796f75676974687562 0x6675636b796f75676974687562 added this to the 1.2.2 milestone Jul 13, 2022
@0x6675636b796f75676974687562 0x6675636b796f75676974687562 linked a pull request Jul 21, 2022 that will close this issue
0x6675636b796f75676974687562 added a commit that referenced this issue Jul 21, 2022
0x6675636b796f75676974687562 added a commit that referenced this issue Jul 22, 2022
@0x6675636b796f75676974687562 0x6675636b796f75676974687562 linked a pull request Jul 22, 2022 that will close this issue
0x6675636b796f75676974687562 added a commit that referenced this issue Jul 25, 2022
…unt`

### What's done:

 * `isParenthesisAffectingIndent()` renamed to `getParenthesisIndentationChange()`.
 * The return type changed from `Boolean` to `IndentationAmount`.
 * The value returned by `getParenthesisIndentationChange()` is now stored on
   the "indentation stack" along with the corresponding element types.
 * See #1448.
0x6675636b796f75676974687562 added a commit that referenced this issue Jul 25, 2022
…unt` (#1473)

### What's done:

 * `isParenthesisAffectingIndent()` renamed to `getParenthesisIndentationChange()`.
 * The return type changed from `Boolean` to `IndentationAmount`.
 * The value returned by `getParenthesisIndentationChange()` is now stored on
   the "indentation stack" along with the corresponding element types.
 * This is merely a refactoring, so no user-visible behaviour has been changed.
 * See #1448.
0x6675636b796f75676974687562 added a commit that referenced this issue Jul 25, 2022
### What's done:

 * This is merely a refactoring, so no user-visible behaviour has been changed.
 * See #1448.
0x6675636b796f75676974687562 added a commit that referenced this issue Jul 25, 2022
…le` (#1474)

### What's done:

 * This is merely a refactoring, so no user-visible behaviour has been changed.
 * See #1448.
0x6675636b796f75676974687562 added a commit that referenced this issue Jul 25, 2022
### What's done:

 * The value of the indent is controlled with the `extendedIndentAfterOperators`
   flag.
 * Fixes #1448.
0x6675636b796f75676974687562 added a commit that referenced this issue Jul 25, 2022
#1475)

### What's done:

 * The value of the indent is controlled with the `extendedIndentAfterOperators`
   flag.
 * Fixes #1448.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment