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 @@ -171,10 +171,27 @@ def get_package_properties(self, obj: PackageEntity) -> NodeProperties:
171171
172172 def get_class_properties (self , obj : ClassEntity ) -> NodeProperties :
173173 """Get label and shape for classes."""
174+ attrs = obj .attrs if not self .config .only_classnames else None
175+ methods = obj .methods if not self .config .only_classnames else None
176+
177+ if attrs and hasattr (obj .node , "properties" ):
178+ formatted_attrs = []
179+ property_names = {prop .name for prop in obj .node .properties }
180+
181+ for attr in attrs :
182+ name = attr .split (":" )[0 ].strip ()
183+ if name in property_names :
184+ # Get type from instance_attrs_type
185+ prop_type = obj .node .instance_attrs_type .get (name , ["Unknown" ])[0 ]
186+ formatted_attrs .append (f"{ name } «property»: { prop_type } " )
187+ else :
188+ formatted_attrs .append (attr )
189+ attrs = formatted_attrs
190+
174191 properties = NodeProperties (
175192 label = obj .title ,
176- attrs = obj . attrs if not self . config . only_classnames else None ,
177- methods = obj . methods if not self . config . only_classnames else None ,
193+ attrs = attrs ,
194+ methods = methods ,
178195 fontcolor = "red" if is_exception (obj .node ) else "black" ,
179196 color = self .get_shape_color (obj ) if self .config .colorized else "black" ,
180197 )
You can’t perform that action at this time.
0 commit comments