strycore / fakegir

fakegir: Bring autocompletion to your PyGObject code
GNU General Public License v3.0
92 stars 16 forks source link

Doesn't parse "records" #28

Open realh opened 5 years ago

realh commented 5 years ago

fakegir seems to miss out "record" items, which is what gi calls structs. structs may have methods. They're quite important in some libraries, so fakegir not supporting them is a big hindrance.

kastixx commented 5 years ago

Does PR #29 fix that issue?

realh commented 5 years ago

Yes, but only partially, because it doesn't support fields. I'm not sure how best to deal with them. If output classes had a constructor that set those fields with type annotations, would jedi etc be able to introspect them?

kastixx commented 5 years ago

Probably it won't. It's not possible to assign a docstring to class attribute, here's an explanation: https://stackoverflow.com/questions/3051241/how-to-document-class-attributes-in-python .

A possible work-around would be adding an empty property for each field:

class Foo:
    @property
    def field_name(self):
        """Docstring for field_name"""
        pass
realh commented 5 years ago

That sounds like a good idea. Shall I give it a try and open a new PR?