Hacker News new | past | comments | ask | show | jobs | submit login

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

'''


Just in case anyone else got stuck in same matter, I got a reply here https://github.com/Microsoft/vscode-go/issues/165#issuecomme....


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.


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.


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?



Are you employed by Microsoft? I'm asking because the repo is hosted under github.com/Microsoft.


Yes.


Is there a plan to release python plugin as well??


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


Ok :-)


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?


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).


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.


What's the roadmap for the extension?


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.


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...


How does it play with things like glide, gb, and godeps?


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.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: