mirror of
https://github.com/golang/go
synced 2024-11-18 19:14:40 -07:00
internal/lsp/source: only add names to imports when necessary
As usual, I forgot to clear out the import spec's name when it matches the import path. Change-Id: I4ddd49b70e0db95fcd30d2968b098327fac39a92 Reviewed-on: https://go-review.googlesource.com/c/tools/+/213222 Run-TryBot: Heschi Kreinick <heschi@google.com> Reviewed-by: Muir Manders <muir@mnd.rs> Reviewed-by: zikaeroh <zikaeroh@gmail.com> Reviewed-by: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
acbc0e3ba1
commit
316d2f2484
@ -646,11 +646,14 @@ func (c *completer) unimportedMembers(id *ast.Ident) error {
|
||||
}
|
||||
// We don't know what this is, so assign it the highest score.
|
||||
score := 0.01 * imports.MaxRelevance
|
||||
c.packageMembers(pkg.GetTypes(), score, &importInfo{
|
||||
imp := &importInfo{
|
||||
importPath: path,
|
||||
name: pkg.GetTypes().Name(),
|
||||
pkg: pkg,
|
||||
})
|
||||
}
|
||||
if imports.ImportPathToAssumedName(path) != pkg.GetTypes().Name() {
|
||||
imp.name = pkg.GetTypes().Name()
|
||||
}
|
||||
c.packageMembers(pkg.GetTypes(), score, imp)
|
||||
if len(c.items) >= unimportedTarget {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user