[TxMt] Help and input requested for objective-c (cocoa) code completion and definition lookup

Joachim Mårtensson joachimm at etek.chalmers.se
Sat Oct 28 12:56:19 UTC 2006


Hello, everyone.
As you may know I have written a basic code completion system and
documentation-lookup command for TextMate(^M and^H). I have also finished
a definition look up system for Cocoa(suggestion for key-trigger
appreciated).
        The solution I have used is to look up every method in a gzipped
list and
accessing it from ruby via the shell command zgrep. Since I want the
system to work with more than just cocoa I thought I tell anyone
interrested so that they can give me their opinions. Currently the list
is formatted in the following way:

[methodName][tab][framework][tab][behavior][tab][Class][tab][methodtype][tab][returnType]([tab][arg])[newline]

ofcourse if there are more args, then the parenthesis is repeated, and if
there is no arg the whole parenthesis is omitted. hopefully the following
ruby dict explains the various abbreviations.
{:AppKit => "AK",
:CoreData => "CD",
:CoreImage => "CI",
:Foundation => "F",
:instancemethods=> "im",
:classmethods => "cm",
:classes=> "Cl",
:protocols => "Pr",
:delegatemethods => "dm",
:notifications => "no"}

behaviours are either classes or protocols, methodtypes are either
instancemethods delegatemethods notifications or classmethods.

displayMode        AK        Cl        NSToolbar        im               
NSToolbarDisplayMode
propertyForKey:        F        Cl        NSStream        im              
 id        NSString *
textUnfilteredFileTypes        F        Cl        NSAttributedString      
 cm                NSArray *
textUnfilteredPasteboardTypes        F        Cl        NSAttributedString
       cm                NSArray *
textView:clickedOnLink:atIndex:        AK        Cl        NSTextView     
  dm        BOOL        NSTextView
*        id        unsigned

when looking up methods for completion and documentation this is all the
information I need for my uses. The problem comes when doing declaration
lookup, since not all classes are declared in a file with the same name
and there are categories and so on. Currently I am using an xml dump from
AppKido converted into a ruby dict using crazy gsub commands.
Unfortunately the appkido parser is a little wacky, so I thought that I
would ask the list for help.
        What is needed is a file or a script that generates the file
according to
the spec above, but when a method is declared in a file that does not
correspond to the class name, the filename should be written after the
Class using a separator that is not a tab (; perhaps).
        If anyone see a problem coming up with this approach please say
so, if
you have any other critisism feel free to add it. Hopefully this layout
contains enough parameters should someone want to write completion and
lookup commands for pyobjc or rubycocoa. Perhaps it would be smart to
come up with a name for an index file, containing your own indexed
methods, that will be automatically picked up by the various completion
and look-up tmCommands.

Joachim Mårtensson




More information about the textmate mailing list