-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autocompletions unavailable for local packages #2018
Comments
If I Looks like it could be related to #1853. Looks like nsf/gocode had an option for autobuilding that doesn't exist in mdempsly/gocode. From the comments in that thread, it sounds like the propose source option is exactly what I want here, not sure why it's not working. let g:go_gocode_propose_source = 1 Sounds like vscode-go got around this with a default So my short term workaround is: autocmd BufWritePost *.go silent! GoBuild -i Will also experiment with using an older version of Go with nsf/gocode. |
You found the right issue that explains the behavior you've noticed, and your work around is the right thing for you to do. As for why the propose source option isn't working for you: it's possible that you're unintentionally using nsf instead of mdempsky; the last time I looked some other plugins still install and use nsf. Even though you've found the right workaround, I'll leave this open for now as a reminder that an option to build on write is a feature to consider. PRs welcome. |
Thanks @bhcleek! I'm pretty new to Go and learning a lot on the way. If the propose source option is disabled by default and mdempsky (understandably) doesn't support autobuild, doesn't that mean that—by default—all Seems like build-on-write would be a less surprising default, especially as more people start to upgrade to the versions of Let me know if it makes sense and I'll send a PR for a build-on-write option. Can disable it by default and see if this issue gets more attention from others running into the same thing. |
Installing on write comes with some unacceptable tradeoffs IMO:
Ideally, one could just |
Not sure why I thought it was off by default. 🤦♂️ |
Also managed to get things working correctly by reverting to nsf/gocode and downgrading the minor version of go.
|
Just going to share this here mdempsky/gocode#67 I raised an issue because I am having trouble with vim-go + gocode since moving to go1.11. I have been sent back to vim-go now 😂 and this issue seems related and maybe the context will help. |
@GeorgeMac I can't duplicate that problem you're seeing at all. I noticed that the video you posted, though, used a type local to the package, but the example you posted after running |
I will try a local type and get back to you 👍 |
Also running into this issue, and happy to contribute debug cycles if anyone wants to coordinate. Not testing packages, so definitely as described, with the same autocmd workaround fixing it. Confirm local gopath completion only. |
@flowchartsman which gocode are you using? (mdempsky and nsf have different options, so Do you have any Can you provide a way to duplicate the problem you're seeing? |
Is there any update here? Since the 1.19 release, the gocode based autocomplete simply does not work. |
@mnarrell vim-go changed to use github.com/mdempsky/gocode in v1.19, and it has slightly different options. To make sure you're using the correct version, please exit vim, and then in your shell run
After that you should be able to run |
closed for lack of feedback |
@danprince I believe your example should be:
This work around seems to work OK for me. Just worried about any caching gocode may do |
What did you do?
Trying to use autocomplete:
go get
✅$GOPATH/src
❌Looks like this is happening because the appropriate package objects under
$GOPATH/pkg
aren't being generated for some reason.If I open the same files within vscode (using the vscode-go plugin, which also uses
$GOPATH/bin/gocode
) it works fine and the$GOPATH/pkg/**/*.a
files are generated.If I switch back into vim at this point, I can use those completions, however, if I update a file outside of the package I have open, then the completions aren't updated.
If I use the
<C-x><C-o>
binding, then the completion works but it's incredibly slow (> 2s each time). It doesn't generate the$GOPATH/pkg
files either.I've tried the following completion plugins with no luck:
deoplete
anddeoplete-go
ncm2
andncm2-go
Tried with
let g:go_gocode_propose_source = 1
but same problem.Configuration (MUST fill this out):
vim-go version: 620e8ac
vimrc
you used to reproduce::version
):go version
):go env
):The text was updated successfully, but these errors were encountered: