in src/main/kotlin/mobi/hsz/idea/gitignore/util/MatcherUtil.kt [77:90]
fun getFilesForPattern(project: Project, pattern: Pattern): Collection<VirtualFile> {
val parts = getParts(pattern).ifEmpty { return emptyList() }
val projectFileIndex = ProjectRootManager.getInstance(project).fileIndex
val files = mutableSetOf<VirtualFile>()
projectFileIndex.iterateContent { file ->
if (file.isValid && matchAnyPart(parts, file.name) && matchAllParts(parts, file.path)) {
files.add(file)
}
true
}
return files
}