Collection<PsiFileSystemItem> (@NotNull PsiFileSystemItem file) { VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile != null && FileBasedIndex.getInstance().getFileBeingCurrentlyIndexed() == null) { final FileReferenceHelper[] helpers = FileReferenceHelperRegistrar.getHelpers(); final Collection<PsiFileSystemItem> result = new SmartList<>(); final Project project = file.getProject(); CommonProcessors.CollectProcessor<PsiFileSystemItem> collector = new CommonProcessors.CollectProcessor<>(result); for (FileReferenceHelper helper : helpers) { if (helper.isMine(project, virtualFile)) { if (!result.isEmpty() && helper.isFallback()) { continue; } if (!helper.processContexts(this, virtualFile, false, collector)) { break; } } } if (!result.isEmpty()) { if (!ContainerUtil.exists(result, el -> !(el instanceof FileReferenceResolver))) { result.addAll(getParentDirectoryContext()); } return result .stream() .distinct() .toList(); } return getParentDirectoryContext(); } return emptyList(); }