-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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/cmd/gorename: doesn't work outside $GOPATH #27571
Comments
Just noting for those following along that @ianthehat has linked this issue to the tracking umbrella issue of #24661 |
One more datapoint: Would love to see this fixed, almost to the point of trying it myself. But I have so little time in next month... |
@myitcv @ianthehat Hi, could you share what is the status if this issue? Do you need any help on solving it? |
@anjmao - per the last |
I like how bingo is doing rename https://github.com/saibing/bingo/blob/master/langserver/rename.go
Probably it's better to just focus on golsp since gorename need's to be rewritten completely anyway. |
Note: This is just copied from go-langserver, which has existing performance issues. https://github.com/sourcegraph/go-langserver/blob/master/langserver/rename.go Edit: I see bingo uses a better caching strategy for typechecked dependencies. So even though the rename implementation was copied, the fact that typechecking is better means it should be better than go-langserver. |
@ysmolsky Do you know if anyone is working on this? I never contributed to golang tools before but with a pointer in the rought direction to start I can probably do it (I also noticed there's a buck of TODOs in the main file). |
@typingduck - please see my comment in #27571 (comment). That linked comment was a reference to this comment from @ianthehat on the last |
Thanks @myitcv. I just wanted to double check before starting that nobody else is working on this. It sounds like that's a 'no' (having no prior experience on go tools I'm sure it will take me a few days longer to get up to speed than someone with experience). I will start looking into it, but might wait until the next tools call before starting in earnest just to make sure I'm not stepping on someone else's existing plans. |
Is there any update on this issue? |
Is there a plan for how this might be done? I haven't seen any discussion of it. If @typingduck has lost enthusiasm, I am happy to dig into this. |
My understanding from listening in on the golang-tools catch-ups is that gorename has some fundamental issues preventing it from working in a module world, and that it would need a re-write. I also may have misunderstood. @ianthehat has discussed this in the past, maybe he has some insights as to how a future gorename might work. |
Sorry for that naive question, but with the LSP support coming with |
Ignoring for one second how
Perhaps @ianthehat could add a few notes here on the bits I've likely missed :) |
In the near term I'd be happy with a Can anyone working on |
@adg:
Agreed. The scenario that I find myself in often enough, and which formed the basis for those notes, is:
i.e. the scope of the identifier rename in M2 would be limited to M1's module requirement graph. It may be that the identifier is used by packages in modules other than M1 in M1's requirement graph, for example. Again, that seems like a sensible initial restriction. But starting with renames of identifiers (exported or otherwise) within the main module (M1 in this example) is also a good starting point. We should probably not try to solve for the case of cyclic module requirements for now either. |
@stamblerre can you tell me whether gopls will cover the functionality of gorename? Is it worth working on gorename? |
gopls will definitely grow these kinds of features, and if you want to try contributing it would be appreciated. |
Excuse me for my abrupt question, when will gopls have a fully functional(able to replace gocode and others) and available version ? |
@douglarek: |
This comment has been minimized.
This comment has been minimized.
Related CL https://golang.org/cl/182585 for |
Closing this now as |
How would I use that |
Have you configured |
It's great that gopls is moving forward. I think it's the right direction. But be aware that it may not be very stable. I find it crashes or hangs or quits working for various reasons, YMMV. It was bad enough that I was forced to switch back to the old tools. |
@stamblerre I did; updated the
made the changes to the
but renaming still does not work:
|
@apmckinlay: There has been some instability with @hellt: It looks VSCode is still trying to run "go.languageServerExperimentalFeatures": {
"rename": true
} to your |
As of a couple days ago, gopls was only renaming within a single package (versus in the entire workspace). As a consequence, I had to turn rename to false in vscode so that it'd fall back to gorename. I'm not sure if this is an expected limitation of gopls right now, so ymmv. |
The issue here is that |
yeah that's fair - I still develop my module-enabled project in gopath mode, but with gopls on for some features. gopls is soooo much faster and I'm really excited about where it's headed, but I frequently have to revert to older tooling for certain features that haven't made it to gopls yet. |
Oh! It's the language server; too bad :-( Do I understand correctly that there will no more be a standalone tool to carry out project-wide renames? I mean, callable from the command-line, without the need to set a separate service up beforehand. |
@stamblerre this helped immediately
|
Vim-go uses the deprecated gorename command that doesn't support Go modules. The latest release go gopls support renaming and is the new way forward. See: * golang/go#27571 * fatih/vim-go#2366
Vim-go uses the deprecated gorename command that doesn't support Go modules. The latest release go gopls support renaming and is the new way forward. See: * golang/go#27571 * fatih/vim-go#2366
What version of Go are you using (
go version
)?go1.11
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
Tried running
gorename
in a project outside of $GOPATH, using vscode-go and also manually. Both times the program errors with:Commands work as expected when run on the same project inside the $GOPATH.
What did you expect to see?
The symbol being renamed.
What did you see instead?
An error message claiming the package could not be found.
The text was updated successfully, but these errors were encountered: