Search code examples
javascriptjavaeclipseatom-editor

Ctrl+Click on a function name in Atom editor and jump into it


I've been trying to think of a better way to title this question, but unfortunately I have no idea how to explain it. Also I haven't found this on stack overflow (for the same reason stated above).

In Eclipse, I used to Ctrl+Click in the name of a method call (in java). And my cursor would jump in to the definition of my method function.

Question 1: Does anyone know the name of this behavior? I mean, maybe it's called function jumping or something like that.

Also I was searching for a plugin like this in Atom editor. Because I've tried to use this a lot of times (bad habits) and didn't work.

Question 2: Name of the plugin to do this in Atom?

Don't know if it helps, but I'm coding in JavaScript at the moment in Atom editor.


Solution

  • As the other answer noted, alt-click over a method/function name can jump you directly to where it was originally defined. It works within the same file, but it doesn't seem to work across files.

    The closest Atom editor package I've found for javascript which allows you to jump to function/method definitions across files is called TernJS.

    Once installed, you can use ctrl-shift-r over the word (function/method, variable etc) to bring up a list of where that method/function is defined (includes line # & filepath). You can then click on the list item & it will jump you to the definition.

    Here is a video I made containing an example of using this atom package. http://www.youtube.com/watch?v=cFAzqvYoHJs&t=11m58s