Closed rnikoopour closed 4 years ago
Same thing with company-go here. Do we know the reason for the performance gap between the other, non-mod-compatible, gocode
? Is it caching?
From what I can tell, the packages that this uses to do its work will perform some compilation (when necessary). I notice this when I work on projects that require SQLite support, since there are no native Go packages for them. A few requests in quick succession will cause a whole lot of overhead. Issue #10 talks about caching, which I think will be critical to being able to use gocode
again. As it is now, I have a while loop set up to kill gocode
every 20 seconds, just to be safe.
The way I dealt with this was to use the other gocode
executable when in a package that is not a Go module, and when we are in a Go module to use this one, but disable any automatic requests. So I don't get random freezes, I just have to press a key and wait a bit to explicitly ask for completions.
Could you provide an example of how you set that up? It sounds really useful.
On Tue, May 21, 2019 at 11:13 Chris de Graaf notifications@github.com wrote:
The way I dealt with this was to use the other gocode executable when in a package that is not a Go module, and when we are in a Go module to use this one, but disable any automatic requests. So I don't get random freezes, I just have to press a key and wait a bit to explicitly ask for completions.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stamblerre/gocode/issues/35?email_source=notifications&email_token=AB2WD5MJVSURHXFOMVAKUZTPWQ3V5A5CNFSM4HFBDTF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV4XSRY#issuecomment-494500167, or mute the thread https://github.com/notifications/unsubscribe-auth/AB2WD5OGZMNOXX2LMRFH76LPWQ3V5ANCNFSM4HFBDTFQ .
I have two gocode
binaries in $GOPATH/bin
: gocode
and goode-mod
.
(defun gocode-toggle ()
"Toggle the gocode executable between the mod and non-mod versions."
(interactive)
(customize-set-variable
'company-go-gocode-command
(if (string= company-go-gocode-command "gocode-mod")
"gocode" "gocode-mod"))
;; The gocode fork that works with modules is slow, so disable idle completion.
(if (string= company-go-gocode-command "gocode-mod")
(customize-set-variable 'company-idle-delay nil)
(custom-reevaluate-setting 'company-idle-delay))
(message company-go-gocode-command))
It's not ideal since you have to toggle manually, but it's not annoying enough for me to automate anything :sweat_smile:. It's also specific to Company since that's what I use.
@christopher-dG This is what am doing for go module projects, disable idle completion.
For those out there not using company mode this is how I solved it:
Thanks for the inspiration @christopher-dG
(add-hook 'go-mode-hook
(lambda()
(make-local-variable 'ac-auto-start)
(make-local-variable 'ac-trigger-key)
(setq ac-auto-start nil)
(setq ac-trigger-key "TAB")))
I noticed the same problem with the slowdown which makes it unsable. I noticed that the gocode version in mdempsky/gocode doesn't hang but with that version I am not able to have autocompletion for packages under vendor/ folder of my projects. Could be that the indexing of vendor folder introduces the slowness?
I am using spacemacs and also see this bug. Does anybody have a real solution yet? Would #24 solve as mdempsky/gocode is said to not have this bug?
I switched to gopls
together with lsp-mode
. I can recommend this setup, superior experience so far!
@maxsono I did the same and I am quite happy about the results even if gopls is not perfect yet.
What version of Go are you using (
go version
)?go version go1.11 darwin/amd64
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64" GOBIN="" GOCACHE=
redacted
GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH=redacted
GOPROXY="" GORACE="" GOROOT="/usr/local/go" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/46/637dm0hn3qx7wbw5q87djc_0hrrcxp/T/go-build805034364=/tmp/go-build -gno-record-gcc-switches -fno-common"What is the debug output of
gocode
?N/A
What (client-side) flags are you passing into
gocode
?None
What editor are using?
Emacs for OSX GUI 26.1
issue
gocode
results are provided after the first character typed no matter whatac-auto-start
value is. This causes a small hang while it while its figuring out the autocomplete options. Ideallygocode
should provide results whenac-auto-start
length is reached or when an attempt to expand the current symbol happens.This small makes using
gocode
difficult since almost every new symbol briefly hangsemacs
.