<p>Yesterday for the first time ever, I downloaded and installed on my Linux box an actual Microsoft product, i.e. VS Code:</p>
<p><a href="https://code.visualstudio.com/">https://code.visualstudio.com/</a></p>
<p>I installed the Go plugin and was actually amazed at how solid it was. It told me right away I was missing some binaries (e.g. gocode) and integrated with them as soon as I got them installed.</p>
<p>Syntax highlighting works, 'Go to Declaration' works great (takes you directly to the source code, including the SDK classes) and above all code completion using gocode worked out of the box.</p>
<p>I was having nearly all the same features as in the IntelliJ Go plugin, which I used in the past...I can see it being a really good option for Go developers.</p>
<p>Give it a spin.</p>
<hr/>**评论:**<br/><br/>intermernet: <pre><p>The delve debugger integration is also pretty cool :-) Even works on Windows!</p></pre>fungussa: <pre><p>Do you have any tips to get Delve running in VSCode, on Windows? </p>
<p>I've built Delve and am able to debug from the command line. I think the issue may be with the launch.json settings. Did you need to manually configure that?</p></pre>intermernet: <pre><p>I just accepted the defaults for the launch.json file and it seemed to work. You do need to close and reopen the file you're editing to be able to add break-points etc.</p>
<p>Is <code>dlv</code> in your path? Does the Go plugin complain about missing programs?</p>
<p>EDIT:</p>
<p>launch.json:</p>
<pre><code>{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
"port": 2345,
"host": "127.0.0.1",
"program": "${workspaceRoot}",
"env": {},
"args": []
}
]
}
</code></pre>
<p>Output from <code>dlv version</code>:</p>
<pre><code>Delve Debugger
Version: 0.11.0-alpha
Build: f37a26d525902194a6430a0079392512c53beb51
</code></pre></pre>fungussa: <pre><p>Thanks for that! </p>
<p>The key remaining thing, was that I had GOPATH set to c:\go and GOROOT was unset. Then when building the following warning was generated: </p>
<blockquote>
<p>warning: GOPATH set to GOROOT (c:\go) has no effect </p>
</blockquote>
<p>It was only after changing GOPATH to another folder, that debugging started in VSCode.<br/>
I'm stoked, as this is the first time I've used interactive Go debugging!</p></pre>d3sire: <pre><p>Has anyone made a comparison with Sublime with Gosublime? I use sublime + terminal and it works great. How is a start up time on VS code?</p></pre>greeedy: <pre><p>used sublime with gosublime before and now switched to code. It compiles, vets, lints in the background on save. That's really cool. so you don't have to type in 'build' yourself. Other than that it's kind of a taste question, like tabs and overall look and feel</p></pre>beefsack: <pre><p>Startup time isn't amazing but it's better than Atom.</p>
<p>Atom and VS Code are two editors that are functionally amazing but both take needless performance and privacy hits because of stupid design decisions.</p>
<p>Gimme a FOSS editor with that functionality in a compiled language without a web-view and without analytics and I'd be all over it. It'd be the king of all editors.</p></pre>favadi: <pre><p>Vim, emacs? </p></pre>beefsack: <pre><p>I'm a full time Vim user at the moment and have been for the better part of a decade, but I'm longing for a richer interface. Atom hints to how you can do things like linter / compiler messages better when you have more than a terminal.</p></pre>robertmeta: <pre><p>Not a fan of syntastic? <a href="https://github.com/scrooloose/syntastic" rel="nofollow">https://github.com/scrooloose/syntastic</a> ... or of course just using :make and quickfix.</p></pre>Fwippy: <pre><p>There's also neomake, which in neovim is asynchronous. A bit harder to set up, but nice once you get it working.</p></pre>andrevoget: <pre><p>Does anybody know how to "run" the current Go file? In TextMate I can simply press Cmd + R.</p></pre>captncraig: <pre><p>You have to set up commands per workspace. It's kind of a pain.</p></pre>andrevoget: <pre><p>Thank you. I've found a description here: <a href="http://stackoverflow.com/questions/35343143/vs-code-tasks-json-tasks-work-individually-but-not-combined" rel="nofollow">http://stackoverflow.com/questions/35343143/vs-code-tasks-json-tasks-work-individually-but-not-combined</a></p>
<p>Edit: This extension makes it really easy: <a href="https://marketplace.visualstudio.com/items?itemName=mattn.Runner" rel="nofollow">https://marketplace.visualstudio.com/items?itemName=mattn.Runner</a></p></pre>Snavelzalf: <pre><p>I use the Runner plugin, ctrl shift R runs the file</p></pre>DeedleFake: <pre><p>I've been fiddling with Code on and off since it came out. It's pretty nice, and the Go support is pretty good, but I've got the same problem with it that I do with Atom and a bunch of other popular editors: I'm so used to Vim and it's various useful features that using anything else seems awkward. There is a Vim plugin for it, but it's kind of lacking at the moment. A built in terminal emulator would help, too.</p></pre>3Dayo: <pre><p>I was initially happy about the 1.0 release until I ran up against what dissuaded me the last time I gave it a try - the lack of tabs.</p>
<p>There is a lot to love about VS-Code: type hints, auto-complete (works flawlessly), debugging, integrated git!</p>
<p>But I am not productive without tabs, from the github issue raised for this issue, it seems the VSC team thinks tabs are a primarily a navigation issue, but for me its not, its a workspace issue.</p>
<p>I use tabs as interim workspaces for related files (e.g layouts.html, partial.html, layout.css).</p>
<p>tldr: Its a good editor with lots to love, but the lack of tabs is a deal-breaker for me</p></pre>jfurmankiewicz: <pre><p>Hm, I see your point. But all the files are visible in the navigation panel on the right side (i.e. Working files section) and you can keyboard navigate betweeen them in a popup using Ctrl+Tab.</p>
<p>That seemed to work quite fine for me, with more UI screen space left for the actual code.</p></pre>pwn4d: <pre><p>You can also click on the filename that's open which presents the menu that's visible when you Ctrl+Tab.</p>
<p>I still prefer a real tabbed interface myself.</p></pre>3Dayo: <pre><p>Have you tried using Ctrl+Tab with 10+ files open? It quickly became a nuisance for me.
Ctrl+P alleviates the issue somewhat, but as more files get opened and I switch between projects it becomes harder to instinctively remember the name of the file I want which breaks my flow </p></pre>orospakr: <pre><p>It's funny, I'm the exact opposite: I hate tabs on account of them quickly becoming spammy, and also coupling which file you're looking at with what panel of the screen you view it on.</p>
<p>I much prefer the frames & buffers approach taken by Emacs, Vim, and VSCode (and then you use a keyboard hotkey, Ctrl/Cmd-P on VSCode, to switch between buffers in a list ranked by how recently they were exposed). In fact, I have an almost religious dedication to VSCode because it is the only one of the recent "hipster" editors (in the last 10 years) to eschew tabs for my preferred behaviour.</p></pre>3Dayo: <pre><p>I recently switched to Vim (about 5weeks ago) and I love buffers!!! I cant get enough of them, but the thing I love about buffers is the way you can split a window into panes and have buffers in them.</p>
<p>That said I still use tabs, I typically have 20 buffers open spread across 3 tabs. The first tab contains active buffers the second other tabs contain buffers from related sub-projects that the current project depends on (this way if i need to make changes and write tests every thing is in the same tab) the third tab contains documentation or html/templates depending on what kinda project I'm working on.</p>
<p>Edit: I forgot to mention I agree with you on the spam tab problem, its why I love vim and buffers!</p></pre>paddie: <pre><p>Oi, I've never quite used Vim or Emacs, but I'm quite intrigued about this frames and buffer talk. Could you quickly explain the workflow using buffers and frames vs. tabs? I also find tabs to get very spammy, and this might be the solution I'm hoping for..</p></pre>RickAndMorty_forever: <pre><p>DIY man, they expose a JSON file of hotkeys for you. I bound hotkeys on mine to cycle back and forth just like I do in Atom and Sublime. </p></pre>caseynashvegas: <pre><p>I didn't like the lack of tabs at first, but after a while, you figure out it is better. I especially love having up to 3 docs open at once in the same window. </p></pre>seriouslulz: <pre><p>So how does it compare with the IntelliJ plugin? Haven't used that yet. I keep switching back and forth between Atom and VSC for Go.</p></pre>jfurmankiewicz: <pre><p>I think it compares quite favorably. The IntelliJ plugin has a lot of nice features like global / search replace in a project, but for all I know there is an equivalent VS Code plugin that does the same.</p>
<p>For typical coding, especially with the gocode code completion, I think it is just fine.</p>
<p>Definitely a viable option for daily work.</p></pre>grkg8tr: <pre><p>Yup, I believe it uses the 'gorename' binary to find & replace. Not sure if that's done globally.</p></pre>jewishobo: <pre><p>Anyone have a comparison of VS Code Go vs. Atom w/ Go-Plus? I am very curious how they compare feature wise and a general feel of what works better.</p></pre>kkdai: <pre><p>I would also like to know which one (vs code vs atom) has better debugging integration. </p>
<p>Btw. Still don't know how to run 'go build' and 'go run' in vs code. </p></pre>fungussa: <pre><p>You'll need to create a task, which has a configuration similar to:</p>
<pre><code>{
// See http://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "c:\\go\\bin\\go",
"isShellCommand": true,
"args": ["build"],
"showOutput": "always"
}
</code></pre>
<p>More details at: <a href="http://go.microsoft.com/fwlink/?LinkId=733558" rel="nofollow">http://go.microsoft.com/fwlink/?LinkId=733558</a></p>
<p>And <em>File | Preferences | Keyboard Shortcuts</em> shows the default build shortcut is ctrl+shift+b</p></pre>corvinusz: <pre><p>Read carefully </p>
<p><a href="https://code.visualstudio.com/License/" rel="nofollow">https://code.visualstudio.com/License/</a> </p>
<h1>2 DATA. The software may collect information about you and your use of the software, and send that to Microsoft....</h1></pre>kemitche: <pre><p>That section also links to their privacy docs: <a href="https://www.visualstudio.com/en-us/dn948229" rel="nofollow">https://www.visualstudio.com/en-us/dn948229</a></p>
<p>Looks like you can turn usage data off with the <code>telemetry.enableTelemetry</code> setting.</p>
<p>Still worth a careful read, of course.</p></pre>jfurmankiewicz: <pre><p>Hm....missed that.</p>
<p>Looks like it can be disabled though, will do that....</p>
<p><a href="https://code.visualstudio.com/Docs/supporting/FAQ#_how-to-disable-crash-reporting" rel="nofollow">https://code.visualstudio.com/Docs/supporting/FAQ#_how-to-disable-crash-reporting</a></p></pre>beefsack: <pre><p>Unfortunately, this makes it no worse than Atom.</p>
<p>In what world do people think this is acceptable?</p></pre>bketelsen: <pre><p>agreed, this is my backup editor when I can't remember how to do global search & replace in vim (which is always). It works equally well in windows, mac, and linux too -- a real treat.</p></pre>ngrilly: <pre><p>If by "global" you mean search and replace among all project files, it's not yet possible with VSCode:</p>
<p><a href="https://code.visualstudio.com/docs/editor/codebasics#_common-questions">https://code.visualstudio.com/docs/editor/codebasics#_common-questions</a></p>
<p><a href="https://github.com/Microsoft/vscode/issues/1690">https://github.com/Microsoft/vscode/issues/1690</a></p></pre>Arc0re: <pre><p>Sadly not yet. I've been using Code full time since like a week or so, for C and C++ mostly (with their new cpptools plugin, which is kinda buggy) and I've been firing up Emacs every so often just to uppercase a bunch of enum constants or quickly find and replace globally. This kind of stuff should be built in by default in a text editor imo...</p></pre>caseynashvegas: <pre><p>The thing I do not like is that it requires so many tools. All I really want is to be able to have it run go fmt, go build and go run. All the lint and other tools I'd just as soon not have to have in my go path.</p></pre>intermernet: <pre><p>Most of the tools are disable-able (is that a word?).</p>
<p>I haven't tested, and it's not the cleanest solution, but you may be able to disable the tool in the settings and then delete the tool from your go path. I'm not sure if the checker will still complain if the option to use the tool is disabled.</p>
<p>Being an open-source add-on, I assume that this can be fixed, so it may be worth opening an issue @ <a href="https://github.com/Microsoft/vscode-go" rel="nofollow">https://github.com/Microsoft/vscode-go</a> .</p></pre>caseynashvegas: <pre><p>I've manage to disable linting for example, but it still barks if I don't install everything. </p></pre>nhooyr: <pre><p>SDK classes? nonetheless, nice work microsoft.</p></pre>schumacherfm: <pre><p>Maybe I should switch too ... the only reason for switching away from Intellij is that it uses ~1.3GB RAM. How many RAM does VS Code use on avergage?
Edit: fix typo</p></pre>thewhitetulip: <pre><p>on my El Captain, i5 4gm ram, it takes 43mb. yep switch to VSCode and experience the difference, to be fair, the electron shell takes 140MB</p></pre>jfurmankiewicz: <pre><p>I just fired it up and opened up some Go files, seems to be around approx. 150 MB.</p></pre>mullerawer: <pre><p>I too use it. It's fantastic. Even debuggi5is nicely integrated!</p></pre>zippoxer: <pre><p>I like their git integration very much. I was an awful VCS user before it, I hated committing.</p>
<p>I contributed to their Go extension a couple times. One feature I got in is snippet insertion of the function/method you select from the suggestions. It's opt-in tho.</p></pre>v0idl0gic: <pre><blockquote>
<p>Syntax highlighting works, 'Go to Declaration' works great (takes you directly to the source code, including the SDK classes) and above all code completion using gocode worked out of the box.</p>
</blockquote>
<p>So this is at Go feature parity with LiteIDE as of 3 years ago? I'll stick with LiteIDE- thanks :p</p>
<p>New release of LiteIDE just out: </p>
<p><a href="https://groups.google.com/forum/#!topic/golang-nuts/MKBpm8EMFdk" rel="nofollow">https://groups.google.com/forum/#!topic/golang-nuts/MKBpm8EMFdk</a></p>
<p><a href="https://www.reddit.com/r/golang/comments/4et2a4/liteide_x29_released/" rel="nofollow">https://www.reddit.com/r/golang/comments/4et2a4/liteide_x29_released/</a></p></pre>kunos: <pre><p>not really.. still need (multiple) build configurations, GOPATH management, project and file outline and raw performances of LiteIDE.. not even close. I understand the desire to be inside a "familiar" editor but LiteIDE has so much win when it comes to Go development that I am baffled by the fact it is not THE standard. And yes, I am a LiteIDE fanboy.</p></pre>threemux: <pre><blockquote>
<p>I am baffled by the fact it is not THE standard</p>
</blockquote>
<p>Really? Tech adoption is a social process. LiteIDE, by modern standards, is ugly. Also, much of the community is based in Asia. I'm not saying these are good reasons not to use it, but I believe social factors drive people away. </p></pre>FIuffyRabbit: <pre><blockquote>
<p>I am baffled by the fact it is not THE standard. And yes, I am a LiteIDE fanboy.</p>
</blockquote>
<p>Probably because it looks like ass and isn't very intuitive to use. </p></pre>jfurmankiewicz: <pre><p>Valid comment :-)</p>
<p>I have actually not used LiteIDE, so let me check it out.
Point is that it is now possible to have a decent Go dev environment with nothing more than a text editor, which lowers the barrier to entry.</p></pre>FIuffyRabbit: <pre><p>Uh, gosublime and vim-go are pretty good environments within <em>text editors</em>. </p></pre>drink_with_me_to_day: <pre><p>I love it, but I always get BSODs when using it... So sad.</p></pre>: <pre><p>[deleted]</p></pre>superlampicak: <pre><p>Real programmers deliver value and use whatever editor they want to</p></pre>acron5n5: <pre><p>I use Goclipse (an eclipse plugin) for Go development and personally am okay with it. The only problem is Eclipse startup and warmup time, but if you work all day or just don't have to turn off your PC it also isn't a problem since you actually have to start it one time per day.
As for code, I hate it along with Atom simply because of HTML view that really bugs me. If code had a standard editor (not webview) it would be way better.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传