rust-lang / rust-lang/rust-analyzer

Feature: View module dependency graph

Open
#15,547 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-ide C-feature E-unknown fun
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

It would be nice if we could show a graph for a given crate that visualizes the interdepndencies between the crate's modules. That is, if module a imports/references something from module b we would draw an edge between the two showing this dependency.

In Rust it is rather easy to accidentally create a very messy setup where modules in a crate suddenly refer in plenty of cyclic ways making it very difficult to follow. The feature here would help showing the problem and possibly aid in figuring out how/what to restructure to reduce the cyclic dependencies between them. What's nice about removing these kinds of module dependencies in a crate is that it allows extracting subcrates from them as a module that is only referred to by other modules can be simply extracted from a crate without problems (in most cases).

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

The issue names no files, tests, or entry points, so first determine where rust-analyzer could collect module imports and how a crate graph should be presented. Define the graph scope and output format before implementation; done means a given crate's module dependencies are visualized with edges, including cyclic relationships.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.