up vote 1 down vote favorite
share [g+] share [fb]

Many modern IDEs provide the ability to jump to the function declaration by using a simple shortcut or special mouse click on a function call. This is the one thing that stops TextMate from being my one IDE to rule them all.

So far I find TextMate great for web development and scripting, but doing large scale C++ or Java development on it can feel a little handicapped.

link|improve this question
feedback

3 Answers

up vote 0 down vote accepted

Here's how to do it in TextMate (from Google cache):

Many IDEs have the capability to 'jump' to a function declaration within the project you are working in. This is how to do it in TextMate. Assuming you understand bundles the Bash script below should be placed in a Command with output set to Show As Tool Tip, then finally picking the key combination you want.

Once ready simply press the key combination while the Caret is placed over your function. The script below will iterate through PHP related files look for the declaration, then opening a TextMate document at the proper line. When this script fails a tooltip mention so will be displayed.

FUNC="$TM_CURRENT_WORD"
DIR="$TM_PROJECT_DIRECTORY"
OUTPUT=''

FILES=(`find "$DIR" -type f | egrep '\.(module|inc|php|engine|install)$'`)

#
# Look for a function declaration within a files contents.
#
# <file> <function>
#
function lookup_function {
  local line=`nl -b a "$1" | grep 'function '"$2"'(' | awk '{print $1}'`
  if [[ "$line" -gt 0 ]]; then
    mate "$1" -l "$line"
    exit 0
  fi
}

# Iterate files
for (( i=0; i < ${#FILES[*]}; i++)); do
  file="${FILES[${i}]}"
  lookup_function "$file" "$FUNC"
done

# Nothing found
echo 'Function '${FUNC}' was not found within the current project.'

Also, Check this out:

http://www.cocoabits.com/TmCodeBrowser/

link|improve this answer
feedback

While TextMate has lexical formatting (bolding, italics, coloring, etc.) it doesn't have a true grasp of the actual code which you are typing in it. In order to do more complicated things like you are wanting, TextMate would need to do another type of analysis in addition to the formatting which is getting closer to a compiler.
From what I know TextMate doesn't support this functionality right now.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.