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

completion doesn't work with go master #268

Open
OneOfOne opened this issue May 1, 2018 · 9 comments
Open

completion doesn't work with go master #268

OneOfOne opened this issue May 1, 2018 · 9 comments

Comments

@OneOfOne
Copy link
Contributor

OneOfOne commented May 1, 2018

nsf/gocode#510

Maybe switch to https://github.com/mdempsky/gocode? the speed difference is minimal but it won't break every other Go release.

@keegancsmith
Copy link
Member

Thanks for the link. I see the gocode README now suggests the switch, so this makes sense to me.

@Contextualist
Copy link
Contributor

Currently mdempsky/gocode comes with two modes:

  1. Parsing source file without cache
  2. Parsing binary (.a files) with cache

I tried integrating it in go-langserver and quickly tested each mode. There is no perceivable difference on speed for the binary mode, but the source mode is unbearably slow (takes few seconds on my MacBook Air).

Since the Go team is working towards deprecating the $GOPATH/pkg cache (see golang/go#4719 (comment)), we should definitely switch to an implementation that parses source code. Currently, I suggest that we switch to mdempsky/gocode and expose the source/binary mode option to users. Finally we might deprecate the binary mode when the source mode has a cached solution.

mdempsky/gocode refactors the original gocode, making the core functions modular and easy to follow, so it is easy to switch to it. Really appreciate Dempsky's work!

@keegancsmith
Copy link
Member

Yeah that makes sense to me. A PR for what you have done sounds GTM. It may make sense to use a fork of mdempsky/gocode which we pull in via dep. That way it will be easy to track upstream, vs what the copy + modified versions in this repo.

@Contextualist
Copy link
Contributor

I don't have time to work on the PR until next Tue. So for anyone interested please help implementing that.

After a while I found out that I was not using cache at all when testing, but the performance for parsing binary file without cache seems adequate. mdempsky/gocode has its cache coupling with its main package, and the author suggested me to utilize the unified cache in go-langserver. That's a fair advice, but if I mistake not, our loader cache is slow. How should I deal with the completion cache?

@anjmao
Copy link
Contributor

anjmao commented Aug 11, 2018

@Contextualist Hi,
I could help you to work on integrating mdempsky/gocode. My plans was to copy only needed mdempsky/gocode into go-langserver and use global go-langserver cache for better performance. I made PR #305 which adds new gocode. It is working locally, but I need to test it more (performance, caching, unit tests). I'm also planning to implement unimported packages autocomplete inside gocode.

@keegancsmith
Copy link
Member

My plans was to copy only needed mdempsky/gocode into go-langserver

I think we should switch to using a fork (or trying to get it being a library upstream), so that we can more easily integrate updates to upstream gocode in the future.

@OneOfOne
Copy link
Contributor Author

I hate to be that guy, but bump. anyone?

Go 1.11 is officially out.

@anjmao
Copy link
Contributor

anjmao commented Aug 28, 2018

@OneOfOne Hi, I'm working on #305. I was on vocation for few weeks, but now I'm continue on this.

@alindeman
Copy link

Is this still an issue?

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

5 participants