leafNodeAt static method
Gets the deepest leaf node containing the specified offset
root Document root node
offset Source character offset
Returns the deepest matching node, or null if the offset is not within any node's range.
Implementation
static LatexNode? leafNodeAt(LatexNode root, int offset) {
final path = nodePathAt(root, offset);
return path.isNotEmpty ? path.last : null;
}