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

If block start with a parenthesis after the if, the indentation disappears. #829

Closed
zmunm opened this issue Aug 14, 2020 · 0 comments · Fixed by #832
Closed

If block start with a parenthesis after the if, the indentation disappears. #829

zmunm opened this issue Aug 14, 2020 · 0 comments · Fixed by #832

Comments

@zmunm
Copy link

zmunm commented Aug 14, 2020

Expected Behavior

context: detekt/detekt#2964
Even if written without curly braces, indentation should be preserved

Observed Behavior

If block start with a parenthesis after the if, the indentation disappears.

Steps to Reproduce

Before formatting

if (true)
    (1).toString() 
else
    2.toString()

After formatting

if (true)
(1).toString()  // indentation disappeared
else
    2.toString()

Your Environment

  • Version of ktlint used: 0.37.2
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): standard gradle dsl task from ktlint README
  • Version of Gradle used (if applicable): 5.6.4
@zmunm zmunm changed the title Beginning with parentheses after if, the indentation disappears If you start with a parenthesis after the if, the indentation disappears. Aug 14, 2020
@zmunm zmunm changed the title If you start with a parenthesis after the if, the indentation disappears. If block start with a parenthesis after the if, the indentation disappears. Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants