Sublime: Quickly check where file is used?

Viewed 239

I often find myself needing to check where a file is used in my node project (which other file imports it). What I'm doing now is right clicking on the editor showing my file, copying the file path, then doing a grep on my whole project using the filename. In this manner I'm able to 'walk up' the dependency tree.

However, I'm wondering if it'd be possible to make a shortcut for this sort of thing. Does anybody know if that's viable?

2 Answers
  1. Include your node project root directory to a sublime project with Project / Add Folder To Project...

  2. Right-click on the project directory in the sidebar, then select "Find in Folder..." from the context menu.

  3. Enable Regular expression

  4. Find: import.*filename

  5. click on Find

filename must be replaced with the actual name. The search pattern can be further refined to match module names from 'filenames', for example. You will end up with a search buffer that lets you jump to each file for that a match has been found.

find imports

Maybe Find In Files , Activate with ctrl + shift + F

Related