Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode 5: Is there any way to group/filter/sort what shows up in code-completion?

For a very simple object like this:

@interface MyObject : NSObject
@property(strong) NSObject* thingAboutMyObject;
- (void) aThingToDo;
- (void) moreToDo;
- (void) yetAnotherAction;
@end

Someone working with MyObject gets code completion which includes all of the methods and properties from NSObject. It makes sense why this happens, but for a majority of cases, the methods I care most about are in the class itself. I'd like to know if there is a way, when creating a class, to hint to the xcode IDE that you want to 'highlight' the actual interface when working with objects of the class.

I've seen a few classes which seem to 'handle' this by duplicating the class name in the method definitions, so that they sort together in the completion list, like:

- (void) myobjectAThingToDo;
- (void) myobjectMoreToDo;
- (void) myobjectYetAnotherAction;

But that doesn't seem like a particularly elegant solution ([myObject myobjectAThingToDo]) AND it breaks down horribly in situations where polymorphism is involved.


Here's an example of what an 'ideal' solution would be. I might actually make a formal feature request of it, if someone doesn't provide a suitable alternative. But for now, it should at least clarify what I'm asking for.

It would be great if there was a way to hint to code completion that my completion list should be grouped by class, like:

MyObject

  • [M] aThingToDo
  • [M] moreToDo
  • [M] thingAboutMyClass
  • [M] yetAnotherAction

NSObject

  • [M] accessibilityActivate
  • [M] accessibilityActivation
  • ...

Presumably, a deeper object hierarchy could just list parent classes in the same style, ordering by inheritance 'proximity.' A list like this could easily still filter as you type and eliminate class groupings which have no matches.


Can anyone suggest solutions to help with this? I doubt there's anything that does EXACTLY what I want, but if there are good ways to bring a classes own interface to the forefront, or at least get NSObject out of the way, I'd love to hear it.

like image 446
J. Paulding Avatar asked Dec 06 '13 15:12

J. Paulding


1 Answers

I don't think there is, but you should check out this answer for a cool way to show more info during autocompletion, at least.

like image 50
Wil Shipley Avatar answered Nov 13 '22 04:11

Wil Shipley