List<VirtualFile> (@NotNull Project project, @NotNull NewMappings newMappings, @NotNull AbstractVcs vcs) { // same as above, but no compression List<VirtualFile> roots = new ArrayList<>(newMappings.getMappingsAsFilesUnderVcs(vcs)); Collection<VirtualFile> modules = DefaultVcsRootPolicy.getInstance(project).getDefaultVcsRoots(); Collection<VirtualFile> modulesUnderVcs = ContainerUtil.filter(modules, file -> { if (!file.isDirectory()) return false; NewMappings.MappedRoot root = newMappings.getMappedRootFor(file); return root != null && vcs.equals(root.vcs); }); List<VirtualFile> modulesToAdd = ApplicationManager.getApplication().runReadAction((Computable<List<VirtualFile>>)() -> { final FileIndexFacade facade = FileIndexFacade.getInstance(project); return ContainerUtil.filter(modulesUnderVcs, module -> ContainerUtil.or(roots, root -> facade.isValidAncestor(root, module))); }); return new ArrayList<>(ContainerUtil.union(roots, modulesToAdd)); }