HierarchyProvider (LanguageExtension<HierarchyProvider> extension, @Nullable PsiElement element, DataContext dataContext) { if (element == null) return null; List<HierarchyProvider> providers = extension.allForLanguage(element.getLanguage()); for (HierarchyProvider provider : providers) { PsiElement target = provider.getTarget(dataContext); if (target != null) { return provider; } } return ContainerUtil.getFirstItem(providers); }