LiteIDE no autocomplete

老子叫甜甜 提交于 2019-12-07 13:35:07

问题


I'm trying to use LiteIDE (the Go IDE) on Linux 32-bit. Everything works except for autocomplete. Builds, running, everything works. The gocode binary seems to be running tho:

ithisa@miyasa ~> ps aux | grep gocode
ithisa   10003  0.0  0.0 823788  2624 pts/1    Sl+  09:06   0:00 /home/ithisa/scratch/liteide/bin/gocode -s -sock unix -addr localhost:37373

What might I be doing wrong?


回答1:


You may need to set a GOROOT=. To set it within LiteIDE, look for the environment toolbar; it should be a a dropdown, probably with "system" preselected, and a button. Click the button to bring up the Edit Environment pane, then double-click "system.env", or whichever environment was picked in the dropdown.

Change the line that starts GOROOT= to point to your 'go' directory. Plain old $HOME/go is a common setting if you installed it from golang.org, and if you don't know where it is, running go env will show the GOROOT that the Go toolchain itself is using. And of course if the line is commented out (#GOROOT=...) remove the #. Save.

If the toolbar is missing entirely, View -> Environment toolbar unhides it.

It's probably also worth setting GOROOT and related settings in your .bashrc, so tools started from the command line see it. I installed Go and LiteIDE in my homedir and my workspace is ~/gocode, so mine is like:

export PATH="$HOME/go/bin:$HOME/liteide/bin:$PATH"
export GOROOT=$HOME/go
export GOPATH=$HOME/gocode

I can't be certain this is actually your issue, but if I unset my GOROOT the symptom matches what you're seeing: completion works on my code, but not on the standard library. Good luck!




回答2:


Did you install gocode?

https://github.com/nsf/gocode

Also, does nothing autocomplete or just new packages? Packages need to be installed to autocomplete. Do you have a standard install setup?

Your GOROOT and GOPATH should also be correctly setup.




回答3:


I've got the exact same problem, except for 64-bit linux (ArchLinux)

I got this solved by:

set up correct GOROOT and GOPATH, for example:

$ cat ~/.bashrc | grep GO
export GOROOT=/usr/lib/go
export GOPATH=~/goroot
PATH="$PATH:$GOPATH/bin"
bash

installing/starting gocode daemon

$ go get -u github.com/nsf/gocode
$ gocode -addr=:37373
$ gocode status

set correct GOROOT on LiteIDE config file:

sudo vim /usr/share/liteide/liteenv/linux64.env
GOROOT=/usr/lib/go



回答4:


For me gocode (autocomplete) broke in LiteIDE after updating Go to the latest version.

What I did was make sure GOPATH was set correct. Then install gocode:

go get -u github.com/nsf/gocode

Then remove the gocode version from the liteide/bin/ folder, because else LiteIDE will use its own version (I only renamed it just in case).

Now when you boot LiteIDE it should say

GolangCode: Found gocode at <YOUR GOPATH>/bin/gocode

instead of LiteIDE using its own version.



来源:https://stackoverflow.com/questions/19876902/liteide-no-autocomplete

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!