Go autocompletion with Atom and go-plus

xuanbao · · 1397 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>The autocompletion works wonderfully for the standard library and the package I&#39;m currently working in, but fails when I import custom packages. Has anyone discovered a way to get the autocompletion working with custom packages? I have a tags file (generated by gotags) in the corresponding custom package.</p> <hr/>**评论:**<br/><br/>mgutz: <pre><p>My guess is it uses gocode for autocompletion. I experience the same problems in Vim now and then, usually with sub packages that I&#39;ve modified.</p> <p>You can run gocode in server mode from the terminal</p> <p><code>gocode -s -debug</code> </p> <p>before you start your editor. Gocode will log when it tries to make suggestions including when it can&#39;t. Usually, you need to recompile a (sub) package manually if autocompletion isn&#39;t working. I suggest deleting the built package in <code>$GOPATH/pkg/&lt;architecture&gt;...</code> sub directory as well.</p></pre>Crossi36: <pre><p>Recompiling the package did it for me. Thank you very much!</p></pre>-Nii-: <pre><p>Gocode uses <code>.a</code> files for code completion. Issue where this was mentioned is found <a href="https://github.com/nsf/gocode/issues/296">here</a>.</p> <blockquote> <p>When it comes to imported packages, gocode doesn&#39;t look into their source code at all. It only uses .a files, which are compiled packages.</p> </blockquote></pre>bkeroack: <pre><p>You have to <code>go get</code> the package first.</p></pre>joefitzgerald: <pre><p>go-plus author here. As others have mentioned, gocode is used for autocompletion. You should first make sure you have run <code>go get -u &lt;package name here&gt;</code>. If the package you are getting requires a build step (because it is not go get compatible), perform that step.</p> <p>Then, if you&#39;re still having problems (particularly with code you are writing yourself that is in separate packages), you might want to check your gocode settings (run <code>gocode set</code>). In particular, you want to make sure you have autobuild set to true (<code>gocode set autobuild true</code>).</p> <p>Let me know if there is anything else I can do to help.</p></pre>Crossi36: <pre><p>Recompiling the package did it for me. </p> <blockquote> <p>if you&#39;re still having problems</p> </blockquote> <p>I just checked the gocode option <code>autobuild</code>, which is set to <code>false</code>. Should I set that preemptively to <code>true</code> even though I don&#39;t have problems anymore at the moment?</p></pre>joefitzgerald: <pre><p>In general, yes, you want autobuild set to true.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1397 次点击  
加入收藏 微博
1 回复  |  直到
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传