Is there any option to generate FIR code to get In...
# compiler
h
Is there any option to generate FIR code to get IntelliJ code completion based on (changes of) resource/ordinary files? Use-case: I have a code generator producing kotlin source code based on a (openapi) file and I want to provide code completion when I change the openapi file. As a workaround, I could create an IntelliJ plugin that runs the code generator (via Gradle) every time on a change.
👀 1
a
While your request is valid. Id like to suggest a tooling based solution. I.e. write Gradle task that generates from openApi spec kotlin code. Then use Intellij FileWatcher https://www.jetbrains.com/help/idea/using-file-watchers.html to trigger this Gradle task every time openapi spec is modified. If Gradle task is written properly it would run as fast as code generation takes.
h
Yeah, that’s my current solution too but the speed really depends on the Gradle setup of the users. While my Gradle task is fast and supports caching, not every user has a Gradle build that is fast to execute (by using build and configuration cache).
âž• 1
m
Same. Calling Gradle from IJ feels OK-ish for small projects but any large project will just take too much configuration time
@hfhbd what about a compiler plugin that takes your OpenAPI file as a
String
input?
mmmm never mind that will probably not detect changes to the input unless there is a Gradle sync or so...
a
Yeah, I understand that Gradle can be a problem here. As alternative I might suggest gradle continuous run. But since you want to share it with other users. Then it is awful UX.
m
I've tried continuous run. This is even worse for large projects because now they end up with 2 daemons using 24GB (or more) heap each 😬