Skip to content
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: provide actions when rename fails due to interface implementation breakage #62613

Open
hyangah opened this issue Sep 13, 2023 · 1 comment
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Sep 13, 2023

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.

Screenshot 2023-09-13 at 10 27 53 AM

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.

@hyangah hyangah added gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. labels Sep 13, 2023
@gopherbot gopherbot added this to the Unreleased milestone Sep 13, 2023
@findleyr
Copy link
Contributor

Nice idea, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants