boolean (List<VFileEvent> events, NewVirtualFileSystem fs, VirtualDirectoryImpl dir) { var t = System.nanoTime(); Pair<VirtualFile[], List<String>> snapshot = ReadAction.compute(() -> { VirtualFile[] children = dir.getChildren(); return new Pair<>(children, getNames(children)); }); myVfsTime.addAndGet(System.nanoTime() - t); VirtualFile[] vfsChildren = snapshot.first; List<String> vfsNames = snapshot.second; Map<String, FileAttributes> dirList; t = System.nanoTime(); if (fs instanceof BatchingFileSystem) { Map<String, FileAttributes> rawDirList = ((BatchingFileSystem)fs).listWithAttributes(dir, null); dirList = adjustCaseSensitivity(rawDirList, dir.isCaseSensitive()); } else { dirList = new HashMap<>(); for (String name : fs instanceof LocalFileSystemImpl ? ((LocalFileSystemImpl)fs).listWithCaching(dir) : fs.list(dir)) { dirList.put(name, null); } } myIoTime.addAndGet(System.nanoTime() - t); Set<String> newNames = new HashSet<>(dirList.keySet()); vfsNames.forEach(newNames::remove); Set<String> deletedNames = new HashSet<>(vfsNames); dirList.keySet().forEach(deletedNames::remove); ObjectOpenCustomHashSet<String> actualNames = dir.isCaseSensitive() ? null : (ObjectOpenCustomHashSet<String>)CollectionFactory.createFilePathSet(dirList.keySet(), false); if (LOG.isTraceEnabled()) { LOG.trace("current=" + vfsNames + " +" + newNames + " -" + deletedNames); } List<ChildInfo> newKids = newNames.isEmpty() && deletedNames.isEmpty() ? List.of() : new ArrayList<>(newNames.size()); for (String newName : newNames) { if (VfsUtil.isBadName(newName)) continue; FakeVirtualFile child = new FakeVirtualFile(dir, newName); FileAttributes attributes = getAttributes(fs, dirList, child); if (attributes != null) { newKids.add(childRecord(fs, child, attributes, false)); } } List<Pair<VirtualFile, FileAttributes>> existingMap = new ArrayList<>(vfsChildren.length - deletedNames.size()); for (VirtualFile child : vfsChildren) { if (!deletedNames.contains(child.getName())) { existingMap.add(new Pair<>(child, getAttributes(fs, dirList, child))); } } clearFsCache(fs); checkCancelled(dir); if (isDirectoryChanged(dir, vfsChildren, vfsNames)) { return false; } generateDeleteEvents(events, dir, deletedNames, actualNames, newKids); generateCreateEvents(events, dir, newKids); generateUpdateEvents(events, fs, dir, actualNames, existingMap); checkCancelled(dir); return !isDirectoryChanged(dir, vfsChildren, vfsNames); }