gradle / kotlin-dsl-samples

Samples builds using the Gradle Kotlin DSL
https://gradle.org/kotlin/
Other
3.71k stars 434 forks source link

IntelliJ "deimport" does not work #1282

Closed StefMa closed 5 years ago

StefMa commented 5 years ago

When using the Kotlin DSL we have to import some classes. The import works "on the fly" in IntelliJ. When you type a class and press "Enter" the class will be imported and can be used. Unfortunately when we remove the class and press "optimize imports" the classes will not be "unimported" (or deleted from the imports). They will stay there and we have to manually remove it.

I added this to the Kotlin DSL tracker because you don't have to import classes in the Groovy DSL. But you can import via Groovy. But I'm too lazy to test it with it 🙃

That is probably an IntelliJ issue and has to move to the Jetbrains issue tracker. Can someone please confirm this? :)

Expected Behavior

When I press "Optimize Imports" unused imports should be removed.

Current Behavior

Nothing happen with unused imports when I press "Optimize Imports"

Context

N/A

Steps to Reproduce (for bugs)

Import the following 👇

import org.gradle.internal.impldep.com.amazonaws.PredefinedClientConfigurations

Press CMD + O or go to Code -> Optimize Imports.

Your Environment

IntelliJ IDEA 2018.2.7 (Community Edition) Build #IC-182.5107.41, built on November 26, 2018 JRE: 1.8.0_152-release-1248-b22 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.14.1

Gradle 4.10.2

eskatos commented 5 years ago

Thanks for the report @StefMa Closing as duplicate of https://github.com/gradle/kotlin-dsl/issues/372 Note that resolution of the upstream KT issue this is targeted at Kotlin 1.3.20