Interactive refactoring in gopls
Recent developments in gopls, an open-source Go language server, introduce interactive refactoring capabilities. This feature, designed in collaboration with the Dart team, brings dynamic, multi-step dialogs to popular editors like VS Code, Neovim, and Emacs. Previously, gopls relied on a parameterless model for code transformations, often resorting to one-size-fits-all defaults or refraining from offering refinements altogether.
Interactive refactoring overcomes this limitation by enabling language servers to request user input before applying edits. This advancement unlocks a suite of long-awaited refactorings for Go developers, such as adding and removing struct tags, implementing interfaces with dynamic symbol search, and moving declarations across files and packages.
The LSP's new mechanism for collecting user input before computing text edits decouples language-specific features from editors, fostering a more cohesive ecosystem where improvements to the language server benefit all clients.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.