Skip to content

C# plugin Detailed class diagram #887

Backlog

Description

@HorvathDaniel15

C# plugin: Detailed class diagram

Part of #822. The original issue covers all C# diagrams (function call, class, file/directory dependency, CodeBites). Implementing them in one PR would be too big, so this issue covers only the detailed class diagram. The other diagram types will get their own issues.

Goal

The C# plugin should be able to produce a detailed class diagram the same way as the C++ plugin does: an interactive Graphviz SVG diagram, to keep a unified approach for diagrams.

Expected behaviour (same as the C++ plugin)

  • The diagram can be opened from the text context menu of a C# type (class, struct, interface, record) or of a usage of a type (Diagrams → Detailed class diagram).
  • The selected type is the center node, its direct base types (base class and implemented interfaces) are shown above it, its direct derived types below it, connected by inheritance edges.
  • Each node is a UML-style class box: the name of the type, its data members (fields and properties as name : Type) and its methods.
  • Member visibility is shown with UML signs (+ public, - private, # protected, ~ internal), static members are bold, virtual/abstract/override members are italic.
  • Nodes are grouped into subgraphs by source file.
  • The diagram is interactive like in the C++ plugin: clicking a node opens the diagram for that type.
  • A legend is available for the diagram.

Tasks

  • Implement the detailed class diagram and its legend in the C# service, reusing the C++ plugin's Graphviz-based approach (util::Graph, util::LegendBuilder, HTML labels).
  • Make sure the C# parser stores the inheritance relations (base class and implemented interfaces) so the Inherits from / Inherited by references can be queried.
  • Provide the member information needed for the class boxes (visibility, static, virtual/abstract/override) through the references of the type.
  • Make sure re-parsing doesn't duplicate the C# data, so the diagram doesn't show duplicated members.

References

Some initial work has been done on the csharp_diagrams branch of @intjftw's fork, which should be checked and reused if possible:
https://github.com/intjftw/CodeCompass/commits/csharp_diagrams/

Code changes can be tracked here:
intjftw#1

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

Metadata

Metadata

Labels

Kind: Enhancement 🌟Level: Intermediate (3)Plugin: C#

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions