Delete failed lookup locations#3038
Merged
andrewbranch merged 3 commits intomicrosoft:mainfrom Mar 10, 2026
Merged
Conversation
andrewbranch
commented
Mar 9, 2026
| // this is a simple string prefix check. | ||
| func (p Path) ContainsPath(child Path) bool { | ||
| return ContainsPath(string(p), string(child), ComparePathsOptions{UseCaseSensitiveFileNames: true}) | ||
| return p == child || len(child) > len(p) && strings.HasPrefix(string(child), string(p)) && (p[len(p)-1] == '/' || child[len(p)] == '/') |
Member
Author
There was a problem hiding this comment.
Bit of a drive-by optimization since watch glob building changed to operate over already-normalized tspath.Paths
Contributor
There was a problem hiding this comment.
Pull request overview
Reduces memory use in the language server/project system by removing per-import module-resolution “lookup locations” tracking (failed/affecting locations) and instead relying on the existing compiler-host FS wrapper that already tracks files consulted during program construction.
Changes:
- Remove
FailedLookupLocations/AffectingLocationsplumbing from module resolution results and resolver state. - Simplify project watch/invalidation logic to use the compiler host’s
sourceFS.seenFilestracking instead of stored lookup-location sets. - Update auto-import package entrypoint extraction types and adjust watch-path casing expectations in tests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/tspath/path.go | Optimizes Path.ContainsPath to a prefix-based check for canonicalized Path values. |
| internal/project/watch.go | Reworks resolution-watch glob computation to take a SyncSet[tspath.Path] of seen paths. |
| internal/project/session_test.go | Adjusts watcher glob matching expectation for case-insensitive canonicalized paths. |
| internal/project/session.go | Removes updating/maintaining failed-lookup and affecting-location watches at the session level. |
| internal/project/projectcollectionbuilder.go | Changes invalidation logic to rebuild programs when a changed path was “seen” by the host during program construction. |
| internal/project/project.go | Collapses multiple project watchers into a single programFilesWatch based on sourceFS.seenFiles. |
| internal/module/types.go | Removes LookupLocations from resolved module/type directive results. |
| internal/module/resolver.go | Deletes lookup-location collection machinery; simplifies entrypoints API to return a slice directly. |
| internal/ls/autoimport/registry.go | Updates entrypoint handling to match the resolver API change (slice-of-entrypoints). |
jakebailey
reviewed
Mar 9, 2026
jakebailey
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Failed lookup locations store the module resolution failures for every import, but we never use that granular information—we dedupe at the per-project level in the LSP to form a small set of globs to watch and then match the watch events against the deduped set to invalidate the program. That leaves potentially quite a lot of useless strings in memory. In the LSP, we were already wrapping each program's CompilerHost in a thing that tracks every requested file during construction for file cache management, making failed lookup locations and affecting locations completely superfluous.
This saves 0.8% memory on
tsgo vscode/src/tsconfig.json, but 22% memory in DefinitelyTyped-tools with every workspace package open.