Hi, I have an issue with auto adding imports, whic...
# intellij
t
Hi, I have an issue with auto adding imports, which is really annoying. It automatically adds import and prefix variables it in the rest of file, for example: When I have a code:
Copy code
class (
 val email:String
) {

fun doSomething() {
   print(email)
}
Then I decide not to define property
email
in constructor and remove
val
, IDEA automatically change all occurrences of
email
like this:
Copy code
import kotlinx.html.InputType

class (email:String) {
   fun doSomething() {
      print(InputType.email)
   }
}
I am facing it in lot of similar cases, usually related to enums. I have option `Editor->General->Auto Import->Add unambiguous imports on the fly`disabled.
I am using IDEA Ultimate
Copy code
Build #IU-213.5744.223, built on November 27, 2021
a
This is normal behavior I think, as
email
won't exist in your context when removing property, intellij will search something to import to fix this
t
I think it used to work better. When I have a big project with lot of libraries I have a big chance that a word I used can be found as a value of some enum type in some lib. For example KMongo has this enum with lot of values: https://github.com/Litote/kmongo/blob/master/kmongo-shared/src/main/kotlin/org/litote/kmongo/MongoOperator.kt and IDEA always fixing it and add it as import... Whenever I write
Copy code
year
a IDEA automatically fix it to
Copy code
MongoOperator.year
a
Probably it is https://youtrack.jetbrains.com/issue/KTIJ-19800, please disable Ktor IDE plugin
t
@Alexey Belkov [JB] Thank you. That's it. I resolved it by disabling
Languages & Frameworks | Ktor | Add imports for Ktor modules automatically
👍 1
a
Aha, that will probably work too.