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")
}'''
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.
#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.
I tried "files.exclude" which hides it from the sidebar, but VS Code still tries to walk the entire directory tree.
[0] https://marketplace.visualstudio.com/items?itemName=donjayam... [1] https://news.ycombinator.com/item?id=10589451
If you hold down `cmd`/`ctrl` during hover you additionally get a preview of the definition source code (signature and implementation).
Thanks.
Thanks for the hard work btw, vscode+go has made my team much more productive.
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...