-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Fix broken module resolution after large/rapid edits in nodenext #46818
Conversation
A question now is whether to remove the field copying from the incremental parser. These should be redundant for all our own uses, but it’s possible someone could use the incremental parser standalone. Doing it there is valid, but copying those kinds of fields is not generally the job of the incremental parser 🤷 |
cd1a1ef
to
151497f
Compare
@weswigham thanks for the review—any opinion on whether the incremental parser should still copy that field? I’m fairly happy to err on the side of leaving it there, as I don’t think it’s hurting anything. |
The incremental parser copies/reparses things like the comment directive list onto the new source file - I think it's fine for it to also copy the |
So is it wrong to do it in |
I don't think there's a right or wrong place - this field has some pretty unique requirements among |
…rosoft#46818) * Fix broken module resolution after edits in nodenext * Move field copying to a better place I guess
Fixes #46396
When updating a SourceFile, the incremental parser copies the old SourceFile’s
impliedNodeFormat
to the new one. Reusing module resolution from the old Program later expects that field to already be set on the updated SourceFile. However, the incremental parser is skipped when the language service gets overwhelmed by changes—specifically, when there are 8 or more changes logged against the snapshot before the language service asks for an updated SourceFile, or when the length of a text change is greater than 256 characters. In these cases, the SourceFile is re-parsed from scratch, and so it lacks itsimpliedNodeFormat
field.