-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: document setup required for working with the std library #38603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What was the directory that you opened in VS Code? Right now, we limit the scope of references to the workspace root. |
I opened it in go/src, so the other packages are within this workspace |
Ok, thanks for confirming! I'll take a look. |
Is |
It's a directory |
But it is used for Can you please provide the output of "Go: Locate Configured Go Tools" (find from the command palette) and the beginning of the |
Ah! Yep that was it. Thank you. Is this all documented somewhere? It's still pretty difficult to work in the standard library, and this just silently failed partially, without giving any error message. |
The docs for I'm surprised that that fixed the issue (unless you are using Go Nightly) because the fix for microsoft/vscode-go#3163 hasn't been released yet, and you have the workaround in your settings. |
I was working with @FiloSottile on this config (I borrowed it from him) so I wasn't very familiar with all of these settings. He helped me set this up because I was unaware that I needed to redirect gopls to a different goroot when working in the standard library. As far as I know, this isn't in the official docs? I don't think I'm running Go nightly, and not sure how to check, but can investigate if needed! I'm mostly hoping for some documentation about how to set up gopls to work with the standard library, since it was very non-obvious to me (everything was working great, except for a few features that silently failed - like Find References). |
Change https://golang.org/cl/249057 mentions this issue: |
Updates golang/go#38603 Change-Id: Ie67fb8456178cbcbbbe18fd38c6b74f83c84222b Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/249057 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change https://golang.org/cl/253297 mentions this issue: |
Find All References in VSCode is only able to find references within the same package. For example, clicking Find All References for pkix.Name in go/src/crypto/x509/pkix/pkix.go only finds 7 references to the type, although if you use search you can see there are several more than that.
settings.json:
{
"go.alternateTools": {
"go": "~/godev"
},
"go.toolsGopath": "~/.vscode/godev",
"html.format.enable": false,
"editor.codeActionsOnSave": {
"source.organizeImports": false
},
"gopls": {
"env": {
"PATH": "$HOME/godev:$PATH",
},
},
}
gopls version
golang.org/x/tools/gopls 0.4.0
golang.org/x/tools/gopls@v0.4.0 h1:G4+YP9kaV4dJb79J5MobyApxX493Qa6VoiTceUmxqik=
LMK if you need any logs.
The text was updated successfully, but these errors were encountered: