public static @NotNull GlobalSearchScope scopeWithLibraryIfNeeded(@NotNull Project project,
                                                                    @NotNull ProjectFileIndex fileIndex,
                                                                    @NotNull GlobalSearchScope baseScope,
                                                                    @NotNull PsiElement element) {
    VirtualFile file = PsiUtilCore.getVirtualFile(element);
    if (file == null || !fileIndex.isInLibrary(file)) return baseScope;
    return baseScope.uniteWith(ProjectScope.getLibrariesScope(project));
  }
public static @NotNull GlobalSearchScope scopeWithLibraryIfNeeded(@NotNull Project project,
                                                                    @NotNull ProjectFileIndex fileIndex,
                                                                    @NotNull GlobalSearchScope baseScope,
                                                                    @NotNull PsiElement element)