List<LanguageDefinition> (ConvertContext context) { Project project = context.getProject(); Collection<PsiClass> allLanguages = CachedValuesManager.getManager(project).getCachedValue(project, () -> { GlobalSearchScope projectProductionScope = GlobalSearchScopesCore.projectProductionScope(project); GlobalSearchScope librariesScope = ProjectScope.getLibrariesScope(project); GlobalSearchScope allScope = projectProductionScope.union(librariesScope); // force finding inside IDEA project first PsiClass languageClass = JavaPsiFacade.getInstance(project).findClass(Language.class.getName(), projectProductionScope); if (languageClass == null) { languageClass = JavaPsiFacade.getInstance(project).findClass(Language.class.getName(), librariesScope); } if (languageClass == null) { return Result.create(Collections.emptyList(), UastModificationTracker.getInstance(project)); } Collection<PsiClass> allInheritors = new HashSet<>(ClassInheritorsSearch.search(languageClass, allScope, true).findAll()); return Result.create(allInheritors, UastModificationTracker.getInstance(project)); }); if (allLanguages.isEmpty()) { return new SmartList<>(); } GlobalSearchScope projectProductionScope = GlobalSearchScopesCore.projectProductionScope(project); GlobalSearchScope librariesScope = ProjectScope.getLibrariesScope(project); GlobalSearchScope allScope = projectProductionScope.union(librariesScope); List<LanguageDefinition> libraryDefinitions = collectLibraryLanguages(context, allScope); Collection<PsiClass> projectLanguages = ContainerUtil.filter(allLanguages, aClass -> PsiSearchScopeUtil.isInScope(projectProductionScope, aClass)); List<LanguageDefinition> projectDefinitions = mapToProjectDefinitions(projectLanguages, libraryDefinitions); List<LanguageDefinition> all = new ArrayList<>(libraryDefinitions); all.addAll(projectDefinitions); return all; }