Repository navigation
C# plugin Detailed class diagram - #888
Open
HorvathDaniel15 wants to merge 4 commits into
Open
HorvathDaniel15 wants to merge 4 commits into
HorvathDaniel15 wants to merge 4 commits into
Conversation
HorvathDaniel15
requested review from
mcserep
and
a balanced review from Copilot
November 24, 2026 22:48
Contributor
There was a problem hiding this comment.
🟡 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
Preserve the existing index when replacement loading fails · New Prevent duplicate entity rows for shared source files · New Resolve inheritance across all partial type declarations · New Find method body boundaries without matching literals · New Query struct properties from the struct table · New Mark eligible interface members virtual even without bodies · New
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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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 ontofeature/csharp_plugin).