You write `ide.sh FooBar` and it most likely opens what you are looking for:
1) Tries to open the path.
2) If it doesn't exist, it tries to open that file anywhere in the directory tree (provided it has some of the file name suffixes I currently use).
3) If not exists, it opens the files that contains a type of that name (class, function, interface).
4) If not found, it opens the files that contain given pattern.
This blog's source WYSIWYG is buggy so it's hard to edit, the up-to-date version is at gist.
## If the argument is a path to a file, open it.
if [ -f "$1" ] ; then
## Else if it's a path in a form of foo*bar (contains a star), open all that match, of types .java, .ts, .html, .xml, .ftl
elif expr "$1" : ".*\*.*" ; then
find . -path "./*/target/*" -prune -o \( -name "*$1*".java -o -name "*$1*".ts -o -name "*$1*".html -o -name "*$1*".xml -o -name "*$1*".ftl \) -print | xargs $NB
## Else if there's a TypeScript class of that name, open it.
git grep -q -E "(class|function) +$1"
elif [ $? ] ; then
git grep -l -E "(class|function) +$1" | head -n $MAX_FILES_TO_OPEN | xargs "$NB"
## Else open whatever matches the given pattern.
COUNT=`git grep -l "$1" | wc -l`
if [[ "$COUNT" -gt "$MAX_FILES_TO_OPEN" ]] ; then echo "Too many `git grep` matches, taking first $MAX_FILES_TO_OPEN."; fi
git grep -l "$1" | head -n $MAX_FILES_TO_OPEN | xargs "$NB"