Ktlint: ParametersOnSeparateLinesRule can't be handled by Intellij IDEA

Created on 4 May 2018  路  3Comments  路  Source: pinterest/ktlint

Hello, thanks for your nice job. We are using this project to the check style issue of kotlin on our project.

But there is one thing is not make sense:

1. Effect checkstyle rule for IDEA

I have already run the command ktlint --apply-to-idea-project --android on my project root directory, and see it really effect after I restart my Android Studio

image

2. Format kotlint file by IDEA BUT PROBLEM EXIST

I format the TestDarwinActivity.kt file through Android Studio, but after the format the problem of Parameter should be on a separate line (unless all parameters can fit a single line) is still exist

image

3. Can't find any solution for this problem

I check the kotlint code style setting can't find anywhere to solve this ParametersOnSeparateLinesRule for the IDEA formatter

image


So could you please have any suggestions to handle ParametersOnSeparateLinesRule by the Intellij IDEA


Finally, I think the problem is it allows parameters on one line but it not allowed by ktlint

Most helpful comment

Any chance of providing support for this rule through ktlint -F or IDEA formatter instead doing it mannualy?

All 3 comments

Hey @Jacksgong.

Any chance you can attach TestDarwinActivity.kt?

Normally, Ctrl+Alt+L should do the job. When Intellij built-in formatter is unable to produce expected result you can either ktlint -F (same as ktlint --format) or do it manually with Alt+Enter -> Put parameters on separate lines:

img-2018-05-04-112908

Thank you so much, the way of Alt + Enter to do this job manually is work for me(on Mac is Option + Enter).

Any chance of providing support for this rule through ktlint -F or IDEA formatter instead doing it mannualy?

Was this page helpful?
0 / 5 - 0 ratings