References to other PsiFiles/Elements

I asked a while ago about this feature. Is this implemented right now,
or still pending?
I am parsing an custom web language which contains references to java
classes. So it's important that all refactorings are also somehow
delegated to the plugin.

Thanks,
Sven

1 comment
Comment actions Permalink


"Sven Steiniger" <sven.steiniger@gmx.de> wrote in message
news:d6c8gs$ksl$1@is.intellij.net...

I asked a while ago about this feature. Is this implemented right now,
or still pending?
I am parsing an custom web language which contains references to java
classes. So it's important that all refactorings are also somehow
delegated to the plugin.

>

Thanks,
Sven


If you write your own parser, then this is possible to achieve now.
First thing to do is to provide references that resolve to
java elements: say if you have a reference to java class,
then you call psiManager.findClass(fqName, scope) in order to get the
desired class. Then you can of course get
fields/methods/inner classes from it. After this step you have ctrl-B
working.
In order to find usages/refactorings find your references you have to
implement FindUsagesProvider in your language. Make sure that
mayContainReferences() returns true for respective tokens, and caches are
built with those
tokens indexed with IN_FOREIGN_LANGUAGES bit set. That's all basically, if
you have any problems, please
ask further, since this is really a new framework that can have its pitfalls
now:)

Friendly,
Eugene.


0

Please sign in to leave a comment.