Skip to content

Commit

Permalink
chore: return file type on psi file
Browse files Browse the repository at this point in the history
  • Loading branch information
BFergerson committed Mar 19, 2024
1 parent ce68ffe commit 1e62e32
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package spp.jetbrains.artifact.service

import com.intellij.psi.PsiComment
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import spp.jetbrains.artifact.model.FunctionArtifact
import spp.jetbrains.artifact.service.define.AbstractSourceMarkerService
import spp.jetbrains.artifact.service.define.IArtifactTypeService
Expand Down Expand Up @@ -52,6 +53,10 @@ object ArtifactTypeService : AbstractSourceMarkerService<IArtifactTypeService>()

override fun getType(element: PsiElement): ArtifactType? {
if (!isSupported(element)) return null
//language-agnostic check
if (element is PsiFile) return ArtifactType.FILE

//language-specific check
return getService(element.language).getType(element)
}

Expand Down

0 comments on commit 1e62e32

Please sign in to comment.