rust-lang / rust-lang/rust-analyzer

Request: move modules in project structure refactoring

Open
#8,872 4 comments 14 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

E-hard S-actionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Will be good to see a following feature:
When I'm moving a folder with one module to another place (for example to a directory of a higher level - like from src/ui/views/ to src/ui/) using drag-and-drop in VS Code file explorer it should automatically: delete this mod from mods declared in old place, add this mod to a mod where selected mod was dropped, update imports - both in moved mod (for ex. when super::* imports become invalid because mod parent changed) and in all other files where this mod was used.
This feature for me seems similar to currently presented ability to rename modules - which automatically renames all imports of renamed mod and this mod declaration in structure.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing module-renaming support, which the issue identifies as the closest related entry point, and examine how VS Code file-explorer moves are surfaced. Define the affected module declarations and imports, including super::* references and uses in other files. Done means moving a folder updates the old and new module structure and all affected imports.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.