GlobalSearchScope (@NotNull GlobalSearchScope scope) { if (scope instanceof FileTypeRestrictionScope) { FileTypeRestrictionScope restrict = (FileTypeRestrictionScope)scope; if (restrict.myBaseScope == myBaseScope) { List<FileType> intersection = new ArrayList<>(Arrays.asList(restrict.myFileTypes)); intersection.retainAll(Arrays.asList(myFileTypes)); return new FileTypeRestrictionScope(myBaseScope, intersection.toArray(FileType.EMPTY_ARRAY)); } } return super.intersectWith(scope); }