Under the root of the content you can
-Include the source folders (folders containing the com package) with the blue folder button.
-Disable folders with red folder. It will completely delete files from intellij eyes. Not just for the java compiler.
-If this is not enough, you have / setting / compiler / exclude, where you can exclude packages or files individually, but only for the eyes of the compiler. You can quickly add a file to these exceptions by right-clicking on a java compilation error. It can also work for compilers other than java.
source share