Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request improves class diagram type-name normalization and Mermaid rendering robustness by eliminating global:: prefixes throughout fully qualified names and sanitizing : characters to avoid Mermaid parsing issues.
Changes:
- Strip all occurrences of
global::from Roslyn fully qualified type names (including inside generic arguments). - Update Mermaid identifier sanitization to replace
:with_(and document the behavior). - Add a unit test to ensure
::does not appear in Mermaid output for types containing colons.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/ProjGraph.Lib.ClassDiagram/Infrastructure/TypeAnalyzer.cs |
Removes all global:: prefixes from fully qualified type names. |
src/ProjGraph.Lib.ClassDiagram/Rendering/MermaidClassDiagramRenderer.cs |
Sanitizes : to _ to prevent Mermaid misinterpreting ::. |
tests/ProjGraph.Tests.Unit.ClassDiagram/MermaidClassDiagramRendererTests.cs |
Adds coverage ensuring colons are sanitized in rendered Mermaid output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request improves the handling and rendering of fully qualified type names in class diagrams, particularly for cases involving colons (
:) fromglobal::prefixes. It ensures that allglobal::prefixes are removed and that colons are sanitized to underscores, preventing issues in Mermaid diagrams. The changes also add a test to verify this behavior.Type name normalization improvements:
src/ProjGraph.Lib.ClassDiagram/Infrastructure/TypeAnalyzer.cs: UpdatedGetFullyQualifiedNameto remove all instances of theglobal::prefix from type names, including those inside generic type arguments, ensuring cleaner and more consistent type naming.Rendering and sanitization enhancements:
src/ProjGraph.Lib.ClassDiagram/Rendering/MermaidClassDiagramRenderer.cs: Modified theSanitizemethod to replace colons (:) with underscores, preventing Mermaid from misinterpreting::as a style separator. The XML documentation was updated to reflect this change. [1] [2]Testing improvements:
tests/ProjGraph.Tests.Unit.ClassDiagram/MermaidClassDiagramRendererTests.cs: Added a unit test to verify that colons in fully qualified names are sanitized correctly and do not appear as::in the rendered output.Other minor changes:
src/ProjGraph.Lib.ClassDiagram/Infrastructure/TypeAnalyzer.cs: Minor formatting change to improve code readability by adding a blank line.