Handle project / program roots in tsserver correctly #58562
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently if file is from "d.ts" or ".ts" of the referenced project as root of the project but the project includes exact opposite of that (input or output respectively) then we have issues with where we incorrectly assume these root names to be part of project . It is obviously incorrect and that results in getting incorrect default project for the file and uses incorrect sourceFIle for the actual file name and incorrect results. Eg in the repro instead of getting results from "index.d.ts" it is gettting results from "index.ts" as it assumes its the same file.
With this fix we always ensure our
rootFilesMap
is holding correct scriptInfo and hence correct default project for output or input of referenced project file.This fixes this issue.
Fixes #56254