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

Android studio code formatter issue over ktlint #410

Closed
manishgithub1173 opened this issue May 1, 2019 · 3 comments
Closed

Android studio code formatter issue over ktlint #410

manishgithub1173 opened this issue May 1, 2019 · 3 comments

Comments

@manishgithub1173
Copy link

I recently integrated ktlint (v0.30.0) in my project. Things looks fine until i used android studio code formatter also. Using shortcut (cmd+option+L) in mac, it reformats the code again related to continuation indentation inside methods. Running ktlint on the formatted code did not give me the error and that was strange. Looks like continuation indentation of 4 and 8, both are correct as per ktlint. But ideally that should NOT be the case. Somehow continuation indentation inside methods is not working as expected for me.
My editorconfig file looks like this:
[*.{kt,kts}]
indent_size=4
insert_final_newline=true
max_line_length=off

While In android studio settings:
Tab size : 4
Indent : 4
Continuation Indent : 8

I don't want to use Continuation Indent from android studio settings rather it should use from editorconfig. One more things continuation_indent_size = 4 shows me unknown key error in editorconfig for kotlin files.

@manishgithub1173 manishgithub1173 changed the title Android studio code formatter issue Android studio code formatter issue over ktlint May 1, 2019
@shashachu
Copy link
Contributor

As of ktlint 0.31.0, the formatter doesn't do a separate continuation indent, because it's not in either the Jetbrains nor Google Kotlin style guides. Can you please try the latest version (0.32.0) with the --experimental flag and report back what you find? Note that 0.32.0 moved the package namespace and groupId into com.pinterest.

@AllanWang
Copy link

Isn't this an example of a continuation indent of 8?

https://developer.android.com/kotlin/style-guide#properties

@shashachu
Copy link
Contributor

https://developer.android.com/kotlin/style-guide#properties

I suspect that's a documentation bug; when we spoke to the folks at Google in charge of the styleguide, they said they updated it to not use continuation indents. https://developer.android.com/kotlin/style-guide#indentation

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

No branches or pull requests

3 participants