top | item 11217542

Visual Studio Code for Go

468 points| rdudekul | 10 years ago |github.com | reply

218 comments

order
[+] schmichael|10 years ago|reply
We're a 100% Go shop and everyone on my team but me uses Visual Studio Code for Go. It's really amazing. (My mind has just been so corrupted by years of vim usage I'm trapped.)

It's bizarre to think my team writes in a language created by Google in an editor created by Microsoft on System76 laptops running Ubuntu. Never would have been possible in the Gates or Ballmer eras.

[+] mmgutz|10 years ago|reply
VS.Code + the go plugin is quite good. I recommend it to my team members who prefer GUI-based editors. VS.Code is surprisingly much faster than Atom even though they share the same electron editor.

I think vim + vim-go is still the best go editor if you know vim. It just works and it gets updated frequently.

[+] SixSigma|10 years ago|reply
You can add an extra bit :

> a language created by Google

by guys using Macintosh laptops

> in an editor created by Microsoft

At a plan9 conference when people turned up with Mac laptops, Brucee (who wrote considerable portions of Go's ancestors - Inferno & Limbo) remarked to me : "the interesting thing about the Mac was that it wasn't X86 and it wasn't Unix ... now it's both!".

[+] namelezz|10 years ago|reply
For this extension to work, you need to install several Go tools in GOPATH. How did you manage your GOPATH across multiple projects? Do you have a single GOPATH for every project or each project has its own GOPATH?
[+] fapjacks|10 years ago|reply
To be fair (and I can't believe I'm saying this), Bill Gates is spending a third of his time punching the clock at Microsoft, advising Nadella. It may not have been technically possible in the Gates era for this to happen, but I certainly agree with you on the Ballmer point. Anyways, I've been wondering how much of this Gates is responsible for.
[+] coolsunglasses|10 years ago|reply
Which System76 laptops? I'm in the market for a Linux-native laptop which'll compile faster than my MBP.
[+] jalude|10 years ago|reply
I want to start using Visual Studio Code but I am waiting for a VIM emulator plugin that is "good enough" have you tried any of them?
[+] berkeleynerd|10 years ago|reply
The only thing holding me back is the lack of an integrated terminal. This is absolutely essential to my *nix workflow and I can't for the life of me imagine a reason to not include it. Otherwise, I love what I'm seeing here.
[+] frik|10 years ago|reply
Has VS Code still the phone home feature, that can't be turned off? (no it's not okay to sniff on my data or usage, on my computer!)
[+] bitmapbrother|10 years ago|reply
Shouldn't attribution of Visual Studio Code also be given to Google since it uses a large portion of code from the Chromium project?
[+] atonse|10 years ago|reply
I'm going to add the customary "I love this new MS" line here. About 10 years ago a friend of mine offered to make an introduction with her cousin, who was an exec at MS, to see about a job when I got out of college. I said "no way, they're working on such boring and dull stuff there"

But after having worked in C# for a few years now (loving the language) and seeing all the open source moves they're making, it seems like a really exciting place to work these days.

And I'm sure there's a ton of renewed energy there.

[+] _pmf_|10 years ago|reply
I'm kind of a MS fanboy, but please don't believe their lies: - VS is still not free; the community edition can only be legally used by very small companies with slim revenue - the Xamarin acquisition will turn out to be a slap in the face of developers who want to cross target Android and WP - the desaster of the Metro App API that has been replaced by UWP after being hailed as the future of application development for Windows (for a time, you could develop Windows 8.1 Metro Apps only on Windows 8.1 machine, not a Windows 8 machine)

Anybody doing any non-desktop application development on Windows is shouldering the full risk of obsolescence within 2 year.

I would really, really like a cooperation between Google and Microsoft in the area of the utterly braindead 90ies API of Android development by switching to XAML + C# ... ah, a man can dream!

[+] jamra|10 years ago|reply
Well, I don't know about that. They still try and lock you in to their tooling at every turn. I believe that the driving force behind this cool new Microsoft is Azure. They want you to run on their cloud and they'll follow you to OS X and Linux in order to get you there. Make no mistake, Microsoft is the best there is at finding out how to charge you.
[+] lukehoban|10 years ago|reply
Maintainer of the extension here. Happy to answer any questions about VS Code or the Go support specifically.
[+] brunomvsouza|10 years ago|reply
Hi there!

I'm giving the Go plugin (latest) for VS Code (latest) a try but I'm not being able to rename code occurrences.

"Cannot rename due to errors: Error: Command failed /foo/go/bin/gorename -offset /Users/foo/go/src/github.com/foo/hello/hello.go:#79 -to helloNurse"

"rename: -offset \"/Users/foo/go/src/github.com/foo/hello/hello.go:#79\": no identifier at this position"

Do I have to do anything specific for it to work or it should just work?

Found a related issue (https://github.com/Microsoft/vscode-go/issues/165) which led me to (https://github.com/Microsoft/vscode/issues/1580) which is already merged, but I'm still not able to rename symbols.

Code: (tried to rename helloWorld to helloNurse)

'''

package main

import (

    "fmt"
)

func main() {

    helloWorld()
}

func helloWorld() {

    fmt.Printf("hello, world\n")
}

'''

[+] nulltype|10 years ago|reply
Hi! I made some Go customizations for atom, and there were a few things that I thought worked pretty well, maybe consider adding them to this project:

1) Auto GOPATH detection: since all code is located underneath a canonical GOPATH, if the GOPATH is not set, traverse upward a few directories until you find one with a "src" folder in it. This means that I don't have to launch it from a terminal and deal with environment variables. Also, I use a GOPATH per project, so as long as each window auto-detects its own GOPATH, that works great.

2) Cross-compile all the tools (gocode, etc) for the most common platforms, presumably windows and mac, and include them in the extension so that it doesn't rely on auto-install or whatever and just works out of the box.

[+] ridiculous_fish|10 years ago|reply
Hi! My Go project directory has ~2 million data files under a directory called test. When I open the project directory, VS Code starts going through all of them, consuming a lot of memory and IO bandwidth. Is there a way to make it ignore that directory?

I tried "files.exclude" which hides it from the sidebar, but VS Code still tries to walk the entire directory tree.

[+] ngrilly|10 years ago|reply
Are you employed by Microsoft? I'm asking because the repo is hosted under github.com/Microsoft.
[+] sethammons|10 years ago|reply
One of my required features is seeing the method signature when my cursor is on the method name; I don't want to have to enter a command to see the signature. In sublime, the bottom bar will passively show me `func Unmarshal(data []byte, v interface{}) error` when I cursor over json.Unmarshal. I'd really like it if it also showed me the type of the variable I was cursored over, but I digress. Is this possible in your extension?
[+] _ph_|10 years ago|reply
Thanks for this extension, but I struggle with setting it up. How would one build a Go program from inside the IDE? My go program is git controlled, but the IDE does not seem to notice it.

Thanks.

[+] bigdubs|10 years ago|reply
Can jump to definition jump to a definition in an open file instead of opening a duplicate file? Is this handled within the extension or vscode itself?

Thanks for the hard work btw, vscode+go has made my team much more productive.

[+] iends|10 years ago|reply
How does it play with things like glide, gb, and godeps?
[+] pkaye|10 years ago|reply
I like VS Code a lot. It is cross platform and not too heavy. It has a lot of the modern features and look/feel. Don't have to load 50 million plugins to get something reasonable working. I've pretty much stopped using vim/emacs/notepad++ and numerous other editors though occasionally I use vim because I'm on a ssh connection. To me it seems the right balance between complexity and simplicity.
[+] swah|10 years ago|reply
What is it, though? "Build and debug modern web and cloud applications." Is it like Atom (built on top of a browser)?
[+] saiki|10 years ago|reply
I have been working for sometime with Visual Studio Code and with this Go extension. I used to use Sublime 3 for Go development, but with this extension I have noticed that I use more often vscode than sublime for Go development.

It is also a big plus that vscode works very well with TypeScript and you can work seamlessly with TypeScript front and Go backend code.

One nice thing is that you can navigate e.g. function calls easily, which places call a function or directly find correct function in question like foo.New() by pressing F12 or shift+F12. When using Sublime to navigate to foo.New() would probably reveal quite many functions that are in your workspace path.

Go extension also imports automatically packages that you use in your code. Renaming types or functions also works nicely if your code compiles.

There are certainly things to be improved like not being able to conveniently use directories outside your vscode project e.g. common packages across different projects. But over all developer experience is really nice.

[+] KirinDave|10 years ago|reply
Even if you don't like MS or distrust them, seriously...

VS Code is a very good spiritual successor to TextMate. It has better performance characteristics for me than Atom, and I find extending it much less intimidating than Atom. I'm still more comfortable with Emacs keys, but I found it easy to add the emacs keys I miss.

Its license is such that even if MS abandons it I suspect the community will keep it going. So give it a try.

[+] pjmlp|10 years ago|reply
A bit off topic, but usually I tend to avoid browser based UIs for desktop applications, but the quality of current Rust support in Visual Studio Code made me open an exception just to use it.
[+] Manishearth|10 years ago|reply
Huh, maybe I should try it. I'm a Sublime+Vim person, and I'm pretty comfortable with my setup (and have found browser based UIs to be too slow for usage as an editor so I avoid them).
[+] AlexC04|10 years ago|reply
I really love VSCODE. Like really love it.

In all fairness I am aware that I can also a bit of a Microsoft 'fanboy' at times... so I held off on trumpeting around the office how truly great I think it is.

Of course if it came up in passing or anything like "should I open that in sublime?" came up, I'd make a sweeping grandiose statement like "anything but VSCODE is for chumps" (and we'd all laugh then move on about our day)

Anyways, a developer from another team recently saw over my shoulder and said "oh yeah, I'm really liking VSCODE... I've pretty much switched to it full time now" and that was the moment I thought maybe it's not me just being a fanboy... this particular developer was pretty much known as our resident "sublime expert" so much so that he'd given multiple lunchtime presentations and talks around the office on subjects like "how to turn it up to 11 with your sublime text editing" and "snippets for sublime - making you a bajillion times more productive"

Anyways, I know how we used to have the religious holy wars about VI/M vs. EMACS vs. whatever, so people really tend to fall in love with "their" text editor and are not really quick to switch BUT VSCODE has really got something special going on.

[+] minionslave|10 years ago|reply
I've never programmed in Go before. Coming from a C# background. Can someone tell me, how does Go feel? Is is pleasant to work in, or is it tricky like C.
[+] anthnguyen94|10 years ago|reply
VSCode's API is great for extensions. Markdown Viewer is incredibly useful in VSCode. I also really like the way VSCode does its Git integration.

I've gotta say though, I'm still getting used to the non-tab layout...

[+] andrewingram|10 years ago|reply
I hate to be that guy, but I guess I will, because aesthetics are important to me when choosing a tool i'll be using for several hours a day.

I love how Atom looks. Alongside the nicer extension system, the aesthetics of the default theme are what lured me away from Sublime Text.

I sadly can't say the same for Visual Studio Code, which I hear so many great things about, but can't bring myself to use for more than a few minutes. From what i've been able to tell, the only visual customisation available is choosing the syntax colour theme.

[+] tmzt|10 years ago|reply
There is support for full color schemes for the entire UI not just the text colors. There is also support for loading TextMate and Sublime themes.

https://code.visualstudio.com/docs/customization/themes

I personally use a nice dark theme, similar to the one shown in that screenshot. There are also a large range of extensions and VS Code is really fast.

[+] agnivade|10 years ago|reply
You are right. But when you see how much memory Atom takes and compare that to how lightweight Sublime is, you might want to reconsider.
[+] mholt|10 years ago|reply
I had a good experience overall with this plugin (once it was set up, which wasn't exactly trivial), but it keeps auto-completing in comments so when I hit [return] it inserts some random word rather than going to the next line. Every time I want to go to the next line I have to press [esc] then [return].
[+] samuell|10 years ago|reply
This is great. I love how definitions are display on hovering over any variable or function, the go to definition feature and the split window feature, which makes it sweet and easy to keep reference code bits while coding ... I think with the definition display on hover, it even beats vim.
[+] CSDude|10 years ago|reply
Not related to Go plugin, but in VsCode I hate the tabs in the left panel, feels very different and I could not even adjust it after 6 months.

However, the Go plugin is really nice and works perfectly, even, the debugger works /most of the time/ . It is fast and handy. Recommended.

[+] sahaskatta|10 years ago|reply
As a long time Sublime user, having side-bar tabs in editors like Brackets or VS Code is definitely quite annoying. I wish they offered the option to place tabs on the top as an alternative.
[+] pasbesoin|10 years ago|reply
Years ago, when MS was thick in the anti-trust contentions, pops and I agreed that were they to break up, it would be great to have one segment be "tools." MS has long had and offered some great programming support -- compilers, development environments, etc.

However, with monolithic MS, those too often seem tied to and influenced by the larger corporation's goals. You know, world dominance, crushing the opposition, and all that.

I hope that this new push by MS is genuine and does not morph into another embrace, extend, and -- purposefully or simply inevitably -- extinguish effort.

I'm not in the thick of it. This is probably an outdated and way far outside observation. Nonetheless, MS support still leaves me looking for the strings attached.

[+] SonicSoul|10 years ago|reply
I've used it on a macbook for a short time for node/javascript development, but found it buggy and had to switch back to sublime. The undo (cmd+z) would occasionally get in a weird state where the undo would happen partially (not all lines or columns?) and the whole history would be screwed, or outright stop doing anything. Few times i had to close the file to get last saved version. Perhaps it's something I was doing wrong but it was enough not to use the product, which was great otherwise! Will try again when I hear of new versions coming out..
[+] thewhitetulip|10 years ago|reply
I wonder why this was featured today, I have been using vscode for Go since a few months now. It is totally amazing, especially the ctrl+P option! It isn't highlighted but it is a little gem.
[+] dcw303|10 years ago|reply
Delve integration is better than I anticipated. Breakpoints, step in, step over work as expected. Step out not functional but that's a given as delve doesn't do it either. Call stack is implemented. Variables doesn't seem to automatically work, but adding a var to Watch is ok.

With the debug tools, linter, and navigate in/out of definitions, this looks like a pretty efficient workflow.

Caveats: I can't compare to Atom, or anything other than vanilla Vim (haven't configured either of them with any of the go integrations).

[+] swalsh|10 years ago|reply
Wait, does the debugger work now? The last time I picked up Visual Studio code with a C# core project I couldn't' get the debugger to work with dnx web
[+] lukehoban|10 years ago|reply
The VS Code debugger supports a variety of languages. There is built in support for Node.js debugging which works really nicely. And there are extensions[0] providing support for: Go, PHP, Chrome, Unity and more.

[0] https://marketplace.visualstudio.com/VSCode

[+] pionar|10 years ago|reply
The debugger for C# works on Windows only (for now, since the Linux/OSX debuggers will need to use gdb or lldb). Debuggers for other languages are supported by extensions. For instance, there's a javascript and Typescript debugger built in.