How can the plugin run on multiple platforms? Use platform-specific APIs at the same time.
For example, I used PsiMethod on idea, but how can I configure it to run on pycharm?
How can the plugin run on multiple platforms? Use platform-specific APIs at the same time.
For example, I used PsiMethod on idea, but how can I configure it to run on pycharm?
You need to use optional plugin XML descriptors for different plugins/IDEs
<depends
optional="true"
config-file="myPluginId-for-Java.xml">com.intellij.java</depends>
I know this, but how to configure it in the kts script? If I want to run PY, then there can’t be a “com.intellij.java” dependency. I want my plugin to call platform-specific APIs.
intellij {
version.set("2024.1")
type.set("IC") // Target IDE Platform
plugins.set(
listOf(
"com.intellij.java",
"properties",
"org.jetbrains.plugins.yaml",
"Kotlin",
"com.intellij.gradle"
)
)
}
I think when the plugin runs on idea, I can use apis such as JavaShortNamesCache, and when it runs on pycharm, I can use apis such as PyFunctionNameIndex
If platform specific code can’t be placed in classes with extension point implementation (instantiating in those platform specific xmls), then I use next trick:
Create factory/proxy through which all such calls happened. And in that factory use reflection to check availability of corresponding platform specific class. If available then invoke/instantiate class with usage of those platform specific code.