findContainingTree<T extends OrgNode> method
Find the immediate parent OrgSection or OrgDocument of the specified
node
.
Implementation
OrgTree? findContainingTree<T extends OrgNode>(T node) {
final found = find<T>((n) => identical(node, n));
if (found == null) return null;
final (node: _, path: path) = found;
return path.reversed.firstWhere((node) => node is OrgTree) as OrgTree;
}