-
Notifications
You must be signed in to change notification settings - Fork 765
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
"Go: Extract to function" command fails as vscode can't resolve dependencies when using gopls and modules #677
Comments
@luca-battistelli thanks for filing an issue. The tool implementing "Go: Extract to function" doesn't seem to handle modules mode. If you are already using gopls, gopls offers the 'extract to function' capability through the code action. When you select the code range to refactor, find a light bulb appearing (💡 ) near the selected region. Click it. You can also bind a key short cut for @stamblerre Is this mapping for the code action kind stable? I think this should be |
Didn't notice the lightbulb! Thanks for the help 🙂 |
I don't think we have the |
Looks like this has been resolved--closing. |
Please direct general questions to:
#vscode
channel in Gophers SlackPlease review the documentation before filing an issue.
Helpful pages include:
Please answer these questions before submitting your issue. Thanks!
What version of Go, VS Code & VS Code Go extension are you using?
go version
to get version of Gocode -v
orcode-insiders -v
to get version of VS Code or VS Code Insidersgo env
to get the go development environment detailsShare the Go related settings you have added/edited
Describe the bug
VsCode is looking for dependencies in e.g
/usr/local/go/src/rsc.io/quote
(from $GOROOT) and/Users/lucabattistelli/go/src/rsc.io/quote
(from $GOPATH)and not in the module cache, where they are instead located, e.g
/Users/lucabattistelli/go/pkg/mod/rsc.io/quote\@v1.5.2/
Steps to reproduce the behavior:
a := 2 + 3
)a := 2 + 3
Go: Extract to function
commandScreenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.
The text was updated successfully, but these errors were encountered: