PsiReferenceProvider that match a method call


I'm new to plugin developement and I'm trying to build a simple (ActionScript) plugin that adds references and safety checks when it encounter something like this :, "triggerName", ClassNameB, "callbackName")

In that case, ClassNameA.triggerName (which should be of type Trigger) will get a new reference and ClassNameB.callbackName (which is a method) will also get a new reference.

The plugin documentation is weak so I'm having a hard time just trying to figure out what I should do. Anyway, from what I could find, it seems that I should extend PsiReferenceContributor and match a part of a PSI tree with PsiElementPattern, a bit like this plugin is doing.

Am I on the right way? If so, can anybody help me understand how I should describe the PsiElementPattern that match the method call above?
1 comment
Comment actions Permalink

Hello Oliver,

your attempt is right. Building the ElementPattern unfortunately is sometimes a bit tricky when you're not proficient with underlying PSI.
I recommend using the builtin PSI Viewer (Tools->View PSI Structure) to learn and understand the structure to match. There's also PSIViewer plugin which offers more information about nodes (

If the position you're targeting for references supports language injection, you can also try bundled IntelliLang plugin to build (basic) pattern as starting point.



Please sign in to leave a comment.