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: support module-local renaming #32877

Closed
inliquid opened this issue Jul 1, 2019 · 6 comments

Comments

@inliquid
Copy link

@inliquid inliquid commented Jul 1, 2019

VS Code. Latest gopls code from master. Trying quite simple rename operation:
изображение

@gopherbot gopherbot added this to the Unreleased milestone Jul 1, 2019
@gopherbot gopherbot added the gopls label Jul 1, 2019
@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Jul 1, 2019

Right now, rename only works within a package and its tests. We are still working on a strategy for renaming packages in a module.

/cc @suzmue

@suzmue

This comment has been minimized.

Copy link
Contributor

@suzmue suzmue commented Jul 2, 2019

This is closely tied to issue #32869

Once find all references in the module level is supported, we should be able to global renaming.

@stamblerre stamblerre changed the title x/tools/cmd/gopls: rename doesn't work for all occurences x/tools/gopls: rename doesn't work for all occurences Jul 2, 2019
@stamblerre stamblerre changed the title x/tools/gopls: rename doesn't work for all occurences x/tools/gopls: support module-local renaming Aug 5, 2019
@stamblerre stamblerre modified the milestones: Unreleased, gopls v1.0 Aug 26, 2019
@gopherbot gopherbot added the Tools label Sep 12, 2019
@abitrolly

This comment has been minimized.

Copy link

@abitrolly abitrolly commented Oct 13, 2019

Why modules are so important here? Is it possible to detect project root and scan all symbols the same way go build and go test ./... do?

@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Oct 15, 2019

The go command is quite different from gopls, but we will be able to scan the module root in a similar way. The reason that modules are relevant here is that the idea of renaming a symbol is different in module mode. You only want to rename a symbol within the module where it is defined, since clients depend on specific versions of your module, which will be found in the module cache. In $GOPATH mode, we would rename the symbol throughout the other projects in your $GOPATH.

@abitrolly

This comment has been minimized.

Copy link

@abitrolly abitrolly commented Oct 15, 2019

When I did git clone for the tflint project I was editing and get project checkout, I didn't have to place the project somewhere on $GOPATH. Therefore it seems that it should be quite easy to cut all paths that lie outside of the project directory. If gopls can not detect which packages are native to project and which are external.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 14, 2019

Change https://golang.org/cl/207264 mentions this issue: internal/lsp/testadata/rename: add a test case for renames across packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.