I'm currently writing a template engine that generates classes and compiles those to class files. The engine works fine, but I'm currently stuck with the IntelliJ plugin.
Initially I started with Java as language and used MultiHostInjector to generate the missing pieces for IntelliJ like this:
For Java, this kind of works (References are available, Code completions are shown, Refactoring seems to work most of the time):
This weekend I changed the engine's language from Java to Kotlin on a branch, since Kotlin offers a lot of language features that would make templating a lot less cumbersome than with plain old Java. This is the MultiHostInjecor for Kotlin:
However, here the injection doesn't seem to work that good. References are not recognized and cannot be followed by clicking them. Also, only very broad completions are available:
From the PSI it seems the generated Kotlin is valid, but the References are displayed in red. Maybe that is causing the problem?
Currently I'm a bit stuck and lost and any help would be appreciated.
Also, I'm not at all sure if MultiHostInjector is intended to be used the way I did and if there is a better approach to this problem.
It would be awesome if someone could help pointing me at the right direction here.