Open ysmood opened 4 years ago
Currently this importable package listing is implemented through gopkgs
and there is an open issue accompanied with a PR by @marwan-at-work to replace gopkgs
with go list
. This feature request is to add another source for importable package listing.
cc
@julieqiu for API provision from go.dev
@stamblerre if gopls
has any plan to support a similar feature
@hyangah seems like go list
doesn't support listing remote modules.
How about we add some typescript to send a request to the go.dev API and fetch the result then append them to the result of go list
?
At the moment, there isn't an API for pkg.go.dev. We do intend to add one, but it's not something we are working on at the moment: golang/go#36785.
Sure, we can leave this issue open, it's just a good to have function. If you ever used npm
, they have this search online function like npm search zip
, the result looks like:
Maybe one day go list
will support that too.
@ysmood let me be clear - We are not questioning the value of this new feature - I agree this is an interesting feature to investigate.
I mentioned gopkgs
and go list
to describe the current state. I brought in @julieqiu and @stamblerre because we need support from pkg.go.dev
, and also we want to discuss where this information querying happens (from the extension side as we do currently, or eventually from gopls so other editors can share the benefit).
And, thank you for the feature request!
I think we should definitely integrate gopls
with the future pkg.go.dev API. In addition to searching for packages to import, we'd also be able to offer unimported completions for packages outside of a user's module cache.
The feature request in gopls
is https://github.com/golang/go/issues/32749.
Currently, it will list locally cached modules. It will be great if it can also start to list remote modules on go.dev while listing the local ones.
We can also provide a separate command like "Search Import" to list go.dev result only.