Skip to content
This repository has been archived by the owner on Aug 21, 2022. It is now read-only.

Autocomplete unimported packages #54

Closed
anjmao opened this issue Jan 9, 2019 · 6 comments
Closed

Autocomplete unimported packages #54

anjmao opened this issue Jan 9, 2019 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@anjmao
Copy link

anjmao commented Jan 9, 2019

One of the most needed feature which I missed from using vscode-go without lsp is being able to get autocompletion for unimported packages. Ideally typing fmt. should show autocompletion even if fmt package is not imported and after I select completion item it should add that import. Currently it is possible to get autoimport only if full expression is provided. For example I get import only if I write fmt.Print and hit save.

@saibing saibing self-assigned this Jan 9, 2019
@saibing saibing added the enhancement New feature or request label Jan 9, 2019
@default-anton
Copy link

I'm so lacking this feature 😢
@anjmao it works after saving because goimports imports the fmt package. After the package is imported autocompletion works fine.
It's so sad that vs code is superior to vim in code completion in 2019

@phux
Copy link

phux commented Jan 21, 2019

Try this as a cheap workaround:

inoremap <silent> . .<esc>h:exec "silent GoImport ".expand("<cword>")<cr>la

@saibing
Copy link
Owner

saibing commented Jan 31, 2019

@anjmao @antonkuzmenko @phux

I have implemented this feature on commit 2ab1ae17c

@saibing saibing closed this as completed Jan 31, 2019
@inliquid
Copy link

That's great! Thank you.

@fcying
Copy link

fcying commented Feb 13, 2019

this feature can not support 3rd packages?

@default-anton
Copy link

@saibing this is so 🤑

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants