[Intellij][Plagin][OpenApi] How to Run some file using RunContentManager
Answered
Sorry in advance, I'm newer in Plugin developing. I need to run file from Editor using my Action implementation. I found RunContentManager class, but to execute selectRunContent function, I need to init RunContentDescriptor. How can I do that? Thanks
Please sign in to leave a comment.
Not sure I understand your use case correctly, do you mean this https://plugins.jetbrains.com/docs/intellij/run-configurations.html#creating-a-run-configuration-from-context?
I just need to run kotlin file, which is open in Editor using RunContentManager. How can do that?
Please see https://plugins.jetbrains.com/docs/intellij/execution.html and use
org.jetbrains.kotlin.idea.run.KotlinRunConfigurationType.Companion#getInstancefor default Kotlin runner.Thanks a lot! Could you please also help to investigate how to get exit code?
It is impossible to import org.jetbrains.kotlin.idea.run.KotlinRunConfigurationType. Should I add some imports to my plugin?
To use classes from Kotlin plugin, you must setup a dependency on it as described here https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html