Interactive refactoring in gopls

22 points by carlana


natfu

Really cool, it was always neat to be able to highlight code and extract it to a function/method or implement basic methods that are required for some reasons; all automatically. I think I had first seen this in Eclipse or IntelliJ?

There's a bunch of QoL improvements you can imagine (some already being there): finding dead code, renaming symbols at scale, changing file paths update imports and build tools, context aware renaming as well, etc.

Nice to see it will or might become a common toolbox for all languages actually!

eduard

I am really looking forward to testing this! It seems super useful for me, especially the capability to add the methods that implement an interface.

Does anyone know if this can already be used on neovim? Does the neovim LSP implementation support this feature?

gavinmorrow

I don’t use Go, but it would be so cool to see these things in other languages! I just hope editors (I use Helix) support this once it’s finalized. I wonder how much work it would be to add support.

cole-k

I can't believe this wasn't a part of LSP to begin with --- it's wild to me that they had a separate special case for renaming. I had just assumed that under the hood the LSP worked by passing parameters e.g. for fn name, but I guess that cursor position is a better source of truth in the majority of use cases (and avoids the editor having to parse anything). Still, though, it feels like an obvious thing that you might want to pass some context when doing e.g. auto refactors.