How to implement "go to to implementation" Follow
I would like to implement something similar to the "go to implementation" action. The idea is to have an icon displayed on the left side of the editor and to go to to a specific class/method when the icon is clicked.
Unfortunately I don't know how this feature is called in IntelliJ :-(
Which classes show I start looking at?
Please sign in to leave a comment.
if you need to provide this icon for Java methods you can use 'overridingMethodsSearch' extension (you can see how it is implemented for standard Java
This will also enable CtrlAltB action for your methods.
For non-java elements you can use 'codeInsight.lineMarkerProvider' extension instead.
"Develop with pleasure!"
Thank you very much for your help. I'll try both approaches.
Sorry for resurrecting such an old thread, but I have the same question. I've managed to get the line marker provider aspect working well, but I also want CTRL+ALT+B to work for "Go To Implementation" in my custom language (I'm loathe to leave the keyboard for the mouse!). Based on what I've read below, it sounds like you can only really do that if you're extending the set of implementations for Java symbols? Is there no way to hook into CTRL+ALT+B for a completely custom (though very Java-like) language? Thanks in advance for any pointers!
You need to provide your query executor for the DefinitionsScopedSearch searcher. See com.intellij.codeInsight.navigation.MethodImplementationsSearch in the CE source code for an example.
Thanks! VERY easy to implement once I knew the right place to look! Much appreciated!
UPDATE: Hmmmmm...so that works great in more recent versions of IDEA, but I'm trying to support IDEA 12.x as well. In fact, I've jumped through some pretty serious hoops so far to do this. It appears that definitionsScopedSearch is a more recent addition. In IDEA 12.x, MethodImplementationsSearch is a QueryExecutor<PsiElement, PsiElement>. Any tips on how I might do this so that I can support both IDEA 12.x and more recent versions? I don't mind having two extensions registered in plugin.xml for the two models, but I just don't know how to register an extension for the older model (or if I even can).
You can still use the old <definitionsSearch> extension point which existed in IntelliJ IDEA 12, but note that it will eventually be removed in a future version of IntelliJ IDEA.
That helps. Thanks again! Yeah, I'm hoping to phase out support for the older version ASAP and remove the handful of workarounds that are required to support it, but for now I have enough users still on IDEA 12.x due to slow corporate upgrade policies that I'm forced to support it.