x/tools/gopls: provide actions when rename fails due to interface implementation breakage #62613
Labels
FeatureRequest
Issues asking for a new feature that does not need a proposal.
gopls
Issues related to the Go language server, gopls.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
gopls built on master.
When attempting to rename a method but that will make the struct no longer implement an interface and break the code, gopls tries to be helpful by showing the details like this.
That's an improvement (thanks!), however, since VS Code does not linkify source locations shown in the message and vscode by design discourages use of multi-line notification 1, this is a bit hard to deal with for VS Code users.
Some options to consider in this case
VS Code notification supports a subset of markdown syntax and one of them is
[link](url)
form. Utilize that when possible (check client info or markdown handling capability) so users can jump to the rename-able interface definition location by clicking the link.Utilize 'actions' field and utilize 'ShowMessageRequestClientCapabilities.messageActionItem.additionalPropertiesSupport'. (e.g. "Rename this instead")
Or provide an option to force renaming - some users may attempt to recover by fixing the diagnostics following, or revert the action.
The text was updated successfully, but these errors were encountered: