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: support renaming a package #41567
Comments
There is some tips to implement this? I think that this could be super useful and I would like to implements. I think that the implementation should be in qualifiedObjsAtProtocolPos function, I'm in the right way? |
@msAlcantara: Thanks for your interest! I think this is slightly more complicated than that because the package name declaration does not have a |
Thanks very much for your awnser, but I have some question about it.
Sorry is this questions is too dump, I'm a just getting started with gopls source code and I'm trying to understand |
Please don't apologize--this is a tricky issue! I think the easiest thing would be to do something like |
Should an implementation for this also rename the directory and the package comment? And if "yes", is this still possible by looking at the position in the AST? What would happen if the |
Hi I think this is something that @dle8 might look into.
IMO yes it should do both (note that LSP supports renaming files via TextDocumentEdits, so I think this should be possible). To start we can implement |
Right now our protocol package only supports DocumentChanges that are It's probably also worth researching exactly how well supported renaming files is among LSP clients, as I can imaging this might be a tricky operation. |
Change https://go.dev/cl/408714 mentions this issue: |
Update References to detect if the package is referenced and a regtest to test within and external package references. Updates golang/go#41567 Change-Id: I607a47bf15f1c9f8236336f795fcef081db49d6a Reviewed-on: https://go-review.googlesource.com/c/tools/+/408714 Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Dylan Le <dungtuanle@google.com> gopls-CI: kokoro <noreply+kokoro@google.com>
What did you do?
package somepackage
.What did you expect to see?
Let me rename package.
What did you see instead?
This element cannot be renamed.
Build info
golang.org/x/tools/gopls v0.5.0
go version go1.15 linux/amd64
The text was updated successfully, but these errors were encountered: