-
Notifications
You must be signed in to change notification settings - Fork 12.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ts.createSourceFile trims leading newlines, causing stored line numbers to mismatch #58517
Comments
TS obviously preserves the line information enough to e.g. give you correct line numbers on the commandline when showing errors. Can you clarify which API you're calling and how? |
Not sure this is a meaningful test, reproducing what is shown in a larger case is always difficult. I will dig more into this tomorrow and ensure the problem is not elsewhere. Anyway, given
and
then running
outputs
which includes trailing newlines but not leading ones. |
Use |
Ok, so now that I am aware of |
This issue has been marked as "Question" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
π Search Terms
createSourceFile newlines trim
π Version & Regression Information
β― Playground Link
No response
π» Code
π Actual behavior
Given this TSX file, React tooling will store a source reference on the
<span>
element as e.g.and it will contain
However, if you feed the TSX file into
ts.createSourceFile
and look for an element on line 7, you will not find anything because the file has been changed toand it only has 5 lines
π Expected behavior
ts.createSourceFile does no transformations whatsoever on the given input
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: