[TxMt] POLL: Objective-C CodeSense?
Joachim Mårtensson
joachimm at etek.chalmers.se
Wed Aug 8 15:00:23 UTC 2007
A.K.A. Objective-c Annotation project,
I have started to think how I can improve the objective-c code completion,
adding additional context sensitive suggestions. Currently there are only
context sensitive suggestions for a limited set of operations inside an
Objective-C method call context.
What I would like is for constructs such as:
returnCode == NSOKButt[caret]
to be context sensitive as well, the problem is that just looking at the
type of returnCode is not going to work since it is most probably an int,
of which there are hundreds in Cocoa (counting functions that return int
and constants).
So my thinking is that using a regexp I can gather statistics from various
open-source project and make educated guesses as to what a more "detailed"
type would be, thereby being able to provide better suggestions.
for example:
-(void)openPanelDidEnd:(NSOpenPanel*)panel returnCode:(int)returnCode
contextInfo:(void*)contextInfo
{
if (returnCode == NSOKButton)
}
I would parse out the method header, the argument names + the method part
they were connected to, and then do a regexp search in the body of that
method that would check if any of the arguments are compared/assigned
against a constant/function declared in the cocoa headers. Check if this
constant/function is of a more specific type (in reality a cocoa typedef
enum).
if so add this method to a file of special cased code completions (and
ofcourse enough information to deduce what special treatment that would
be).
So now to my question to you fellow TextMate using Objective-C users:
Do you think this will help you in your coding or will it get in your way?
Have I overlooked something that makes this not viable?
Should I instead provide a special nib with a giant talking paper clip?
Thanks in Advance
Joachim Mårtensson
More information about the textmate
mailing list