Searching for index.js files

While using quick navigation/search It would be great if index.js files nested directly under a directory matching the query were considered matches.

 

Example:

While working on a project with the following following directory structure:

/actions/index.js

Currently a search for "actions" returns no matches. Instead it would be helpful if a search for "actions" would pull up actions/index.js as a match.

 

If this is possible already by tweaking something let me know.

Thanks!

 

13 comments
Comment actions Permalink

Hi there,

If you are searching for a folder, then you have to specify this nuance with using `/` ... because "Navigate | File" searches for files and not folders (as name suggests)

So .. "act/in" or just "act/" might be enough (depends on how many folders starting with "act" you have in your project) to show you the files from such folders.

0
Comment actions Permalink

Hi Andriy,

Yes I'm aware but unfortunately when including the `/` and then pressing return the file navigator opens up and displays the directory (as it should) instead of just opening the index.js file in the editor. To open the index.js file you need to also start typing `index` after the `/`.

Thanks for the info though!

Brent

1
Comment actions Permalink

I would also be useful if import actions from './actions' would actually resolve index.js file if it exists. 

5
Comment actions Permalink

It would be great if something like Igor suggested existed. Even more so if you could customize the file name pattern. I personally tend to use build plugins that allow me to write only the directory name and the 'default' file is imported. 

Such as import actions from './actions' with the full path actually being './actions/actions.js'. It reduces unnecessary boiler plate code. 

0
Comment actions Permalink

>It would be great if something like Igor suggested existed.

 

Directory imports (like import actions from './actions') are correctly resolved, WebStorm jumps to appropriate code in index.js

0
Comment actions Permalink

I tried the latest IU 2017.1 EAP with TypeScript. index.ts imports are not being resolved.

Is there a related bug / feature for it?

 

0
Comment actions Permalink

No, it's not an issue I'm aware of. Please make sure you have the latest compatible NodeJS plugin installed. If it doesn't help, please provide a project plus steps to repeat

0
Comment actions Permalink

In VSCode, my colleagues can easily find a file named "index.js" in "Container" folder because it also searches on the file path.

With IntelliJ, I can only find the folder, press Enter (which opens the folder in the Project's structure on the left), and I have to click on the file to open it.

The behavior works with Ctrl + Alt + Shift + N, but it would be great to have the same on Ctrl + Shift + N

0
Comment actions Permalink

With Navigate > File (Ctrl + Shift + N), the IDE searches for a file throughout the project, so the files in subfolders are also found:

if this doesn't work for you, try invalidating caches

0
Comment actions Permalink

We're not asking to find an index.js file while searching for "index.js" but by searching for his folder name.

In standard Javascript projects, there can be 50 files named index.js, and it's a common usage of it.

This is why it could be great to be able to search for "Container" for instance, and see the "index.js" file which is in the "Container" folder

1
Comment actions Permalink

I'd like to bring this up again - specifically within the context of lookups of any kind, knowing that the file is an `index.ts` without any other information can be a frustrating experience for many. A situation I encounter often when trying to see how many kinds and types of usages a particular export has, I'm met with something like this:
It would be super helpful if the option of "including directory names for non-unique filenames' that is available under editor tab appearance was carried over here as well.

 

0
Comment actions Permalink

I think this issue matches Brent's original request https://youtrack.jetbrains.com/issue/WEB-24112/Navigate-File-match-by-directory-with-indexjs
(there might be other duplicates, but I can't figure out how to search an issue on YouTrack)

And as I commented on it, it would be nice to be able to search for mod.rs files by their directories too.

0

Please sign in to leave a comment.