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{}
Comment From: findleyr
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 https://github.com/microsoft/language-server-protocol/issues/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.
Comment From: firelizzard18
Can the extension provide code actions? If the action can be initiated from the extension, then the extension could collect the required user inputs and pass those to a gopls command.
Comment From: Mondonno
Thanks for doing the work here. It is very needed feature.