LiteIDE没有自动完成功能。

huangapple go评论99阅读模式
英文:

LiteIDE no autocomplete

问题

我正在尝试在32位Linux上使用LiteIDE(Go IDE)。除了自动完成之外,一切都正常工作。gocode二进制文件似乎正在运行:

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

我可能做错了什么?

英文:

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

得分: 9

你可能需要设置一个 GOROOT。在 LiteIDE 中设置它,找到环境工具栏;它应该是一个下拉菜单,可能预先选择了“system”,并有一个按钮。点击该按钮,会弹出“编辑环境”窗格,然后双击“system.env”,或者选择下拉菜单中选择的其他环境。

将以 GOROOT= 开头的那一行修改为指向你的 'go' 目录。如果你是从 golang.org 安装的,通常设置为 $HOME/go,如果你不知道它在哪里,运行 go env 将显示 Go 工具链本身正在使用的 GOROOT。当然,如果该行被注释掉了(#GOROOT=...),请删除 #。保存。

如果工具栏完全缺失,可以通过“视图”->“环境工具栏”来显示它。

还值得在你的 .bashrc 中设置 GOROOT 和相关设置,这样从命令行启动的工具也能看到它。我在我的主目录中安装了 Go 和 LiteIDE,我的工作空间是 ~/gocode,所以我的设置如下:

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

我不能确定这是否真的是你的问题,但是如果我取消设置 GOROOT,那么你所描述的症状与我的情况相符:代码的自动完成可以工作,但标准库的自动完成不起作用。祝你好运!

英文:

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

得分: 2

你安装了gocode吗?

https://github.com/nsf/gocode

另外,自动完成功能是完全不起作用还是只有新的包不起作用?要安装包才能实现自动完成。你是否有标准的安装设置?

你的GOROOT和GOPATH也应该正确设置。

英文:

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

得分: 2

我遇到了完全相同的问题,只是在64位Linux(ArchLinux)上。

我通过以下方式解决了这个问题:

设置正确的GOROOTGOPATH,例如:

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

安装/启动gocode守护进程

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

在LiteIDE配置文件中设置正确的GOROOT:

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

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

得分: 2

对于我来说,在将Go更新到最新版本后,LiteIDE中的gocode(自动完成)出现了问题。

我所做的是确保GOPATH设置正确。然后安装gocode:

go get -u github.com/nsf/gocode

然后从liteide/bin/文件夹中删除gocode版本,否则LiteIDE将使用自己的版本(我只是为了安全起见将其重命名)。

现在当你启动LiteIDE时,它应该显示:

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

而不是LiteIDE使用自己的版本。

英文:

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.

huangapple
  • 本文由 发表于 2013年11月9日 22:08:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/19876902.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定