gotools-sublime icon indicating copy to clipboard operation
gotools-sublime copied to clipboard

improve gocode performance

Open liuhewei opened this issue 8 years ago • 10 comments

Current gocode's auto-complete affects input fluency badly.

Think about to improve it, for example:

  1. keep a gocode process running, rather than open a process for each calling. use gocode's daemon mode?
  2. add a setting for only triggering auto-completion after several punctuation

liuhewei avatar Apr 07 '16 02:04 liuhewei

Ideas before can be implemented:

  1. gocode is daemon by default.
  2. ST doesn't provide the API to get the word separator.

Just simple improvement according to gocode command and on_query_completions' arguments. https://github.com/liuhewei/gotools-sublime/commit/c70de8cb5bd0911090af2a479cd02ee3e9353915

liuhewei avatar Apr 10 '16 06:04 liuhewei

New ways to optimize:

  1. Use golangconfig to optimize the ToolRunner.run: - don't need to search for gocode path everytime. - config PATH to reduce the search: https://github.com/golang/sublime-config/blob/master/docs/user.md
  2. gocode new build arg? go get -u -ldflags -H=windowsgui github.com/nsf/gocode

liuhewei avatar Apr 14 '16 14:04 liuhewei

I've used golangconfig to replace gotools_settings in v1.0.3. Then, the ToolRunner.run needn't search for toolpath everytime, so the performance is great now. I think the issue can be closed.

liuhewei avatar Apr 16 '16 02:04 liuhewei

mdempsky/gocode is an improved fork of the original nsf/gocode , refer to: https://github.com/mdempsky/gocode/commit/e117c263fb7092eedd7cab24f41d90a9d76bd23a

jostyee avatar Jun 03 '16 02:06 jostyee

@liuhewei mdempsky/gocode has implemented client mode, which improves performance significantly https://github.com/mdempsky/gocode/issues/11

jostyee avatar Oct 07 '16 06:10 jostyee

@jostyee Thanks for the information. Is it enough to use mdempsky/gocode instead of nsf/gocode binary file?

liuhewei avatar Oct 07 '16 06:10 liuhewei

I've tried mdempsky/gode, it has really better performance than nsf/gocode. Thanks @jostyee :-)

liuhewei avatar Oct 07 '16 07:10 liuhewei

@liuhewei I've been using this lib for nearly half a year and very satisfied with it. Don't forget to set -sock=none to enable client mode.

jostyee avatar Oct 07 '16 07:10 jostyee

This flag -sock is not compatible with nsf/gocode, am I right? Any way, mdempsky/gocode is fast enough in my environment :)

liuhewei avatar Oct 07 '16 09:10 liuhewei

@liuhewei https://github.com/nsf/gocode/blob/46e8fd2234a86934e3e8496c7405984ff7b18df5/gocode.go#L17 mdempsky/gocode add a none value to this flag.

jostyee avatar Oct 07 '16 16:10 jostyee