Skip to content

Commit

Permalink
removed deprecated method usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Janusz committed Jun 2, 2022
1 parent 8f13eae commit e80bd41
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/org/jetbrains/plugins/hocon/semantics/ResolutionCtx.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package semantics
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.TextRange
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiElement
import com.intellij.psi.search.{FilenameIndex, GlobalSearchScope}
import com.intellij.psi.{PsiElement, PsiManager}
import org.jetbrains.plugins.hocon.psi._
import org.jetbrains.plugins.hocon.ref.IncludedFileReferenceSet
import org.jetbrains.plugins.hocon.semantics.SubstitutionKind.SelfReferential
Expand Down Expand Up @@ -222,9 +222,11 @@ object ToplevelCtx {
final val ApplicationResource = "application.conf"

def resolveResource(project: Project, scope: GlobalSearchScope, resource: String): Vector[HoconPsiFile] = {
val psiManager = PsiManager.getInstance(project)
val rootDirs = IncludedFileReferenceSet.classpathPackageDirs(project, scope, "")
FilenameIndex.getFilesByName(project, resource, scope)
.iterator.collectOnly[HoconPsiFile].filter(f => rootDirs.contains(f.getParent))
FilenameIndex.getVirtualFilesByName(resource, scope)
.iterator.asScala.map(psiManager.findFile)
.collectOnly[HoconPsiFile].filter(f => rootDirs.contains(f.getParent))
.toVector.sortBy(_.getVirtualFile.getPath)
}

Expand Down

0 comments on commit e80bd41

Please sign in to comment.