Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support finding references at module in module.exports = or export in export = #28221

Merged
2 commits merged into from
Nov 9, 2018

Conversation

ghost
Copy link

@ghost ghost commented Oct 29, 2018

verify.singleReferenceGroup('import j = require("./j.json")', [r0, r2]);
verify.referenceGroups([r1, r4], [{ definition: 'module "/j"', ranges: [r1, r4, r6] }]);
verify.singleReferenceGroup('const j: {\n "x": number;\n}', [r3, r5]);
verify.referenceGroups(r6, undefined);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also show:: require("[|./j.json|]"); just like we are doing at export=

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this trigger on the open brace of the json file? I don't want to just trigger it everywhere since people may be looking for references to a particular property instead.
But vscode at least doesn't use TypeScript to provide services in json files, so this wouldn't work anyway ... we can still get references when starting from a TS file though.

@ghost
Copy link
Author

ghost commented Nov 9, 2018

@sheetalkamat Please re-review

@ghost ghost merged commit aaf1d80 into master Nov 9, 2018
@ghost ghost deleted the findAllRefsModuleDotExports branch November 9, 2018 17:38
@vschoener
Copy link

Hey guys, trying to use a find occurrences/usages/references but it only shows me the usage in the same file, not elsewhere. How do make it works?

@rubengmurray
Copy link

rubengmurray commented Jul 11, 2019

Hey guys, trying to use a find occurrences/usages/references but it only shows me the usage in the same file, not elsewhere. How do make it works?

Agreed, all I'm seeing is same-file references too.

e.g. const function1 = () => {} defined in events.js is referenced in index.js (to be called on an API call). Clicking Find All References on function1 in events.js does not list the reference in index.js.

@vschoener
Copy link

Just got into this issue again from an old project using this kind of syntax:

const object = {
 methode: (),
 other: ()
}
module.exports = object;
// Or even this one
const object = {
 KEY1: 'dfdfd',
KEY2: 'sdddf'
}

module.exports = object;

In intellj, this kind of find usage is able to track which other file is using the export, that would be nice to have a way to track which file use the export :)

@marcospgp
Copy link

This problem still exists: #44832

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

“Find All References” across files for a method/function in javascript
4 participants