Skip to content
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

Client side autocompletion #21

Merged
merged 4 commits into from Oct 4, 2016

Conversation

Projects
None yet
3 participants
@kostya-sh
Copy link

commented Oct 4, 2016

Fixes #11

kostya-sh added some commits Oct 4, 2016

gocode: improve error handling/reporting
- use log.Fatal instead of panic
- fail earlier when given an unsupported subcommand
- make "gocode close" fail with error if the server process is not
  running (instead of starting the server and instructing it to finish)
gocode: implement client-side autocompletion
When started with -sock=none gocode client evaluates completion
candidates itself (instead of requesting them from the server process).
gocode: speed up client by disabling GC
Disabling GC speeds up client-side autocompletion (when -sock=none)
~30%.

Thanks @LK4D4 for the idea.
client.go Outdated
}

if *g_sock == "unix" {
_ = os.Remove(addr)

This comment has been minimized.

Copy link
@mdempsky

mdempsky Oct 4, 2016

Owner

I assume "_ =" is to satisfy some linter?

This comment has been minimized.

Copy link
@kostya-sh

kostya-sh Oct 4, 2016

Author

The error here is deliberately ignored. As long as tryStartServer() succeeds we do not care if the file deletion failed.

This comment has been minimized.

Copy link
@mdempsky

mdempsky Oct 4, 2016

Owner

Understood. I'm asking about why it's "_ = os.Remove(addr)" instead of just "os.Remove(addr)".

This comment has been minimized.

Copy link
@kostya-sh
client.go Outdated
"github.com/mdempsky/gocode/gbimporter"
"github.com/mdempsky/gocode/suggest"
)

func doClient() {
// Client is a short-lived program.
// Disable GC to make it faster
debug.SetGCPercent(-1)

This comment has been minimized.

Copy link
@mdempsky

mdempsky Oct 4, 2016

Owner

Hmm, I'm a little iffy on this, but I guess we can try it out.

This comment has been minimized.

Copy link
@kostya-sh

kostya-sh Oct 4, 2016

Author

I am not fan of this myself, but it does speed up autocompletion about 30% (from 38-40ms to 26-28ms on a simple test). This actually makes client side autocompletion faster than server side.

@mdempsky mdempsky merged commit 7a1ec96 into mdempsky:master Oct 4, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@LK4D4

This comment has been minimized.

Copy link

commented Oct 4, 2016

nice, thanks!

@LK4D4 LK4D4 referenced this pull request Oct 4, 2016

Closed

Support for gocode socket #74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.