0

I'm trying to create a plugin for intellij but am having trouble accessing PsiClass.

When i try to import com.intellij.psi.PsiClass;, it cant resolve the symbol.

The solution here doesnt work for me as it refers to build.gradle but i only have build.gradle.kts in my plugin project.

Also adding <depends>com.intellij.modules.java</depends> to the plugin.xml file gives a cannot resolve error.

Anyone know how to fix this?

ImHamba
  • 1
  • 2
  • https://stackoverflow.com/questions/72568509/how-can-i-apply-a-plugin-to-itself-using-kotlin-dsl might help. – seenukarthi Mar 31 '23 at 06:03
  • I'd recommend you raise this issue at https://intellij-support.jetbrains.com/hc/en-us/community/topics/200366979-IntelliJ-IDEA-Open-API-and-Plugin-Development to discuss it with the IDEA team directly – Egor Klepikov Mar 31 '23 at 09:02

1 Answers1

0

In build.gradle.kts, under the intellij{} block, add "java" to the plugins.set(listOf(/* Plugin Dependencies */)).

Mine looks like this:

// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
    version.set("2022.1.4")
    type.set("IC") // Target IDE Platform

    plugins.set(listOf(/* Plugin Dependencies */"java"))
}

Also in plugin.xml, under the default <depends>com.intellij.modules.platform</depends> line, add another line <depends>com.intellij.java</depends>.

I already had these lines added but they didnt work, but after reopening the project a few hours later it worked, so perhaps rebuilding the project will fix the issue after adding these lines.

ImHamba
  • 1
  • 2