private @NotNull Collection<VcsRoot> scanDependentRoots(@NotNull Map<VirtualFile, Boolean> scannedDirs,
                                                          @NotNull Collection<VcsRoot> detectedRoots) {
    Set<VcsRoot> result = new HashSet<>();
    for (VcsRoot root : detectedRoots) {
      VcsRootChecker rootChecker = VcsRootChecker.EXTENSION_POINT_NAME.findFirstSafe(checker -> {
        return root.getVcs() != null && Objects.equals(checker.getSupportedVcs(), root.getVcs().getKeyInstanceMethod());
      });
      if (rootChecker == null) continue;

      List<VirtualFile> dependentRoots = rootChecker.suggestDependentRoots(root.getPath());
      for (VirtualFile dependentRoot : dependentRoots) {
        if (scannedDirs.containsKey(dependentRoot)) continue;

        VcsRoot vcsRoot = detectVcsRootBy(dependentRoot, null, rootChecker);
        scannedDirs.put(dependentRoot, vcsRoot != null);

        if (vcsRoot != null) {
          LOG.debug("Found VCS ", vcsRoot.getVcs(), " in ", vcsRoot.getPath(), "dependent on", root);
          result.add(vcsRoot);
        }
      }
    }

    if (!result.isEmpty()) {
      // handle recursive dependencies
      result.addAll(scanDependentRoots(scannedDirs, result));
    }

    return result;
  }
private @NotNull Collection<VcsRoot> scanDependentRoots(@NotNull Map<VirtualFile, Boolean> scannedDirs,
                                                          @NotNull Collection<VcsRoot> detectedRoots)