kotlin-guides icon indicating copy to clipboard operation
kotlin-guides copied to clipboard

Evaluate providing IntelliJ code style configuration

Open JakeWharton opened this issue 8 years ago • 4 comments

Perhaps as a plugin so that it's constantly updating?

JakeWharton avatar Oct 20 '17 13:10 JakeWharton

If there's interest in this (before we get an auto-updating plugin) I'd be happy to get the base config file up. (it might not have every rule, I'll have to double check what will be supported by default in the code style setup, and if there's any custom intellij code that needs to be written for specific rules.)

I would also be down to write the plugin, but not sure where to host the file.

Could bundle the xml file with the plugin version, but that seems weird.

scottroemeschke avatar Nov 02 '17 17:11 scottroemeschke

@scottmeschke myself and @twbarber at Rocket Travel would love to an importable IntelliJ style rule set based on the Android Kotlin style guide (https://android.github.io/kotlin-guides/style.html), if this is something we could help with please reach out to us!

willbuck avatar Dec 01 '17 16:12 willbuck

For what it's worth, ktlint --android --apply-to-idea link (--android flag here enables Android Kotlin Style Guide compatibility) aims to provide this.

Not everything described in the https://android.github.io/kotlin-guides/style.html can be configured through Intellij Code Style / Inspections settings but the things that don't are enforced by the ktlint itself (unfortunately not all rules from the style guide are implemented (yet) but we are getting there).

shyiko avatar Dec 01 '17 17:12 shyiko

The latest Kotlin plugin now has a Set from -> Predefined Style -> Kotlin style guide option that applies Jetbrains' style guide. Adding another option there would be perfect, but I don't know if there's an API for that...

gustavkarlsson avatar Jan 19 '18 08:01 gustavkarlsson