-
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/gopls: rename incorrectly renames multiple function definitions #62135
Comments
Woah. I've never seen a bug like this, but can confirm that it is reproducible in this repository. Bisecting / investigating. |
On a hunch, I grepped for method declarations in test packages: indeed Of course, this is still a (bad) bug. |
Thanks very much for reporting this bug. I've minified the repro in https://go.dev/cl/521121, which contains a failing test. |
Change https://go.dev/cl/521121 mentions this issue: |
Ok, I've narrowed down the problem, and it's not entirely trivial to solve. I will work on it later this week. Summary of investigation:
To fix, we should always compute object paths using the narrowest package, and should treat renaming in test variants as a (separate) local task. |
CC @adonovan for awareness, since he has some experience with this tricky logic (but not to fix! I'll fix :) ) |
I came across a similar bug. In the following codebase renaming ControlBlock.Snd to Send. it renamed |
Hmm, the reported case was incidentally fixed by https://go.dev/cl/534139. Not convinced this is fixed in general. |
gopls version
go env
What did you do?
With both the Neovim LSP and VS Code, both using gopls as my language server, I've attempted to rename this function from
SetCompanionRetainHeight
toSetCompanionBlockRetainHeight
.I cannot find a minimal way to reproduce this bug unfortunately.
What did you expect to see?
The function to be renamed, as well as all references to the function.
What did you see instead?
The function was renamed, but the function above it (
checkHeightBound
) was also renamed toSetCompanionBlockRetainHeight
- incorrectly, of course. All prior references tocheckHeightBound
are now also renamed toSetCompanionBlockRetainHeight
.Not only this, but some prior references to
SetCompanionRetainHeight
still remain.Editor and settings
Neovim config:
VS Code config is set to the defaults.
Logs
VS Code logs: https://gist.github.com/thanethomson/ad3fb91847a4cb84e281a4322e971667
The text was updated successfully, but these errors were encountered: