Apply disableReferencedProjectLoad to getOriginalLocationEnsuringConfiguredProject #44836
+1,841
−4
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.
disableReferencedProjectLoadwas intended to prevent project loading during find-all-references (FAR), as an escape valve for teams with very large solutions. However, there's a case it doesn't cover - when the declaration is actually in another project but was pulled into the open project by project reference redirects, the "default" configured project containing the declaring file will be loaded, possibly causing a long delay or an OOM crash.Note that, while we don't want to load the declaring project, we do want to search it if it's already open.
There's also a weird corner case where
disableSourceOfProjectReferenceRedirectis enabled, but a .d.ts.map file exists, which causes the .ts file from the referenced project to be discovered anyway. When this happens, we use the .ts file if it's in some open project and the .d.ts file (which is definitely in an open project, or we wouldn't have found it) otherwise.