Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Property setters are not correctly recognized in DocSet #162

Open
felixLam opened this Issue · 7 comments

2 participants

Felix Lamouroux tomaz
Felix Lamouroux

When defining a regular property, e.g.:

/// My own property
@property BOOL myProperty;

The DocSet only provides tooltips for the property (e.g. myObject.myProperty) and its getter (e.g. [myObject myProperty]), but fails to provide tooltips for [myObject setMyProperty:YES]. Is this a known issue?

tomaz
Owner

Hm, this would probably require adding getters and setters to tokens file.

Felix Lamouroux
tomaz
Owner

Basically what you want to do is to inject additional method for each property setter, besides property name in tokens.xml files. This is handled in GBDocSetOutputGenerator within addTokensXmlModelObjectDataForObject:toData: (pull latest changes, then methods are handled starting line 280).

In there, let default code execute, then add a test for method.isProperty at the end of the and inject set: method if test passes. To inject, you can simply create a new GBMethodData on the fly (just reuse the same comment) and send it to addTokensXmlModelObjectDataForObject:toData: (this would result in recursive call, although should not create infinite loop as the new method would not be property).

There are also other possible routes, but I think this one would be simplest. Hope it makes sense :)

Felix Lamouroux

See Pullrequest #164

tomaz tomaz referenced this issue from a commit
tomaz Refactored property setters generation for doc set. References #162.
I've cleaned up the code a bit, added proper declaration from property and removed getters generation (it clashes with property one).
86b4417
tomaz
Owner

Thanks for solution, I've pulled your code, refactored it a bit (not that it wasn't ok, it's just I'm somewhat obsessive about it :) Also took out the getter - it clashes with basic property declaration (although they end with different token id, seems there's no real benefit for adding it!?). Also added property declaration from your TODO note. It seems fine from my short tests - could you give it a go and confirm it works (also check if getter is actually needed or not, so I an add it back in), then I'll close this issue.

Anyway, thanks for your effort, have a go and let me know how it goes ... and as it's that time of the year: happy new year :))

Felix Lamouroux
tomaz
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.