Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternatives to Ctags/Cscope with Objective-c?

Are there any alternatives to ctags and cscope with Objective-c support. This does pertain to cocoa development, so inevitably it seems I will be using Xcode (and probably should). I was just wondering what are my Vim options.

Maybe there is some type of plugin system like eclim, but for xcode?

EDIT

So it seems that other than updating ctags to support objective-c, I'm out of luck. Does anyone know if cscope is the same?

like image 480
esiegel Avatar asked Jun 03 '10 17:06

esiegel


2 Answers

a long time after this question, "playing" with vim, I wanted ObjC support, especially with taglist plugin. I found that question, then digged a bit, and here is a not so dirty solution:

  1. An ObjectiveC parser has been added to Exuberant CTags trunk, it is not released (yet?)
  2. You can easily install it on OSX via homebrew:

    $ brew install ctags --HEAD

  3. Note that when using ctags, .m is treated as Matlab and .h is treated as C++. To override, use:

    $ ctags --langmap=ObjectiveC:.m.h

  4. Then I added something like this to my .vimrc for taglist support:

    let tlist_objc_settings = 'ObjectiveC;P:protocols;i:interfaces;types(...)'

    add any type interests you from that list:

    ctags --list-kinds=all
    ObjectiveC
        i  class interface
        I  class implementation
        p  Protocol
        m  Object's method
        c  Class' method
        v  Global variable
        F  Object field
        f  A function
        p  A property
        t  A type alias
        s  A type structure
        e  An enumeration
        M  A preprocessor macro
    

I hope that will help someone!

like image 146
Vincent Guerci Avatar answered Sep 24 '22 04:09

Vincent Guerci


Universal-ctags(https://ctags.io) can capture properties of Objective-C.

[jet@localhost objectivec_property.h.d]$ cat input.h 

@interface Person : NSObject {
    @public
        NSString *m_name;
    @private
        int m_age;
}

@property(copy) NSString *personName;
@property(readonly) int personAge;

-(id)initWithAge:(int)age;
@end
[jet@localhost objectivec_property.h.d]$ ../../../ctags -x -o - input.h 
Person           interface     2 input.h          @interface Person : NSObject {
initWithAge:     method       12 input.h          -(id)initWithAge:(int)age;
m_age            field         6 input.h          int m_age;
m_name           field         4 input.h          NSString *m_name;
personAge        property     10 input.h          @property(readonly) int personAge;
personName       property      9 input.h          @property(copy) NSString *personName;
like image 3
Masatake YAMATO Avatar answered Sep 22 '22 04:09

Masatake YAMATO