Wednesday, December 10, 2008

Searching Through Code

I commonly need to search through a code base to find a definition of some constant or function that I have come across.  I don't have a Visual Studio Project setup, so I can't just right click on a symbol and have it show me the definition.

For about six months I had resorted to using 'find' and 'grep' for this task.  This approach had a some pleasure in it.  I was grinding out regular expressions maybe 12 times a day and I love regular expressions.

Just recently I found a tool called 'ack'.  This tool is great because it packages up the find ... -exec  grep command nicely and gives me nice looking, well formatted results.  I'm still missing something though.  One example is to be able to return the names of functions that use the constant or call the function that I'm interested in.

1 comment:

Andy Lester said...

You're not the first one to ask for that. Feel free to make a request at http://code.google.com/p/ack/issues/list for that. I think it would be a great addition.