-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate one puml file for a set of interfaces and classes related to each other by inheritance #67
Comments
The problem here is to resolve the full qualified name of the types. As of now this tool here does not take into account the namespace of classes. While this can be remedied for the type itself by traversing the syntax node up through parent, there seems to be no solution for the base classes and interfaces of a type using the syntax tree only. But in order to correctly resolve inheritance relations between types, the fully qualified names of all types is needed. For this reason I think that in consequence this tool needs to be enhanced to use compilation and symbol layer. I will try to target one or more projects instead of a directory of files, and have it compiled by msbuild. Then traverse the symbols of this compilation (SymbolVisitor instead of CSharpSyntaxWalker). While the SymbolVisitor has a different logic, (for example methods and constructors go together ...) it should still be possible, to port the existing code to the symbol layer. I am going to do this in a fork, which will have the primary goal to pick a set of types related by inheritance and plot them together in one single uml. As this is a different approach which requires different configuration, it won't be directly related to the classes and configuration of this project here, but I will heavily borrow from the plantuml-code generation of this project . |
I have done some rudimentary implementation of inheritance diagrams based on symbol tree instead of syntax tree. |
I think for bigger projects it would not be feasible to generate allInOne. On the other side to have one puml for each type, which then only includes its base types does not help either. One would have to manually copy those together. for which one would like to see a complete inheritance diagram.
Therefore I think it would make sense to have a type filter like the fully qualified name of a class or an interface as parameter, with the goal to obtain a diagram with all the classes and interfaces related by inheritance. Later this could be refined to generate for example only recursively inherited classes or base classes.
In order to achieve this, one needs two passes. First generate all the syntax tree objects with their relations. Then starting from the seed class or interface recursively run through the relations to obtain the set to be rendered in puml.
In order for this to work one would need a type dictionary for classes, interfaces, structs, ... where the key is the fully qualified type name.
And also two relations dictionaries, one base->inherited, one inherited->base, where the key is the fully qualified type name, and the value is a list of fully qualified type names. Or one could put both relation-directions in one dictionary.
Anyway, using these dictionaries, one can reduce the types to be rendered, and then in a second pass render only those which remain after the filtering.
The text was updated successfully, but these errors were encountered: