java.lang.NoClassDefFoundError: com/intellij/codeInsight/CodeInsightUtil when using plugin in PyCharm

A user of my "R Language support" plugin pointed out (https://github.com/holgerbrandl/r4intellij/issues/80) that the plugin reports a NCDFE when loading `com/intellij/codeInsight/CodeInsightUtil` inPyCharm Professional 2017.1.1. I'm just using using the method `com.intellij.codeInsight.CodeInsightUtil#findElementInRange` so maybe there is an alternative I could use instead.

Is the complete package `com.intellij.codeInsight` missing in pycharm or just `CodeInsightUtil`?

Is there a way to flag class usages in IDEA that will be inaccessible in non IDEA products (like PyCharm)?

Or do I need to declare more dependencies in my plugin.xml? At the moment I just declare:

<depends>com.intellij.modules.lang</depends>
<depends>com.intellij.modules.xdebugger</depends>


Best,
Holger

2 comments

CodeInsightUtil is part of Java support so it is available only in IntelliJ IDEA. If you look at the sources of the method you'll see that it delegates to CodeInsightUtilCore and passes JAVA language as a parameter. So you just need to call CodeInsightUtilCore directly an pass instance of your language. CodeInsightUtilCore is part of IntelliJ Platform and it's available inside any IDE.

If you want to check that your plugin is really compatible with PyCharm you can install it locally use alternativeIdePath parameter in intellij-gradle-plugin (see README.md for details). Unfortunately currently we don't have a more convenient way to do this.

 

0

Thanks Nikolay. Especially the gradle hint to test different products was really helpful.

0

Please sign in to leave a comment.