Skip to content

C# plugin Detailed class diagram - #888

Open
HorvathDaniel15 wants to merge 4 commits into
Ericsson:feature/csharp_pluginfrom
HorvathDaniel15:feature/implement-detailed-class-diagram-csharp
Open

HorvathDaniel15 wants to merge 4 commits into
Ericsson:feature/csharp_pluginfrom
HorvathDaniel15:feature/implement-detailed-class-diagram-csharp

Conversation

@HorvathDaniel15

Copy link
Copy Markdown
Collaborator

Resolves #887

Depends on #883 . This branch is based on feature/function-call-diagram, so the first two commits (Add function call diagramm, Fix issues) belong to that PR, not this one. Once #883 is merged, this PR will only contain its own changes (if it gets squash merged, I'll rebase this branch onto feature/csharp_plugin).

@HorvathDaniel15
HorvathDaniel15 requested review from mcserep and a balanced review from Copilot November 24, 2026 22:48
@HorvathDaniel15 HorvathDaniel15 self-assigned this Nov 24, 2026
@HorvathDaniel15 HorvathDaniel15 added Kind: Enhancement 🌟 Plugin: C# Issues related to the parsing and presentation of C# projects. labels Nov 24, 2026
@HorvathDaniel15 HorvathDaniel15 added this to the Upcoming Release milestone Nov 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The parser deletes the existing C# index before input validation or successful project loading, so unsupported inputs and loading failures can destroy previously indexed data.

6 open issues
What changed in this PR

Adds detailed C# class diagrams using the shared Graphviz infrastructure, building on the function-call diagram work from #883 to address #887.

Changes:

  • Adds UML-style type boxes, inheritance edges, file grouping, and diagram legends.
  • Exposes diagram choices, inheritance references, and member-formatting tags through the C# service.
  • Records inheritance, introduces deterministic identifiers, and resets C# tables before parsing to prevent cross-run duplication.
File Description
plugins/​csharp/​service/​src/​csharpservice.cpp Routes diagram requests and resolves usage nodes to definitions.
plugins/​csharp/​service/​src/​csharpdiagram.h Declares diagram rendering and legend helpers.
plugins/​csharp/​service/​src/​csharpdiagram.cpp Implements Graphviz diagrams, UML labels, and legends.
plugins/​csharp/​service/​src_csharp/​CSharpQueryHandler.cs Adds inheritance queries, member tags, and diagram discovery.
plugins/​csharp/​service/​include/​service/​csharpservice.h Defines diagram identifiers and definition-resolution support.
plugins/​csharp/​service/​csharpservice.thrift Removes the unused C# diagram-rendering endpoint.
plugins/​csharp/​service/​CMakeLists.txt Includes the new diagram implementation in the service build.
plugins/​csharp/​parser/​src_csharp/​Program.cs Recreates C# model tables before parsing.
plugins/​csharp/​parser/​src_csharp/​AstVisitor.cs Records inheritance and calls, stabilizes hashes, and fixes struct-field traversal.
plugins/​csharp/​model/​CsharpEntity.cs Adds the inheritance entity category.

Review effort: Balanced


await using var _context = new CsharpDbContext(options);
_context.Database.Migrate();
RecreateCsharpTables(_context);
AstValue = node.ToString(),
RawKind = node.Kind(),
EntityHash = node.GetHashCode(),
EntityHash = getEntityHash(node),
Comment on lines +528 to +530
var declaration = symbol.DeclaringSyntaxReferences
.Select(r => r.GetSyntax())
.FirstOrDefault(s => s is BaseTypeDeclarationSyntax);
}

// Cut before a block body or an expression body.
str_ = str_.substr(0, std::min(str_.find('{'), str_.find("=>")));
// The AST node value of a type is its whole source text, so the name is
// taken from its properties.
std::map<std::string, std::string> properties;
csharpHandler_.getProperties(properties, nodeInfo_.id);
if (has(SyntaxKind.VirtualKeyword)
|| has(SyntaxKind.AbstractKeyword)
|| has(SyntaxKind.OverrideKeyword)
|| (isInterface && !isStatic && !hasBody))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Kind: Enhancement 🌟 Plugin: C# Issues related to the parsing and presentation of C# projects.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants