Live data from Hacker News

Visual Studio Code for Go

github.com

181–190 of 223 posts

Re: Visual Studio Code for Go

#181

Maintainer of the extension here. Happy to answer any questions about VS Code or the Go support specifically.

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")
}

'''

Re: Visual Studio Code for Go

#182

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 f…

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.

Re: Visual Studio Code for Go

#183

Maintainer of the extension here. Happy to answer any questions about VS Code or the Go support specifically.

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.

I'd love to get more details on this. Open an issue on GitHub?

Re: Visual Studio Code for Go

#184
post #120
post #2

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…

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…

> VS is still not free; the community edition can only be legally used by very small companies with slim revenue

The licensing ambiguity of the VS Express Editions that came before was a lot worse. At least us solo devs have a legitimate path to VS now.

Re: Visual Studio Code for Go

#185

Maintainer of the extension here. Happy to answer any questions about VS Code or the Go support specifically.

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…

Yes - the vscode-go extension will show you function signatures (and type definitions and other symbol definitions) on hover.

If you hold down `cmd`/`ctrl` during hover you additionally get a preview of the definition source code (signature and implementation).

Re: Visual Studio Code for Go

#186

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.

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?

I have a single $GOPATH per project and always recommend doing so. If you vendor code with a tool like godep[0], having one shared $GOPATH is a nightmare. Other tools might work better, but this is basically the standard for the projects I work on. I basically just have a zsh alias[1] that combines z[2] and sets the $GOPATH to $PWD split on "src". I do share a single $GOBIN set to $HOME/bin, though.

[0]: https://github.com/tools/godep

[1]: https://github.com/jzelinskie/dotfiles/blob/04ad026f30782189...

[2]: https://github.com/rupa/z

Re: Visual Studio Code for Go

#187
post #174

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 Ato…

Edit: after a restart I can now see Locals in the Variables window! Seems to be related to breakpoint location - if I break at main.main entry I can see variables.

Re: Visual Studio Code for Go

#189

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.

A lot of people complains about Go because they expect a better Java/C++/C#. If you expect a "better Java", then you are going to be disappointed.

For me Go is more like C with garbage collection and some features of a scripting language -- and that's exactly how it feels programming in Go for me. At the moment it's my language of choice for all side-projects; from web applications, microservices, shell "scripts", ...

Re: Visual Studio Code for Go

#190
post #82
post #49

Earlier quoted context omitted.

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.

I use Jetbrain's IDEA with a Go plugin and it fits all my needs. Do you know how it compares to VS? Never got into VS myself and i'm hesitant to swap IDE's though I'd be willing to try if it's a significant improvement.

I've switched from PyCharm (based on the same IntelliJ Platform as IDEA) to VS Code, and it's so much faster to work with. That said, I've found that it's not nearly as good at all the code intelligence stuff as PyCharm is.

I've never used IntelliJ's Go tools, but VS Code is much better at that stuff in Go than Python. (I believe it uses third-party open-source tools in both cases; code intelligence for a statically typed language like Go is probably much simpler which probably helps.)

The best way to look at VS Code is as an IDE minus the 'integrated' bit - instead of having the core editor and UI bundled in with all the code intelligence stuff for a specific set of languages, it's a text editor with a code intelligence and debugger UI, that calls out to out-of-process plugins to do the heavy lifting.

Post reply on HN