Skip to content

x/tools/gopls: feature: "move declaration" refactoring #70583

Open

Description

@adonovan

A generalization of renaming a symbol X to Y is to rename X to otherpkg.Y, causing the declaration of X, along with any necessary supporting declarations, to be moved into some file in the designated other package. There are a fair number of edge cases to consider, and UI questions such as how best to obtain the name of otherpkg: the only current LSP operation that supports dialog is Rename, which rather forces our hand. (Another possibility is to use the web interface, which could give a rich interactive menu of which declarations should be moved and optionally renamed at the same time.)

Activity

  1. added
    ToolsThis label describes issues relating to any tools in the x/tools repository.
    RefactoringIssues related to refactoring tools
    goplsIssues related to the Go language server, gopls.
    on Nov 26, 2024
  2. added this to the Unreleased milestone on Nov 26, 2024
  3. gabyhelp commented on Nov 26, 2024

    @gabyhelp

    Related Issues

    (Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

  4. modified the milestones: Unreleased, , Backlog on Nov 26, 2024
  5. xzbdmw commented on Dec 3, 2024

    @xzbdmw

    +1 for web interface, also TextBased UI is interesting.

  6. adonovan commented on Dec 3, 2024

    @adonovan
    MemberAuthor

    Aside: I think it is time we took matters into our own hands and discussed with other language-server maintainers what they would like to see in a protocol extension for dialog support. Then we can all implement it in our servers, and divide up the client-side work for various popular editors. It will be faster than waiting for something to happen on the LSP issue tracker; even PRs to contribute minor features on which there is broad consensus go neglected for months.

  7. added this to the gopls/backlog milestone on Dec 6, 2024
  8. added
    FeatureRequestIssues asking for a new feature that does not need a proposal.
    on Dec 6, 2024
  9. removed this from the gopls/backlog milestone on Apr 24, 2025
  10. 33 remaining items

  11. gopherbot commented on Oct 20, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/851548 mentions this issue: gopls/internal/golang: MoveDeclaration - create package if it doesn't exist

  12. gopherbot commented on Oct 29, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/856421 mentions this issue: gopls/internal/golang: MoveDeclaration - reject if staying symbol references unexported field in moving symbol

  13. gopherbot commented on Oct 30, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/856981 mentions this issue: gopls/internal/golang: MoveDeclaration - fix crash when moving to new file in a test-only dir

  14. gopherbot commented on Nov 4, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/859061 mentions this issue: gopls/internal/golang: MoveDeclaration - block moving single name in multi-spec

  15. gopherbot commented on Nov 11, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/862124 mentions this issue: gopls/internal/golang: MoveDeclaration - reject moves to same file

  16. gopherbot commented on Nov 17, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/865141 mentions this issue: gopls/internal/golang: MoveDeclaration - fix moves involving test files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

FeatureRequestIssues asking for a new feature that does not need a proposal.RefactoringIssues related to refactoring toolsToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions