Confused about IntelliJ IDEA/Android Studio integration
See original GitHub issueI have a plain and simple configuration setup. In the root of my AS project I have:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.3.70"
repositories {
google()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0-beta02"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:9.2.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
subprojects {
apply plugin: "org.jlleitschuh.gradle.ktlint"
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: "org.jlleitschuh.gradle.ktlint"
I would love if my project could now have a codestyle set in intelliJ that allows me to cmd + shift + L
to reformat as per the ktlint rules.
Looking at the readme I’m confused:
It says:
IntelliJ Idea Only Plugin Note: This plugin is automatically applied by the main ktlint plugin.
This plugin just adds special tasks that can generate IntelliJ IDEA codestyle rules using ktlint.
Idea plugin simple setup For all gradle versions:
Use the same buildscript logic as above, but with this instead of the above suggested apply line.
apply plugin: “org.jlleitschuh.gradle.ktlint-idea”
-
So it looks like for the IntelliJ plugin, I don’t have to do anything since it’s applied “by the main ktlint”. I’m not sure if this is a gradle plugin or is this an IntelliJ IDEA plugin. If I go to the IntelliJ Plugin marketplace, I don’t see anything about a plugin being installed
-
If “This plugin is automatically applied by the main ktlint plugin.” then why does it say right below to " Use the same buildscript logic as above, but with this instead of the above suggested apply line.
apply plugin: “org.jlleitschuh.gradle.ktlint-idea”"
Appreciate any clarification here or on the readme that get’s me to my goal of cmd + shift + L
to reformat as per the ktlint rules in my project, so that we can share via git in my teams project
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (4 by maintainers)
Top GitHub Comments
@u-ways we moved to ktfmt. It’s based off of googles java formatter and so it inherits any fixes from there, which makes for more frequent releases + a supported intellij plugin was perfect for our team.
@ColtonIdle sorry for a late reply.
Yep currently it is not possible. If linked ticket would be implemented - this should solve your issue.