vscode-go
vscode-go copied to clipboard
autocomplete suggestion does not list all matching packages even when they exist
go version: 1.20
Steps to Reproduce:
There is a service/gift package and a store/gift package, but vscode automatically prompts only the service/gift package.
@baoshanxiong thanks for the report. We need more info for investigation.
- Did you already import both packages from this file or other files in the same package?
- Are they in the same module? (xxx-http-go ?)
- Is the module (xxx-http-go) the main module this go file is in?
- If not, how are your workspace and those modules laid out? (go.mod location and directory, file trees)
- Can you collect gopls trace following the instruction https://github.com/golang/vscode-go/wiki/troubleshooting#collect-gopls-information and share with us? Feel free to redact confidential info?
Thanks
版本: 1.88.1 提交: e170252f762678dec6ca2cc69aba1570769a5d39 日期: 2024-04-10T17:43:08.196Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Darwin arm64 23.4.0
At the very least, if you've yet to import a package that shares a name with other packages, vscode-go will correctly suggest all versions:
But once you've imported one of those packages, the suggestion will only show exports from that package:
This makes the autocomplete story very brittle when you happen to have a package name clash, something that would be great to auto-alias if you navigate through and select suggested packages.
This seems related: https://github.com/golang/go/issues/36077
Toy repo here: https://github.com/controlzee/gopls-package-shadow
@hyangah Anything I can do to bump this?