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: How about add a code action to update the reference after move a type to another package? #57016

Open
donnol opened this issue Dec 1, 2022 · 1 comment
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@donnol
Copy link

donnol commented Dec 1, 2022

What did you do?

I have code like below:

package a

type M struct {
}

and used by some package:

package main

func main() {
        _ = &a.M{}
}

Can we have a code action on the M sruct named move to other package (like: package b), and then update the reference &a.M{} in main package to &b.M{}

@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 Dec 1, 2022
@gopherbot gopherbot added this to the Unreleased milestone Dec 1, 2022
@findleyr
Copy link
Contributor

Thank you for the issue, and apologies for our slow response.

We discussed this in our triage meeting, and while it would be a very useful feature it's a bit tricky to implement in the LSP (see microsoft/language-server-protocol#1164).

I think we could have a custom command (via the workspace/executeCommand API, but it would require each LSP client to implement the UI for manually editing the command before sending.

Putting this in our queue to think about: I think it would be great to develop a framework for this type of refactoring.

@findleyr findleyr modified the milestones: Unreleased, gopls/later Dec 14, 2022
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. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants