News for hackers. Stuff that matters.
Re:Visual Studio Code for Go by lukehoban on Thursday March 03, 2016 @11:31AM (#11217906)
Maintainer of the extension here. Happy to answer any questions about VS Code or the Go support specifically.
Re:Visual Studio Code for Go by brunomvsouza on Thursday March 03, 2016 @10:25PM (#11221881)
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 by brunomvsouza on Monday March 07, 2016 @09:44PM (#11243252)
Just in case anyone else got stuck in same matter, I got a reply here https://github.com/Microsoft/vscode-go/issues/165#issuecomme....
Re:Visual Studio Code for Go by nulltype on Thursday March 03, 2016 @02:00PM (#11219085)
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.

Re:Visual Studio Code for Go by lukehoban on Thursday March 03, 2016 @03:30PM (#11219785)
Thanks.

#2 is something we definitely want to do with the VS Code extension as well. https://github.com/Microsoft/vscode-go/issues/5

#1 is also a good idea, we currently offer a per-project setting to configure this, but could also guess better in the case that no GOPATH is set.

Re:Visual Studio Code for Go by ridiculous_fish on Thursday March 03, 2016 @07:42PM (#11221177)
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.

Re:Visual Studio Code for Go by lukehoban on Thursday March 03, 2016 @10:59PM (#11221981)
I'd love to get more details on this. Open an issue on GitHub?
Re:Visual Studio Code for Go by ridiculous_fish on Friday March 04, 2016 @02:27AM (#11222491)
Re:Visual Studio Code for Go by ngrilly on Thursday March 03, 2016 @12:07PM (#11218202)
Are you employed by Microsoft? I'm asking because the repo is hosted under github.com/Microsoft.
Re:Visual Studio Code for Go by lukehoban on Thursday March 03, 2016 @12:12PM (#11218234)
Yes.
Re:Visual Studio Code for Go by tejinderss on Thursday March 03, 2016 @02:07PM (#11219147)
Is there a plan to release python plugin as well??
Re:Visual Studio Code for Go by lukehoban on Thursday March 03, 2016 @03:35PM (#11219832)
There is a Python plugin for VS Code available already [0]. I believe the PTVS folks are also working on a plugin for VS Code as well [1].

[0] https://marketplace.visualstudio.com/items?itemName=donjayam... [1] https://news.ycombinator.com/item?id=10589451

Re:Visual Studio Code for Go by ngrilly on Thursday March 03, 2016 @12:41PM (#11218431)
Ok :-)
Re:Visual Studio Code for Go by sethammons on Thursday March 03, 2016 @04:03PM (#11220018)
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?
Re:Visual Studio Code for Go by lukehoban on Friday March 04, 2016 @12:22AM (#11222184)
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 by _ph_ on Thursday March 03, 2016 @04:59PM (#11220385)
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.

Re:Visual Studio Code for Go by kennymeyers on Thursday March 03, 2016 @12:16PM (#11218266)
What's the roadmap for the extension?
Re:Visual Studio Code for Go by bigdubs on Thursday March 03, 2016 @01:50PM (#11218984)
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.

Re:Visual Studio Code for Go by lukehoban on Thursday March 03, 2016 @03:25PM (#11219749)
Go to Definition will navigate to the definition in an existing open document or open the document if needed. This works across packages in your GOPATH, and also for core Go APIs in GOROOT.

This is all handled in VS Code itself through it's (relatively high-level) extension API[0].

[0] https://code.visualstudio.com/docs/extensionAPI/vscode-api#D...

Re:Visual Studio Code for Go by iends on Thursday March 03, 2016 @01:46PM (#11218946)
How does it play with things like glide, gb, and godeps?
Re:Visual Studio Code for Go by squar1sm on Monday March 07, 2016 @06:23PM (#11242520)
I don't think it does. I'm trying to find flags or anything to make it know what gb is. In the gopath, things just work. In a gb project it just says "no buildable files" because it doesn't know to do `gb build`. Tried some other projects like atocker but then they don't seem to play nice with docker-machine.