koin icon indicating copy to clipboard operation
koin copied to clipboard

Koin Extended DSL (3.2) Import Bug

Open Morons opened this issue 3 years ago • 1 comments

Android Studio Dolphin | 2021.3.1 Beta 5
Build #AI-213.7172.25.2113.8774922, built on June 28, 2022
Runtime version: 11.0.14.1+1-b1751.46 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Registry:
    external.system.auto.import.disabled=true
    debugger.watches.in.variables=false
    ide.text.editor.with.preview.show.floating.toolbar=false
    ide.instant.shutdown=false
    ide.balloon.shadow.size=0

I like the new DSL 3.2 BUT

  1. If you type singleOf(::ClassA) or any other, the Import of ClassA does not happen! you have to either import it by hand OR use the classic DSL single (ClassA())to get the import first then convert it!!

Morons avatar Jul 24 '22 07:07 Morons

The import does not work because you're starting with the :: part first, which tells the IDE that you do not want imports after the operator. The solution is to write the class name first (skipping the scope resolution operator), accept the suggested import, then go back one word and insert the :: part.

Nek-12 avatar Jul 28 '22 04:07 Nek-12