Set<GroovyFile> (UsageInfo @NotNull [] usages) { Set<GroovyFile> files = new HashSet<>(); for (UsageInfo usage : usages) { if (usage.isNonCodeUsage) continue; PsiFile file = usage.getFile(); if (file instanceof GroovyFile && ReadAction.compute(() -> file.isValid()) && file.isPhysical()) { files.add((GroovyFile)file); } } return files; }