How do I find links (or uses) in the Atom editor?
One of the most famous features of the IDE is that you know how to find references (or usages) to variables, functions, or classes in a project. I've tried Atom Atom) for a while. I still like it. But I couldn't find a way to access the references (or usages) of var / function or class in JavaScript code. Isn't this feature available in the Atom editor? I'll give two examples below.
a) In the following simple code, Atom does not accept "title" declarations. I am doing "Go to declaration" by right clicking on the word "title"
Template.docAddForm.events({
'submit .js-add-doc':function(event){
const title = event.target.doctitle.value; // The declaration of "title"
Session.set('docTitle', title); // Cannot access the declaration of "title" in Atom
}
});
Another example. I cannot access the declaration of the Users object , which is a collection declared in the imported "commons.js" in the following code.
import { Meteor } from 'meteor/meteor';
import {Users} from '../lib/commons.js';
/** PUBLICATIONS **/
Meteor.publish('users', function () {
return Users.find({}, {fields: {_id: 0}});
});
source to share
EDIT . For the goto package to work, you must generate a file .tags
at the root of your project. Include the symbol-gen
package to do this in Atom and then use it cmd-alt-g
to generate symbols. Then the shortcuts will fire goto
(and right click> Go to Declaration).
The goto package must be enabled by default to navigate to an instance of a variable.
cmd-r
- Go to file symbol
cmd-shift-r
- Go to project symbol
cmd-alt-down
- Go to declaration
As far as defining the use of variables, I believe it will depend on the language you are using. For example, atom-ternjs
will show you the use of a variable (and more) for JavaScript.
source to share