Skip to content
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

x/tools/gopls: add refactoring capabilities for plumbing context.Context #60081

Open
fantapop opened this issue Apr 20, 2023 · 1 comment
Open
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Refactoring Issues related to refactoring tools
Milestone

Comments

@fantapop
Copy link

fantapop commented Apr 20, 2023

Is your feature request related to a problem? Please describe.
As we add things like logging and tracing to more places in the codebase, I find I'm often plumbing the context.Context to new areas of the code. It's relatively straightforward but in a large codebase it can take a while.

Describe the solution you'd like
It would be great if there was refactor support for plumbing context back upwards through the function stack. I think its fairly standard to have ctx context.Context as the first item in a parameter list. I'd like to be able to put in a nested function call and then right click on the undefined variable error and have an error resolution be "plumb context from parent".

Describe alternatives you've considered
The only alternative I've considered is the refactor with some mixture of search/replace and manual fixes . I keep imagining one day I should be able to tell an LLM to do it for me. I searched through the vscode marketplace and didn't see anything that would do what I want.

@findleyr
Copy link
Contributor

findleyr commented May 9, 2023

This falls into a category of signature refactoring that we'd like to consider adding to gopls. Moving this to the Go issue tracker. CC @adonovan

@findleyr findleyr changed the title add refactor capabilities for plumbing context.Context x/tools/gopls: add refactoring capabilities for plumbing context.Context May 9, 2023
@findleyr findleyr transferred this issue from golang/vscode-go May 9, 2023
@findleyr findleyr added this to the gopls/later milestone May 9, 2023
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels May 9, 2023
@gopherbot gopherbot modified the milestones: gopls/later, Unreleased May 9, 2023
@findleyr findleyr added FeatureRequest Refactoring Issues related to refactoring tools gopls Issues related to the Go language server, gopls. and removed gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. labels May 9, 2023
@findleyr findleyr modified the milestones: Unreleased, gopls/later May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Refactoring Issues related to refactoring tools
Projects
None yet
Development

No branches or pull requests

3 participants