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

Use/document gocode "autobuild" to fix missing code completion. #110

Closed
klauspost opened this issue Nov 27, 2015 · 8 comments
Closed

Use/document gocode "autobuild" to fix missing code completion. #110

klauspost opened this issue Nov 27, 2015 · 8 comments

Comments

@klauspost
Copy link

It seems like gocode uses binaries of installed packages go install <package>, which makes code completion unable to locate the package if only the source of the package is installed.

To remedy this gocode has the autobuild=true option, which will automatically build any "missing" packages.

vscode-go should either mention this setting in the documentation, ie. execute gocode set autobuild true, or enable it automatically. The only downside from enabling it automatically is that a console window shows up briefly when a package is used the first time.

@lukehoban
Copy link
Member

@klauspost Could you give a pointer to a codebase I could try to repro the problem?

@klauspost
Copy link
Author

If you rename the $GOPATH\pkg folder it should happen.

@lukehoban
Copy link
Member

I just tried turning this on, and when I work in the Delve codebase, completion lists start taking several seconds to show up. I think that makes this a non-starter as the default setting.

I could add a note in the README, but given the slowdown not sure it makes sense to encourage folks to turn this on.

Also, won't the user still see errors from compile-on-save if they haven't built the dependencies? I'm still a bit unclear on what the real-world setup looks like where this is a problem that just adding 'autobuild true' fixes in a meaningful way.

@klauspost
Copy link
Author

I just tried turning this on, and when I work in the Delve codebase, completion lists start taking several seconds to show up.

It should only be a once-per-package. The standard go get <package> will not compile the .a files for the autocomplete.

Also, won't the user still see errors from compile-on-save if they haven't built the dependencies?

All the go tools just compiles what isn't installed on the fly, so ordinarily you don't notice it, compilation just takes a fraction of a second longer.

But you can test it out. It works ok for me, except for the very annoying console window that pops up and grabs focus. That is why I left the final decision to you :)

@klauspost
Copy link
Author

It also seems to behave "stupid" when you edit a test file in the same folder, but with a different package name than the package.

This will make it "rebuild" on almost every keystroke. It seems like adding a FAQ entry is the safest way to go for now. Maybe this will be better after the potential rewrite gocode seems to need.

@ironcladlou
Copy link
Contributor

The current vscode-go actually uses autobuild=true by default, and the setting is now configurable (#283). Can this issue be closed?

@ironcladlou
Copy link
Contributor

Although I still question whether using the default of true is a good idea- perhaps some docs would be warranted.

@alienth
Copy link

alienth commented Apr 26, 2016

The autobuild=true option is considered experimental by the gocode author. Doesn't seem like there will be any improvement on that feature. The author desires to rebuild gocode for several reasons, and one of them is to read source files for completion reasons. Seems like they doesn't have the time to address this at the moment: nsf/gocode#307

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 24, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants