I need to use PsiManager but I'm getting the following error in my dependencies

Answered

1:18 μ.μ.    Plugin error
                Plugin ... requires plugin 'com.intellij.modules.java' to be installed

 

These are all my dependencies. The second one seems to have the problem.

However in IntelliJ IDEA works fine when I run the plugin.

The error happens when I install it in my PhpStorm and restart to be enabled

PhPStorm 2021.1.4

 

<depends>com.intellij.modules.lang</depends> <!-- 1st -->
<depends>com.intellij.modules.java</depends> <!-- for psi -->
6 comments
Comment actions Permalink

I just figured out that the issue was that I used com.intellij.modules.java to get list of methods (PsiMethod) which are supported in java only.

 

But how can I give support to multiple IDEs to get list of java/kotlin/python/ruby/ts/es6/js/php classes, functions and/or methods? as seen in Structure tool window. I need names and line positions as well.

 

Here I can see the available dependings that can be used as optional for each ide. But what is the PsiMethod, PsiFunction and PsiClass for each language?

https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html#modules-specific-to-functionality

0
Comment actions Permalink

Hi Alex,

The easiest way to get class names for these elements is to use PsiViewer to inspect a PSI structure for files in languages of your interest. Please see:

https://plugins.jetbrains.com/docs/intellij/explore-api.html#31-use-internal-mode-and-psiviewer

on how to enable it.

Also, take a look at other sections in Part VIII - Product Specific section, eg.:

0
Comment actions Permalink

Thanks again,

but I am very confused.

I have used PSIViewer and I see the classes of each psi element, but I dont understand how to get access to them while I am developing.

For example how do I get access to package containing KtClass ? what library should I import to my plugin,

and how to get access also to


com.jetbrains.php.lang.psi.elements.impl.MethodImpl

class com.intellij.lang.ecmascript6.psi.impl.ES6ClassImpl

class com.intellij.lang.javascript.psi.impl.JSFunctionImpl

com.intellij.lang.javascript.psi.ecma6.impl.TypeScriptFunctionImpl

com.jetbrains.cldr.lang.psi.impl.OCFunctionDefinitionImpl

 

0
Comment actions Permalink

Hi Alex,

Let's do it step by step for PHP then.

  1. See https://plugins.jetbrains.com/docs/intellij/phpstorm.html:
    • The table shows what gradle-intellij-plugin properties should be configured, so you have to include these values in your build.gradle.kts file (if you created your project from the template, you should change proper properties in gradle.properties file):
intellij {
  type = "IU"
  version = "2020.3.4" // can be different version
  plugins = "com.jetbrains.php:203.7148.15" // can be different version
  ...
}
  1. As the last sentence on this page states, declare a dependency on PHP plugin APIs in the plugin.xml file:
<idea-plugin>
... <depends>com.jetbrains.php</depends> ... </idea-plugin>

And that's it, PHP classes will be available in your project.

0
Comment actions Permalink

my plugin is not Gradle-based and is written in java.

Is grandle necessary? because I have never used it before...

0
Comment actions Permalink

Hi Alex,

Gradle is highly recommended for plugin development. Please see:

If you still want to use your approach (I assume it's DevKit), please follow these steps to set up plugin dependencies: https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html#2-project-setup (Notice "DevKit" tab).

1

Please sign in to leave a comment.