Any VSCode users? Cannot get Go to play nice..

polaris · · 544 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>New to go and thought I&#39;d give it a try with VSCode as I&#39;m already using this editor for typescript. I included the go plugin, but I&#39;m finding it doesn&#39;t always work for jumping into method definitions, never has syntax highlighting, and is rocky in terms of the intelli-sense not always working.. Was wondering if this is a known thing and if there are fixes or if I should use an entirely different editor for go? :&lt;</p> <p>Update: I turned on the gocodeAutoBuild setting and now it&#39;s working for intelli-sense in other files (I do feel like this gave me problems in the past, slowing things down and interfering with TS autocompletion but this may be necessary?). Any way to turn on syntax highlighting? Seeing pre-compilation errors would help immensely. Also when intelli-sense pops up, I see the suggestion highlighted above, is there a way to tab and autofill that suggested piece in, i.e. anonymous functions?)</p> <p>Update2: I&#39;m finding it extraordinarily slow now and won&#39;t pickup on anything from other packages.</p> <hr/>**评论:**<br/><br/>drailing: <pre><p>Is your workspace set up correctly​ and did vscode download all the extensions? For me everything is working really fine!</p></pre>-proof: <pre><p>I&#39;ve made progress, would you mind taking a look at my update above please?</p></pre>PaluMacil: <pre><p>Go has been a smooth experience for me on VS Code. Is your project in your GOPATH? I&#39;ve never played with code not under my GOPATH, but I could see that being an issue. Also, between updates to Go itself I run &#39;gocode close&#39;. Nobody on my team has heard of syntax highlighting issues but we don&#39;t have Macs. Perhaps it is OS related.</p></pre>-proof: <pre><p>The project is, except the <code>main</code> is outside of it I believe as it&#39;s used for google app engine. This could be an issue. Does yours highlight incorrect code?</p></pre>asyncrep: <pre><p>Didn&#39;t have any of these problems when I configured it (on mac os X sierra)</p></pre>-proof: <pre><p>also on OS X, can you see my update in the header and give me your thoughts? </p></pre>asyncrep: <pre><p>I don&#39;t use gocodeAutoBuild, sorry. I don&#39;t even have go imports turned on because it has a bug with the level of nesting in my microservices.</p></pre>SQLServerIO: <pre><p>I have been using vscode for the last several months and had problems with intelli-sense several releases ago but not in the last couple of months. Method jumping has only been a problem for me if it is outside my code base. It is iffy for includes for me. You can take a look at Gogland from jetbrains too it is in EAP so it is free right now. I&#39;m giving it a go mainly for things like method extraction and the like. I do find it is more sluggish than VSCode and learning a new set of keyboard shortcuts is a PITA. I haven&#39;t made a decision if I will be moving to it permanently yet.</p></pre>-proof: <pre><p>I used IntelliJ with node.js stuff in the past but the sluggishness for a small project really got me nervous. Maybe it&#39;s improved. I do also like using one editor that works for multiple languages; do you switch between IDEs/editors for different pieces of the stack?</p></pre>tristan957: <pre><p>I have the extension installed and it works like a charm</p></pre>-proof: <pre><p>does yours highlight or underline syntactically erroneous code?</p></pre>tristan957: <pre><p>No I haven&#39;t had that experience. But I can&#39;t say I&#39;ve been using it that long</p></pre>ZeroCool2u: <pre><p>After experimenting with both, I&#39;m personally an Atom guy, but for Go in general I just use Jetbrains Go specific IDE. <a href="https://www.jetbrains.com/go/" rel="nofollow">https://www.jetbrains.com/go/</a></p></pre>F41LUR3: <pre><p>That&#39;s strange, I have a very wonderful VSCode experience with Go on both Linux and Windows. I&#39;ve made it my main ide/editor for it (came from Sublime Text).</p> <p>I have gometalinter as my linter suite of choice, all of the various other tools for finding definitions, auto-imports, gofmt, etc. Jumping to definitions works for my own packages, third-party packages, and the stdlib source. Syntax highlighting works as expected, as does intelli-sense/autocomplete.</p> <p>Even visual step-through debugging works wonderfully with the <code>delve</code> go debugger (though there is one issue with the debug process getting leaked in the background when you stop the debugger when working on anything with a listening socket. It will hold the listen port until you kill the debug host process.)</p> <p>Then again, my vscode was installed specifically for use with vscode-go plugin. I don&#39;t use it for typescript or whatever else. Perhaps there might be a conflict? (I doubt it, but, you never know). </p></pre>ChristophBerger: <pre><p>This is really strange, I never experienced any of these problems on my Mac. </p> <p>Do you have the latest version of VSC installed? </p></pre>metamatic: <pre><p>I just installed <a href="https://marketplace.visualstudio.com/items?itemName=lukehoban.Go" rel="nofollow">this</a> and installed the associated tools via <code>go get</code>, and everything worked.</p></pre>

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

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