x/tools/gopls: reuse named imports from other packages in the current module #44510
Labels
FeatureRequest
gopls/imports
gopls
Issues related to the Go language server, gopls.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
Take the following dummy module with two simple Go files:
If I open both Go files with vim+govim+gopls and save, I would expect
bar.go
to gainimport strs "strings"
, mimicking the other package in the same module. This works fine if both files are in the same package, but not if they are in different packages.Assuming that gopls already collects information about all packages in the current main module, I think it should also be able to pick up named imports from other packages to try to be more helpful when adding imports.
In particular, this came up while writing tests in a new package with
import qt "github.com/frankban/quicktest"
.cc @heschik @stamblerre @myitcv @danp
The text was updated successfully, but these errors were encountered: