File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -169,10 +169,27 @@ def get_package_properties(self, obj: PackageEntity) -> NodeProperties:
169169
170170 def get_class_properties (self , obj : ClassEntity ) -> NodeProperties :
171171 """Get label and shape for classes."""
172+ attrs = obj .attrs if not self .config .only_classnames else None
173+ methods = obj .methods if not self .config .only_classnames else None
174+
175+ if attrs and hasattr (obj .node , "properties" ):
176+ formatted_attrs = []
177+ property_names = {prop .name for prop in obj .node .properties }
178+
179+ for attr in attrs :
180+ name = attr .split (":" )[0 ].strip ()
181+ if name in property_names :
182+ # Get type from instance_attrs_type
183+ prop_type = obj .node .instance_attrs_type .get (name , ["Unknown" ])[0 ]
184+ formatted_attrs .append (f"{ name } «property»: { prop_type } " )
185+ else :
186+ formatted_attrs .append (attr )
187+ attrs = formatted_attrs
188+
172189 properties = NodeProperties (
173190 label = obj .title ,
174- attrs = obj . attrs if not self . config . only_classnames else None ,
175- methods = obj . methods if not self . config . only_classnames else None ,
191+ attrs = attrs ,
192+ methods = methods ,
176193 fontcolor = "red" if is_exception (obj .node ) else "black" ,
177194 color = self .get_shape_color (obj ) if self .config .colorized else "black" ,
178195 )
You can’t perform that action at this time.
0 commit comments