Ignore a folder in search results

Eric Francis picture Eric Francis · Mar 12, 2015 · Viewed 49.3k times · Source

I'm searching for a string and getting matches in a source folder, and a build folder (file in source gets copied to build during build).

I do not need the build folder result.

Vim has wildignore which helps filter out results.

Is there something similar in intelij?

Answer

Darek Kay picture Darek Kay · Mar 12, 2015

Mark your build folder as excluded:

File > Project Structure > Modules > Sources > Mark as Excluded (red icon)

You can also just right click on your folder and select Mark Directory As > Excluded.

Excluded folders (shown as rootExcluded) are ones that IntelliJ IDEA "partially ignores". Very limited coding assistance is provided for files in excluded folders. Classes contained in excluded folders don't appear in code completion suggestion lists, references to such classes are shown in the editor as unresolved. When searching, IntelliJ IDEA doesn't look in excluded folders, etc.

Source

Note: See the answer by Nader Hadji Ghanbari for another approach using Scopes.