Search file/directory pattern not working


#1

When searching a project, it is possible enter a file/directory pattern to scope the search. I have entered pattern js//.js***. This finds files successfully. Likewise, I can use tests//.js***. Yet, nothing is returned when I use pattern (js|tests)//.js***. I do not see anything obviously wrong with the latter. Help!


#2

Where Atom accepts file globs, it uses the minimatch library. It looks like +(js|tests)/**/*.js might work.


#3

Thanks. That worked.


#4

I am having this issue with atom 1.12.9.

So below does not work!
searching “mongoose” with node_modules/*/.js returns nothing.

However removing the wild cards as shown below returns the results with files ending with .js extension included

What am I missing here?

Thanks


#5

Because node_modules is in your Git ignore directives, the Find in Project feature normally skips the files under those directories. We do have a workaround for when the file or directory mentioned in the path box matches one of your Git ignore directives. This is why the second example works but not the first.


#6

So you are basically saying there is no way to make the first work, at least not this time?


#7

No, that isn’t what I said. From what I saw, you asked for an explanation of why the two behaved differently. I gave you the answer.

If you want the first to work as it would appear you expect, you can uncheck “Exclude VCS Ignored Paths” in the Settings View:

And then the first example should work the way you want.