(path: string, position: number)
| 80 | |
| 81 | // tsgo's trace positions are UTF-8 byte offsets rather than UTF-16 indices |
| 82 | const getTextPosition = (path: string, position: number): number => { |
| 83 | if (!isTs7) return position |
| 84 | const text = getSourceFile(path).getFullText() |
| 85 | let utf8 = utf8ByPath.get(path) |
| 86 | if (!utf8) utf8ByPath.set(path, (utf8 = Buffer.from(text))) |
| 87 | return utf8.length === text.length ? |
| 88 | position |
| 89 | : utf8.subarray(0, position).toString().length |
| 90 | } |
| 91 | |
| 92 | const getDescendants = (node: ts.Node): ts.Node[] => |
| 93 | isTs7 ? (getDescendantsTs7(node as never) as never) : getDescendantsTs5(node) |
no test coverage detected