diff --git a/internal/lsp/source/format.go b/internal/lsp/source/format.go index d8efad05de..e1c2c5ed73 100644 --- a/internal/lsp/source/format.go +++ b/internal/lsp/source/format.go @@ -80,10 +80,7 @@ func AllImportsFixes(ctx context.Context, snapshot Snapshot, fh FileHandle) (all ctx, done := trace.StartSpan(ctx, "source.AllImportsFixes") defer done() - _, pgh, err := getParsedFile(ctx, snapshot, fh, NarrowestPackageHandle) - if err != nil { - return nil, nil, errors.Errorf("getting file for AllImportsFixes: %v", err) - } + pgh := snapshot.View().Session().Cache().ParseGoHandle(fh, ParseFull) err = snapshot.View().RunProcessEnvFunc(ctx, func(opts *imports.Options) error { allFixEdits, editsPerFix, err = computeImportEdits(ctx, snapshot.View(), pgh, opts) return err