Repository navigation
Make auto-import fix ranking a consistent order - #65117
Merged
Jake Bailey (jakebailey) merged 2 commits intoNov 3, 2026
Merged
Conversation
Restricting ranking preferences to pairs of matching module kinds can produce comparison cycles. The resulting order and preferred fixes then depend on the order in which import candidates are discovered.
Jake Bailey (jakebailey)
requested review from
Andrew Branch (andrewbranch)
and
a balanced review from Copilot
November 2, 2026 23:35
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the changes to make auto-import ranking consistent across module kinds.
No open issues 🎉
What changed in this PR
This PR makes language-server auto-import fix ranking consistent across module kinds, avoiding comparison cycles that make preferred fixes depend on candidate discovery order.
Changes:
- Apply Node core module and possible barrel re-export preferences across module kinds.
- Add mixed-module regression tests for Node prefix preferences and barrel export ranking.
| File | Description |
|---|---|
tsc/internal/ls/autoimport/fix.go |
Remove module-kind guards from ranking comparisons. |
tsc/internal/fourslash/tests/importNameCodeFix_uriStyleNodeCoreModules1_test.go |
Test mixed Node core and package imports with different prefix preferences. |
tsc/internal/fourslash/tests/importNameCodeFix_barrelExport_test.go |
Test ranking of ambient, direct relative, and barrel imports together. |
Review effort: Balanced
Jake Bailey (jakebailey)
requested a review
from Daniel Rosenwasser (DanielRosenwasser)
November 3, 2026 00:28
Daniel Rosenwasser (DanielRosenwasser)
approved these changes
Nov 3, 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.
Restricting ranking preferences to pairs of matching module kinds can produce comparison cycles. The resulting order and preferred fixes then depend on the order in which import candidates are discovered.