Fix references after unrelated project edits (#64497) - #64550
Open
Shulamit sharabani (SHULMIT) wants to merge 1 commit into
Open
Shulamit sharabani (SHULMIT) wants to merge 1 commit into
Shulamit sharabani (SHULMIT) wants to merge 1 commit into
Conversation
Copilot started reviewing on behalf of
Shulamit sharabani (SHULMIT)
September 30, 2026 00:44
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new project load repeats across expansion passes, causing redundant full snapshot rebuilds.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Fixes stale cross-project references after unrelated edits unload a configured project.
Changes:
- Loads the source definition’s configured project before reference expansion.
- Adds an LSP regression test for edit, restore, and close scenarios.
| File | Description |
|---|---|
tsc/internal/ls/crossproject.go |
Loads missing definition projects during cross-project searches. |
tsc/internal/lsp/server_references_updates_test.go |
Covers reference stability across unrelated edits. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+247
to
+248
| if defaultLs.GetProgram().Options().ConfigFilePath == "" && !tspath.IsDeclarationFileName(defaultDefinition.TextDocumentURI().FileName()) { | ||
| if _, errProjects := orchestrator.GetProjectsForFile(ctx, defaultDefinition.TextDocumentURI()); errProjects != nil { |
This branch has not been deployed
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.

Opening a file in an unrelated configured project can unload the configured project containing a source definition. A references request from an inferred project then searches only the loaded projects, so a request on
fromloses references that a fresh server returns.Load the source definition's project before expanding a search from an inferred project, excluding declaration files to preserve declaration-map behavior.
Add an LSP regression covering the fresh-session result, an unrelated unsaved edit, and restoring and closing that file.
Fixes #64497.
Validation:
go -C tsc test ./... -skip='/fanotify-no-rename$'.The unfiltered watcher tests encounter
name_to_handle_at: operation not supportedfor thefanotify-no-renamebackend on this filesystem. Only that unsupported backend variant was excluded from the full Go run; the supported watcher variants pass.AI assistance: OpenAI Codex authored the fix and regression test and ran the validation.