List<PsiFile> () { List<PsiFile> roots = new ArrayList<>(); for (Language language : getLanguages()) { PsiFile psi = getPsi(language); if (psi != null) roots.add(psi); } PsiFile base = getPsi(getBaseLanguage()); if (!roots.isEmpty() && roots.get(0) != base) { roots.remove(base); roots.add(0, base); } return roots; }