Open
Description
Is your feature request related to a problem? Please describe.
I get line & column coordinates from an external source, I want to get the node(s) at this coordinate.
Describe the solution you'd like
The obvious solution would be sourceFile.getChildAtPos
, but this takes a 1D coordinate. I can convert from "pos" to line+col using sourceFile.getLineAndColumnAtPos
(#801) but I can't find anything for the reverse.
Describe alternatives you've considered
I bodged together this:
for (const node of source.getDescendants()) {
if (line === node.getStartLineNumber() && col === node.getStart() - node.getStartLinePos()) {
// We have our node!
}
}
But that doesn't seem like an efficient solution.