Name / description of element not shown in usage dialog when using custom FindUsagesHandler


I have a custom FindUsagesHandler for PsiLiteralExpression elements and a CustomUsageSearcher to find the usages.

Everything works fine but in the place where usually the description of the element is shown the space is empty:


It doesn't look like there's code in the FindUsagesHandler for this. How do I get a proper description to show up?


What is your callback to Processor<? super Usage> processor in com.intellij.find.findUsages.CustomUsageSearcher#processElementUsages implementation?

if (referencedElement.getLanguage() != JavaLanguage.INSTANCE) {
        final UsageDataProvider dataProvider = ReadAction.compute(referencedElement::getProject).getService(UsageDataProvider.class);
        final Map<CustomerProject, Collection<String>> referencesForPsiElement = dataProvider.getReferencesForPsiElement(referencedElement);
        for (Map.Entry<CustomerProject, Collection<String>> entry : referencesForPsiElement.entrySet()) {
            for (String fileName : entry.getValue()) {
                processor.process(new ReferenceUsage(referencedElement, entry.getKey().getName(), fileName));




please clarify, what is


Please try wrapping:

processor.process(new com.intellij.usages.UsageInfo2UsageAdapter(new ReferenceUsage(...) );


ReferenceUsage doesn't extend UsageInfo. Extending it would clash with UsageInFile. I can give it a try though.


Hi Yann Cebron,

that doesn't work for me. I'd have to extend UsageInfo but I don't have any PsiElement that represents the usage. The "usage" is actually an external file. The whole system around UsageInfo and the adapter seems to assume that I have PsiElements as usages.

This also seems to cause which prevents all usages from being shown when I provide one of my usages.

An additional problem is that now my usages are shown as project usages while before they were (correctly) only shown in "All places".



Thanks for the update.

I'm afraid it seems I mixed up my previous answers, they probably have nothing to do with your original question about the "searched element" node (not the results nodes).

Please try providing custom ElementDescriptionProvider as described in last paragraph on this page for the searched PsiLiteralExpression:


Thanks for the quick response. That worked great!

For future reference: I had to check the type of the ElementDescriptionLocation. If it's UsageViewTypeLocation it's the type shown (in the screenshot "Expression"). Otherwise it may be UsageViewLongNameLocation, UsageViewShortNameLocation or UsageViewNodeTextLocation in which case I return the description of the element for which we searched usages.


Please sign in to leave a comment.