LanguageDefinition (ConvertContext context, Language language, @NotNull GlobalSearchScope scope) { if (language.getID().isEmpty()) { return null; } PsiClass psiClass = DomJavaUtil.findClass(language.getClass().getName(), context.getInvocationElement(), true); if (psiClass == null || !PsiSearchScopeUtil.isInScope(scope, psiClass)) { return null; } return new LanguageDefinition(language.getID(), psiClass, () -> { LanguageFileType type = language.getAssociatedFileType(); return type == null ? null : type.getIcon(); }, () -> language.getDisplayName()); }