Plugin verifier fails with 'com.intellij.psi.impl.*' classes not found in all IDEs expect IntelliJIdea
Answered
Hi!
I have an issue with plugin verification results after I added code inline completions to my AI plugin. I started using classes from `com.intellij.psi.*` and plugin verifier is not happy about that in all IDEs except for Intellij Idea.
Funny fact that when I install this version of plugin in Webshtorm manually from disk, I don't get any runtime errors like ClassNotFOund.
More context:
errors:
Missing dependencies:
module com.intellij.modules.java: Plugins declaring module 'com.intellij.modules.java' are not found in JetBrains Marketplace https://plugins.jetbrains.com (used for plugin dependencies)
Compatibility problems (15):
#Access to unresolved class com.intellij.psi.impl.source.PsiClassReferenceType
#Access to unresolved class com.intellij.psi.PsiTypeElement
#Access to unresolved class com.intellij.psi.util.PsiTypesUtil
#Access to unresolved class com.intellij.psi.PsiMethodCallExpression
#Access to unresolved class com.intellij.psi.PsiClass
#Access to unresolved class com.intellij.psi.PsiMethod
#Access to unresolved class com.intellij.openapi.roots.JdkUtils
#Access to unresolved class com.intellij.psi.PsiType
#Access to unresolved class com.intellij.psi.PsiReferenceExpression
I am using gradle intellij plugin 2.x
my build.gradle.kts:
dependencies {
intellijPlatform {
intellijIdeaCommunity("2024.2.1")
bundledPlugins(listOf("com.intellij.java", "Git4Idea"))
plugin("PythonCore:242.21829.142")
…
}
}
my plugin xml
<depends>com.intellij.modules.platform</depends>
<depends>com.intellij.modules.lang</depends>
<depends optional="true" config-file="plugin-java.xml">com.intellij.java</depends>
<depends optional="true" config-file="plugin-python.xml">com.intellij.modules.python</depends>
<depends optional="true" config-file="plugin-git.xml">Git4Idea</depends>
Please sign in to leave a comment.
Hi,
These classes are for Java code and the only IDEs supporting Java are IntelliJ IDEA Community and Ultimate (and Android Studio).
What is the context of their usage? Are they used in the code only from components (extensions, actions, etc.) defined in plugin-java.xml?
Please never duplicate questions on multiple channels:
https://youtrack.jetbrains.com/issue/MP-6913/Plugin-verifier-fails-with-com.intellij.psi.impl.-classes-not-found-in-all-IDEs-expect-IntelliJIdea
Sorry for duplication
I am developing plugin for AI chat assistance. This code was added in terms of implementing inline-completions feature.
More exactly, it is a context-aware feature for inline completions.
E.g. when I submit code completion request, I want to include some context into it. So I have a ContextAwarenessService which uses `java.psi` to traverse through file for which we submit code completion (if it's a java file) and find context (i.e. some dependencies).
Same I have for Python.
I have this feature currently only for Java and Python code completions. But in future I planned to add Javascript as well.
So basically, this feature will work only for Java files and for Python files. I can even restrict it more to be used only for Java Files from IntelliJ and for python files from PyCharm. Haven't investigated yet how to do that, but should be simple.
However anyway, the problem persists that plugin validator will complain about classes not found.
Can you propose some workaround please?
Basically, yes, I can move the service that uses the `java.psi' classes into a xml config (plugin-java.xml). I have tried that actually, but problem with verifier still persists.
Karol Lewandowski I can share more details, even the code if needed in direct messages (don't want to post it here)