Hi!
How do I navigate from a method call to the declaration of said method?
In xCode I would command-double-click the method call.
BTW, I am new to the list and am just re-discovering TextMate. I had looked at it once before. At that time it lacked the one key feature for me: code completion. Now it is a killer app!
Pierre
--- Pierre Bernard http://www.bernard-web.com/pierre http://www.houdah.com
On 2/10/2006, at 22:01, Pierre Bernard wrote:
How do I navigate from a method call to the declaration of said method?
There is no such default functionality.
There is a CTags bundle, but I am almost certain that it does not support Objective-C, so I am afraid this would only be possible by writing your own command for this (using either find + grep or some indexing system).
That's odd. It's a feature I use extensively in both xCode and Eclipse. I would have figured many developers to rely on that.
I am just getting started with TextMate. I don't know yet what is needed to write my own command.
There are however a few features that should be closely related: - ctrl-H for documentation lookup must be able to parse the current selection so it knows where to head in the documentation - the code browser bundle knows how to parse a source file and jump to selected methods
I guess what I am after a combination of figuring out what's selected and jumping to the appropriate declaration in the .h file.
Pierre
On Oct 3, 2006, at 2:34 PM, Allan Odgaard wrote:
- - - Houdah Software s. à r. l. http://www.houdah.com - Quality Mac OS X software - Premium WebObjects consulting
On 3. Oct 2006, at 20:54, Pierre Bernard wrote:
When you run a command you can access both current selection and current word/line/etc. as environment variables (and you can also get it from stdin).
So this is pretty easy, e.g. if the header is in the same directory, and you do not have a space after the return type and name of the function, you could likely find it using:
grep -n ")${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}" *.h
If e.g. I have my caret on the ‘stringByDeletingPathExtensions’ word and run that command, the result is:
CocoaExtensions.h:63:- (NSString*)stringByDeletingPathExtensions;
So this gives file name + line number of match. If you do this from a scripting language (instead of bash) it should be easy to parse that line. You can use the mate shell command to then open ‘--line 63 CocoaExtensions.h’.
A twist is that Objective-C method names are actually split in multiple parts, so to be more robust you would need to merge that -- in the Objective-C bundle there is a (Format) Method Call command. This has ‘meta.bracketed.objc’ set as scope selector and as input it takes ‘Current Scope’ -- the ‘meta.bracketed.objc’-scope refers to stuff inside brackets (see about Scope Selectors in the manual).
The command will then need to parse out the actual method name from this.