[TxMt] Script to look up selected MacOS API
Ryan Wilcox
ryanwilcox at mac.com
Wed Jul 12 03:04:45 UTC 2006
Hello all,
I'm starting to set up my environment to use TextMate instead of XCode's built in editor.
The one thing I miss from XCode is its Code Sense. I really like having a quick reference of the API command I want. I know I want, say, to use CFBundleCopyResourceURL(), but I don't remember what to feed it.
Since XCode doesn't provide a way to query for that information (thanks, Apple), I had to get it "another way". It seems that the easiest way to do that is to grep the framework header files myself.
My script takes the selected word, finds it in the 10.4u SDKs, then makes a txmt:// style URL out of it, so you can click the link and go right to the proper line in the proper header file.
The script is posted below. Hopefully it will be useful to you Carbon programmers out there, or maybe the kind Unix hands will see some optimization I can use to make it faster.
_______________________________
find -L /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/*/Versions/Current/* | xargs grep -I -n $TM_SELECTED_TEXT | python -c "import fileinput, re
ourRe = re.compile(r'(.+?):(.+?):(.+)')
for each in fileinput.input(['-']):
res = ourRe.match(each)
if res:
print '''<p><a href='txmt://open/?url=file://%s&line=%s'>%s</a></p>''' % ( res.group(1), res.group(2), res.group(3) )"
_______________________________
Enjoy all!,
_Ryan Wilcox
--
Wilcox Development Solutions: <http://www.wilcoxd.com>
Toolsmiths for the Internet Age PGP: 0x2F4E9C31
More information about the textmate
mailing list