vscode-go icon indicating copy to clipboard operation
vscode-go copied to clipboard

autocomplete suggestion does not list all matching packages even when they exist

Open baoshanxiong opened this issue 10 months ago • 4 comments

go version: 1.20

Steps to Reproduce:

image

There is a service/gift package and a store/gift package, but vscode automatically prompts only the service/gift package.

baoshanxiong avatar Apr 02 '24 03:04 baoshanxiong

@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

hyangah avatar Apr 02 '24 21:04 hyangah

版本: 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

baoshanxiong avatar Apr 17 '24 02:04 baoshanxiong

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:

Screenshot 2024-05-23 at 4 55 00 PM

But once you've imported one of those packages, the suggestion will only show exports from that package:

Screenshot 2024-05-23 at 4 55 20 PM

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

porterctrlz avatar May 24 '24 00:05 porterctrlz

@hyangah Anything I can do to bump this?

porterctrlz avatar Aug 13 '24 17:08 porterctrlz