dsherret / ts-morph

TypeScript Compiler API wrapper for static analysis and programmatic code changes.
https://ts-morph.com
MIT License
5k stars 195 forks source link

.getFullStartLineNumber() ? #1531

Open noqcks opened 6 months ago

noqcks commented 6 months ago

I can get a code block and surrounding comments context with .getFullText() (line numbers added by me for this example)

3 
4 // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'high... Remove this comment to see the full error message
5 import hljs from 'highlight.js/lib/core'

when I do .getStartLineNumber() I get back 5. Is there any way to get the start line of the full surrounding context i.e 3 in this case?

using .getStartLineNumber(true) still results in 5