GotoDeclarationHandler with multiple targets: How to change the rendering of found targets?
I have implemented a
com.intellij.codeInsight.navigation.actions.GotoDeclarationHandler
and since in Mathematica there is often more than one definition for a function, I'm returning a list of targets. However, the presentation of the list that is given in the "Choose target" box that follows needs to be adjusted.
How can this be done?
Sidenote: When you implement a GotoRelatedProvider you can explicitly return a GotoRelatedItem and adjusting the layout works like a charm.
请先登录再写评论。
You can customize renderer with GotoTargetRendererProvider extension, or check how DefaultPsiElementCellRenderer and if you can provide all the necessary information to it.
Hey Peter,
thanks for your comment. I had already tried this but I don't get a hit on my implementation. I took the time to debug it and it seems the GotoDeclaration action always uses the default renderer in com.intellij.codeInsight.navigation.actions.GotoDeclarationAction line 241:
I checked a bit deeper if somewhere the extension points implemented by plugins are touched but couldn't find it.
Am I missing something obvious?
No, that's an actual confusion in our API. BTW what exactly do you need to customize?
Hi,
I am facing the same issue at the moment, I would like to customise what is rendered here:
There seems to be no way around the following call in `GotoDeclarationAction`:
```
NavigationUtil.getPsiElementPopup(elements, new DefaultPsiElementCellRenderer(), title, processor).showInBestPositionFor(editor);
```
Any advice?
Best,
Sebastian
Sebastian, what do you need to customize and how? DefaultPsiElementCellRenderer might be enough if you supply a presentation with the information you need to display.
I would like to customize the `delivery.yaml` text, so that it provides some additional hint on which `bar` element the reference is pointing in the `delivery.yaml`. Is there a way to do this?
What exactly do you want to display there? Which PsiElement is that?
As an example, the `delivery.yaml` could contain the following:
In the goto popup I currently get:
I would like to display the pipeline id next to the `[delivery.yaml]` so that the user knows to which pipeline the `value` would navigate to.
Which PSI element is it? You can create your own non-physical PSI elements with whatever presentation you like, and make them navigate to the correct offsets in the yaml file.
The `BAR: value` is a YAMLKeyValue. Can you point me to some examples/docs on how could I achieve the feature with non-physical PSI elements?
Unfortunately there are no good examples. We're working on creating a good API for that, but for now, you'd have to extend FakePsiElement, return it from resolve(), and make its getNavigationElement return that YAMLKeyValue. You might also need to make your PsiReference.isReferenceTo return true for both your element and YAMLKeyValue, in order for find usages/rename to work.
Thanks Peter, I think I am able to work this out from here!
Peter Gromov is there some news about it?


I have same issue and i would like to change this popup
to this one
I've added my custom
but it doesn't work at all
@Smokeelow please try resolving to fake PSI elements with custom presentation as described above. That won't help with popup title (I don't think we have an API for that), but should help with its contents.
Peter Gromov i just need to change left/right text and icon, if fake PSI will help me it would be great