Ide's incremental compiler support for compiler plugin generated code?

Hi there, I’m recently writing a Kotlin compiler plugin (using Arrow-Meta though) to auto generate some code based on annotations. So far it builds and runs, but the annoying thing is when I call the generated code, intellij doesn’t know its existing and will hint error. I understand ide use incremental compiler which is probably doesn’t have my compiler plugin. What else do I need do to make it work?


arrow-meta team has removed IDEA plugin recently:

Imran Settuba 2021 April 19th 7:36 PM
Hi all,
first of all thanks to all contributions, help and feedback from the community regarding the Arrow Meta Ide. We have decided that we will discontinue our efforts in the Ide and with this PR all API references/ implementation to the Ide are removed.
There is a lot that changed/ is changing both in the Kotlin Ide api, the platform api’s and thus we’re hoping to revisit the IDE api’s once Fir plugin’s are stable.
If you have any questions how to migrate back to the platform API’s we’d be happy to assist and clear any questions.

As a result, the only reliable solution at the moment is to write separate IDEA plugin by your own.

You can also :

  • Wait for Stable FIR API (my guess - 1-2 years) and then rewrite your plugin
  • Wait for Stable FIR API and then wait for Arrow-meta IDE support
  • Don’t wait and start prototyping right now with current API (no docs, highly unstable).

If everything goes according to plan, FIR plugins will work in the IDE too.
As far as i know, FIR plugins are ideal for cases where you need to generate new code that should be visible to user (or even change existing code).

1 Like

Thanks wdoker. Just to confirm, if I start prototyping right now with FIR, it’s supposed to work in IDE, is it correct? Is there any sample code/test how to write a FIR plugin?

1 Like

I would not count on FIR IDE support right now, it is at a very early stage

1 Like