Promise<TreePath> (@NotNull TreeVisitor visitor, boolean allowLoading) { var walker = createWalker(visitor, allowLoading); if (allowLoading) { // start visiting on the background thread to ensure that root node is already invalidated background.invokeLater(() -> onValidThread(() -> promiseRootEntry().onSuccess(walker::start).onError(walker::setError))); } else { onValidThread(() -> walker.start(tree.root)); } return walker.promise(); }