x/tools/gopls: crash in renaming inside packages that use type param composite lits #61614
Labels
FrozenDueToAge
gopls
Issues related to the Go language server, gopls.
NeedsFix
The path to resolution is known, but the work has not been done.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
gopls version: v0.12.4 (go1.20.3)
gopls flags:
update flags: proxy
extension version: 0.39.1
go version: 1.20.3
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Thu, 27 Jul 2023 03:27:43 GMT
restart history:
Tue, 25 Jul 2023 20:01:41 GMT: activation (enabled: true)
Tue, 25 Jul 2023 20:08:52 GMT: config change (enabled: true)
Tue, 25 Jul 2023 20:09:30 GMT: config change (enabled: true)
Tue, 25 Jul 2023 20:09:41 GMT: config change (enabled: true)
Tue, 25 Jul 2023 20:11:07 GMT: config change (enabled: true)
gopls crashed after trying to refactor/rename a struct field with a generic type.
I don't want to post the exact code that caused this as it's part of a private codebase, but I believe the following is a close enough approximation as far as this issue is concerned:
I tried renaming all of the fields of builder, but only the non generic-typed fields (i.e. name and the other fields) succeeded. Before it crashed, whenever I attempted to rename 'elements' or 'elemData', I just got a notification popup that said "No Result". After a couple times of trying this, gopls eventually just crashed (actually, the logs are showing other identical panics, so it may have crashed the other times too, but it was being restarted until it hit a limit of number of restarts in a certain time period)
edit: I just restarted the language server and tried it again, and while it doesn't crash or panic when trying to rename a generic field, the rename only succeeds in the local scope. So if I try renaming it from the struct's type definition, that's the only place it changes (as if I had just selected it and typed a new name). If I rename it from where it's being used, every use of it in the local scope will change, but everything outside of that scope remains the same.
The text was updated successfully, but these errors were encountered: