boolean (@NotNull PsiFile file, @NotNull String name) { PsiUtilCore.ensureValid(file); if (file.getVirtualFile() == null || DumbService.isDumb(file.getProject())) { return StringUtil.contains(file.getViewProvider().getContents(), name); } // TODO: direct forward index access is not used right now since IdIndex shared index doesn't have forward index GlobalSearchScope fileScope = GlobalSearchScope.fileScope(file); IdIndexEntry key = new IdIndexEntry(name, true); return !FileBasedIndex.getInstance().getContainingFiles(IdIndex.NAME, key, fileScope).isEmpty(); }