public GlobalSearchScope doPatchResolveScope(@NotNull GroovyFile file, @NotNull GlobalSearchScope baseScope) {
    final Module module = ModuleUtilCore.findModuleForPsiElement(file);

    if (module == null) {
      return baseScope;
    }

    Project project = module.getProject();
    GlobalSearchScope result = baseScope;

    CachedValuesManager cachedValuesManager = CachedValuesManager.getManager(file.getProject());
    Boolean hasGroovyModuleLib = cachedValuesManager.getCachedValue(
      file.getProject(), () -> CachedValueProvider.Result.createSingleDependency(
        hasModuleWithGroovyLibrary(project), ProjectRootManagerEx.getInstanceEx(project)));

    if (hasGroovyModuleLib) {
      final Collection<VirtualFile> files = additionalScopeFiles();
      result = result.uniteWith(new NonClasspathDirectoriesScope(files));
    }

    return result;
  }
public GlobalSearchScope doPatchResolveScope(@NotNull GroovyFile file, @NotNull GlobalSearchScope baseScope)