Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

No completions for symbols from unimported pkg if there are multiple matches for pkg name #1884

Closed
ramya-rao-a opened this issue Aug 27, 2018 · 5 comments

Comments

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Aug 27, 2018

fmt. gives completions for all the symbols from the fmt package
template. doesn't do the same.

This is because we cannot determine which of the text/template and html/template should be used.

Proposed fix:

  • When encountering template. provide completions for all the matching pkgs
  • Once user chooses the package, the import should be added for that package, and completions should be triggered again.

This is possible to do because we can run commands as part of the completion. But since we can run one 1 command for a completion item, we will have to create a new command that internally runs go.import.add command followed by triggering suggestions again with editor.action.suggest command

@shreyaskarnik
Copy link
Contributor

shreyaskarnik commented Aug 30, 2018

I am interested in working on a fix for this. Can you provide any code pointers to get started?

@ramya-rao-a
Copy link
Contributor Author

https://github.com/Microsoft/vscode-go/blob/0.6.89/src/goSuggest.ts#L415 is where we see that there are more than 1 matches and then decide to not do anything.

@shreyaskarnik
Copy link
Contributor

I was able show all the matching packages in case of template, was wondering how should I proceed to forward if the user selects one of the packages to add it in import path and provide subsequent completions.
image
For multiple matching packages I included the token and the matching packages in parenthesis, in this case would adding command which imports the package be the right thing to do?

@shreyaskarnik
Copy link
Contributor

Looked at references for go.add.imports in the source and was able to add support for this feature.

@ramya-rao-a
Copy link
Contributor Author

The fix for this is in the latest update to this extension (0.6.90)

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants