Skip to content

Make auto-import fix ranking a consistent order - #65117

Merged
Jake Bailey (jakebailey) merged 2 commits into
microsoft:mainfrom
jakebailey:fix-auto-import-sort
Nov 3, 2026
Merged

Jake Bailey (jakebailey) merged 2 commits into
microsoft:mainfrom
jakebailey:fix-auto-import-sort

Conversation

@jakebailey

Copy link
Copy Markdown
Member

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.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Nov 3, 2026
@jakebailey
Jake Bailey (jakebailey) added this pull request to the merge queue Nov 3, 2026
Merged via the queue into microsoft:main with commit 042e0fb Nov 3, 2026
34 checks passed
@jakebailey
Jake Bailey (jakebailey) deleted the fix-auto-import-sort branch November 3, 2026 00:52
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants