Recommended way to handle imports (Java/Kotlin) when adding an annotation to a class from a quick fix
已回答
If a plugin adds an annotation to a Java/Kotlin class or method in a quick fix, is it recommended that it also adds the import for the annotation type? Or should the user use the "Import class" quick fix as a separate step?
Both are possible, but I'm wondering what the recommended or preferred way is.
请先登录再写评论。
It should add all required imports and other "setup code" automatically usually. Code should always be in compilable state, unless it clearly requires user input/steps. See com.intellij.codeInsight.intention.AddAnnotationPsiFix as reference.