# Locate definition

Not rarely when developing a larger project using JavaScript, the class definitions are stored in separate files. This is done to keep the code cleaner, and to allow reusing the classes. When creating a new instance of a class and using its methods in a different file, after adding the method name, you can use the Open declaration command to load the file containing the class, and display the selected method's definition.

To access the Open declaration command, right-click on a function name and notice the certain entry in the contextual menu. Alternatively, with the cursor placed inside the method/function name, press the F3 key.

Caution: In order for JavaScript classes to be processed correctly by JSEclipse, and for the Open Declaration command to work, you must name the file containing the class definition as the class (identical names). Thus, if defining the Person class, it will be stored in the Person.js file. Furthermore, the file where the class's methods are used must be in the same project as the class definition file.

As an example, consider that the class Person is defined in the file Person.js. It has the following methods: eat, sleep, exercise:

In the file city.js, you create a new instance of the Person class: citizen = new Person("name","age");

Then, a method will be used - let's say sleep: citizen.growOlder.

In order to see the actual method definition, right-click the growOldertext and select Open Declaration.

The Person.js file will be opened, and the editor's cursor is placed at the growOlder method's definition.

If you hit F3 with the mouse cursor over a word with multiple occurrences, all the instances are highlighted. This helps finding for example where a function is used.