Annotator for another plugin's language

Erlang support for IntelliJ is supplied by intellij-elixir, but I want my plugin for Elixir, intellij-elixir to be able to annotate Erlang references to Elixir modules as is done for properties in the tutorial, but in the tutorial, the annotator can safely import PsiElements subclasses for Java because Java support is always available.  How do I setup my annotator so it's only loads if intellij-erlang is installed along with my intellij-elixir, which guarentees I won't get class not found errors?

5 comments
Comment actions Permalink

You need to use an optional dependency. Here's an example from my plugin.xml:

<depends optional="true" config-file="copyright.xml">com.intellij.copyright</depends>


Then I have a copyright.xml with the same format as a normal plugin XML, that will only be loaded if the plugin com.intellij.copyright is installed. I use that file to install extensions which rely on classes from that plugin.

0
Comment actions Permalink

How do I determine which namespace to use inside the depends tag?

0
Comment actions Permalink

It's not a namespace, that's the ID of the plugin from the plugin.xml.


0
Comment actions Permalink

Ok, so I'd use `org.jetbrains.erlang` then.  For the Project Structure did you make the jar for the plugin you depend on Compile scope or Provided scope, since the plugin you depend on is provided when the user installs it separately?  (I already figured out I need a copy of the jar available locally for development or imports won't resolve.)

0
Comment actions Permalink

I used Compile, but I have a custom build so that doesn't really have any effect. If you're using Build->Prepare plugin for deployment, you might want to use Provided - I'm not sure.

0

Please sign in to leave a comment.