mirror of
https://github.com/golang/go
synced 2024-11-19 04:24:39 -07:00
f505e54dbd
Packages that aren't imported in the current file will often have been used elsewhere, which means that gopls will have their type information available. Expose loaded packages in the Snapshot, and try to use that information when possible for unimported packages. Change-Id: Icb672618a9f9ec31b9796f0c5da56ed3d2b38aa7 Reviewed-on: https://go-review.googlesource.com/c/tools/+/204824 Run-TryBot: Heschi Kreinick <heschi@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
20 lines
1.0 KiB
Go
20 lines
1.0 KiB
Go
package unimported
|
|
|
|
func _() {
|
|
//@unimported("", bytes, context, cryptoslashrand, time, unsafe, externalpackage)
|
|
// container/ring is extremely unlikely to be imported by anything, so shouldn't have type information.
|
|
ring.Ring //@unimported("Ring", ringring)
|
|
signature.Foo //@unimported("Foo", signaturefoo)
|
|
}
|
|
|
|
// Create markers for unimported std lib packages. Only for use by this test.
|
|
/* bytes */ //@item(bytes, "bytes", "\"bytes\"", "package")
|
|
/* context */ //@item(context, "context", "\"context\"", "package")
|
|
/* rand */ //@item(cryptoslashrand, "rand", "\"crypto/rand\"", "package")
|
|
/* time */ //@item(time, "time", "\"time\"", "package")
|
|
/* unsafe */ //@item(unsafe, "unsafe", "\"unsafe\"", "package")
|
|
/* pkg */ //@item(externalpackage, "pkg", "\"example.com/extramodule/pkg\"", "package")
|
|
|
|
/* ring.Ring */ //@item(ringring, "Ring", "(from \"container/ring\")", "var")
|
|
|
|
/* signature.Foo */ //@item(signaturefoo, "Foo", "func(a string, b int) (c bool) (from \"golang.org/x/tools/internal/lsp/signature\")", "func")
|