Skip to content

Feature Request: Global variable renaming (Refactoring) without opening files #542

@DYW972

Description

@DYW972

Description

Currently, the rename functionality (LSP) only propagates changes to files that are already open in a buffer. If a component or variable is implemented in files that are not currently open, those files remain unchanged, leading to broken references and manual cleanup.

Steps to Reproduce

  1. Open a project.
  2. Open File A (where a component is defined) and File B (where it is used).
  3. Keep File C (which also uses the component) closed.
  4. Trigger a rename in File A.
  5. Result: File B is updated, but File C still uses the old name.

Reference to Previous Discussion

This issue was previously mentioned here: #2003 by @developemmanuel . I am reopening this as asked by @siduck

Expected Behavior

The rename operation should reach across the entire workspace/project. Even if a file isn't open, the LSP should be able to:

  • Identify the reference via "Go to Definition" logic (which currently works even for closed files).
  • Apply the text edit to the file on disk or prompt to load all affected files into buffers.

Insights

Interestingly, the "Go to Definition" (gd) command works perfectly for closed files. The logic to locate the references exists, but it seems the rename handler is restricted to the current buffer list.

I'd be happy to help test a PR for the fix!

Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions