List<VirtualFile> (@Nullable VirtualFile ancestor, @NotNull VirtualFile file) { if (ancestor == null || !VfsUtilCore.isAncestor(ancestor, file, true)) return null; ArrayDeque<VirtualFile> deque = new ArrayDeque<>(); while (true) { file = file.getParent(); if (file == null || !VfsUtilCore.isAncestor(ancestor, file, true)) break; deque.addFirst(file); } return deque.isEmpty() ? null : new SmartList<>(deque); }