Navigating to File by Name: Open file specific in root folder

Answered

Is there a way to specify, that I intend to open a file from the root folder of the module/project? In https://www.jetbrains.com/help/idea/navigating-to-class-file-or-symbol-by-name.html#tips you show a way to specify names of folders, but is there a way to tell the search it should be the root folder? I tried "/readme.md" or "~/readme.md" without luck.

Example: In our project we have a `Readme.md` in the root folder, which I need to open frequently. In the navigate to file dialog (cmd+shift+o), if type `readme` I will get a huge list of readme's located in the `node_modules` folder.

Alternative question: I am wondering why the result list is not sorted in a way that source files are placed before library files or content of folders marked as excluded? (I marked the folder `node_modules` as excluded)

1
4 comments
Avatar
Yaroslav Bedrov

Hello,

Works fine on my machine. Is it possible to provide idea.log ("Help | Show Log in...") after restarting IDE and reproducing the issue? You could use any online sharing service or our FTP:  ftp://ftp.intellij.net/.uploads/

By the way, you could try to use "readme/". It should limit search to root folder.

0
Avatar
Permanently deleted user

Hi Yaroslav,

thank you for your reply. I played a bit around and found out some fine, but important detail.

The filename is `README.md`. If I search in lowercase, intellij lists filenames in lower case, but if I search in uppercase (e.g. `README`), it will find the file and list it on top. Just to clarify: `readme/` will list only folders which contain `readme`.

Arguably it is a logic behavior, but I am not sure, if I really prefer this distinction and not opt for an case insensitive search..

Can you tell me, if there is an option to exclude folders (in my case the `node_modules`) from the "Navigate to file" dialog?

Thank you for your help!

1
Avatar
Yaroslav Bedrov

I couldn't reproduce the issue on my machine. Does it help if you run "File | Invalidate Caches..."? If it's possible please provide sample project example and idea.log file.

0
Avatar
Permanently deleted user

Can confirm that this is still an annoyance 2 years later, including after cache invalidation. Searching REA (case sensitive) works reliably but it does seem like if you don't match the case of your own README.md, the fuzzy searching no longer biases towards your root directory, and finds things in node_modules in whatever order it feels like. I feel like this is inconsistent behavior but at least there's a reliable workaround!

My ideal solution would be that if you have files favorited, they'll show up at the top of the order regardless of whether you have a case-sensitive match or not... but this could have edge cases I'm not foreseeing!

0

Please sign in to leave a comment.