Open OliverJAsh opened 6 years ago
Find all refs on the module path should show you all imports to it:
Is that not sufficient for your scenarios?
I'm after the opposite—to find all imports for the currently focused module. E.g.:
// a.ts
// "find imports" used in this module will list the imports in `b.ts` and `c.ts`
export const foo = 'bar';
// b.ts
import('./a');
// c.ts
import './a';
I see.. I suppose we can expose this on the export
keyword. though it is kinda weird.. possibly another command on the server..
@andy-ms, @amcasey and @DanielRosenwasser thoughts?
@OliverJAsh to confirm, you're not looking for consumers of foo
, you're looking for consumers of a.ts
?
That's right
On Wed, 7 Mar 2018, 22:27 Andrew Casey, notifications@github.com wrote:
@OliverJAsh https://github.com/oliverjash to confirm, you're not looking for consumers of foo, you're looking for consumers of a.ts?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/TypeScript/issues/22374#issuecomment-371307222, or mute the thread https://github.com/notifications/unsubscribe-auth/AA4QCWKI5foGTNg543095IQbHt6XsMphks5tcF54gaJpZM4Sgc09 .
@mhegazy I agree that it's not clear how we would trigger such a search. Personally, I would expect invoking Find All References on the export
keyword to list references to that exported symbol.
Personally, I would expect invoking Find All References on the export keyword to list references to that exported symbol.
yeah.. then a new command is needed, but it wounder if that will be discoverable.
Find references is a very useful feature, however sometimes I need to be able to find all imports of a given module:
This is sometimes necessary when a module has side effects, and you want to see which files imported it.
This might also be useful for dynamic imports. In one project we have several dynamic imports (for code splitting) that never explicitly reference the module exports, so if I use find references on those module exports, I will not be shown the dynamic import. For example, here is a dynamic import:
When I activate find references on the exports of that module, I am not shown the import: