go-langserver icon indicating copy to clipboard operation
go-langserver copied to clipboard

completion doesn't work with go master

Open OneOfOne opened this issue 6 years ago • 9 comments

https://github.com/nsf/gocode/issues/510

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

OneOfOne avatar May 01 '18 21:05 OneOfOne

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

keegancsmith avatar May 03 '18 08:05 keegancsmith

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 https://github.com/golang/go/issues/4719#issuecomment-341861487), 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!

Contextualist avatar May 05 '18 07:05 Contextualist

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.

keegancsmith avatar May 08 '18 08:05 keegancsmith

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?

Contextualist avatar May 08 '18 12:05 Contextualist

@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 https://github.com/sourcegraph/go-langserver/pull/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.

anjmao avatar Aug 11 '18 17:08 anjmao

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.

keegancsmith avatar Aug 13 '18 13:08 keegancsmith

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

Go 1.11 is officially out.

OneOfOne avatar Aug 27 '18 11:08 OneOfOne

@OneOfOne Hi, I'm working on https://github.com/sourcegraph/go-langserver/pull/305. I was on vocation for few weeks, but now I'm continue on this.

anjmao avatar Aug 28 '18 06:08 anjmao

Is this still an issue?

alindeman avatar Sep 29 '18 22:09 alindeman