In java, we can provide additional parsing for the IDE via ShortNameCache and PsiElementFinder, and I noticed that kotlin idea plugin can be called by java in this way through kotlin IDEA plugin.
Now I want to implement additional parsing in Kotlin, for example to let the IDE call a kotlin class that doesn't actually exist (just in memory)：
- In lombok, it is possible to trick the IDE into letting a class have additional methods, such as setXXX/getXXX.
- In Android ViewBinding, the LayoutBinding class is also generated by the layout xml file
But they are both generating java classes, and I want to generate a kotlin class that will be used in kotlin analyzing, but when I try to insert my in-memory generated class through the IDE plugin by PsiElementFinder, the IDE plugin show me the error:
Kotlin light classes should not be found by JavaPsiFacade
I would like to know what is the replacement for the
PsiElementFinder extension point in kotlin?kotlin SyntheticResolveExtension might be an option, but this extension point is difficult to use and unstable. And after taking a general look at the api for SyntheticResolveExtension, I noticed that it can't seem to generate new packages, but Java's PsiElementFinder can. Java plugin's PsiElementFinder is very easy to use. Is there an extension point like java?