Skip to content

Commit 87b670a

Browse files
Copilotandrewbranch
andcommitted
Port getFixesInfoForNonUMDImport to use new autoimport.View
- Replace getExportInfos() with view.Search() to find exports - Replace getImportFixes() with view.GetFixes() for each export - Use autoimport.Fix.Edits() instead of codeActionForFixWorker for new fixes - Export View.CompareFixes for use in sorting - Keep UMD and type-only promotion using old stack for now (via oldFix field) - Update sortFixInfo to handle both new and old-style fixes Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com>
1 parent 732793f commit 87b670a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

internal/ls/codeactions_importfixes.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ var ImportFixProvider = &CodeFixProvider{
5858
}
5959

6060
type fixInfo struct {
61-
fix *autoimport.Fix
61+
// Use new-style fix when available
62+
fix *autoimport.Fix
63+
// Use old-style fix for features not yet ported (UMD, type-only promotion)
64+
oldFix *ImportFix
6265
symbolName string
6366
errorIdentifierText string
6467
isJsxNamespaceFix bool
@@ -388,8 +391,7 @@ func sortFixInfo(fixes []*fixInfo, fixContext *CodeFixContext, view *autoimport.
388391

389392
// Sort by:
390393
// 1. JSX namespace fixes last
391-
// 2. Fix kind (UseNamespace and AddToExisting preferred)
392-
// 3. Module specifier comparison
394+
// 2. Fix comparison using view.compareFixes (handles fix kind and module specifier comparison)
393395
slices.SortFunc(sorted, func(a, b *fixInfo) int {
394396
// JSX namespace fixes should come last
395397
if cmp := core.CompareBooleans(a.isJsxNamespaceFix, b.isJsxNamespaceFix); cmp != 0 {

0 commit comments

Comments
 (0)