[TxMt] Searching for Objective-C documentation

Dave Baldwin dave.baldwin at 3dlabs.com
Wed Apr 16 12:16:19 UTC 2008


The current Documentation for Word /  Selection and Documentation for  
Selector in the Objective-C bundle doesn't find a many of the classes  
and selectors for lots of things now in Leopard (CAAnimation, for  
example) or in the iPhone SDK.

Having looked at the existing implementations of these commands I  
decided it would be easier to replace them rather than hack what was  
there already.  My implementation of these commands uses an Apple  
supplied tool (docsetutil) to search for the word, etc. in the docsets  
so don't need any private index lists to find words quickly.  This has  
the big advantage that the index is always up to date and covers every  
framework.  The code is a lot simpler as well.

The only downside I can see is this may only work with Leopard - I  
don't know and don't have any easy way of finding if it works with  
Tiger.  I didn't work through all the ramifications of the original  
selector identification code so it is possible my version has some  
holes - I have tried it with lots of examples and it seems to work,  
but if any problem cases are discovered I will be pleased to fix them.

To install this version copy the enclosed ruby file to /Applications/ 
TextMate.app/Contents/SharedSupport/Support/lib/ directory and edit  
the two commands (or make two new commands) as follows:


Documentation for Word:

#!/usr/bin/env ruby

require ENV['TM_SUPPORT_PATH'] + '/lib/docset_query'
documentation_for_word

with input, output and scope selector as per the original.  Will show  
a list of candidates if more than one and also prefix them with the  
language if more than one is present (hint try selecting init outside  
of a [ ].



Documentation for Selector:

#!/usr/bin/env ruby

require ENV['TM_SUPPORT_PATH'] + '/lib/docset_query'
documentation_for_selector

with input set to "Entire Document", output "Show as Tool Tip" and  
scope selector as per the original.


If there is interest in absorbing this work into the official  
distribution that is fine by me and I hope I haven't committed any  
sins in where the helper file is stored.

Dave.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: docset_query.rb
Type: text/x-ruby-script
Size: 4804 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20080416/06674cd8/attachment.rb>
-------------- next part --------------





More information about the textmate mailing list