src/main/range-util.js/findNodeAtOffset
function findNodeAtOffset(node, offset, options, predicate, parentNodes = []) {
  if (offset < options.locStart(node) || offset > options.locEnd(node)) {
    return;
  }

  for (const childNode of comments.getSortedChildNodes(node, options)) {
    const childResult = findNodeAtOffset(
      childNode,
      offset,
      options,
      predicate,
      [node, ...parentNodes]
    );
    if (childResult) {
      return childResult;
    }
  }

  if (!predicate || predicate(node)) {
    return {
      node,
      parentNodes,
    };
  }
}