From 1e62e325d53d88b6c38886ee2e86bf6735990e80 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Mon, 18 Mar 2024 23:22:30 -0500 Subject: [PATCH] chore: return file type on psi file --- .../spp/jetbrains/artifact/service/ArtifactTypeService.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/kotlin/spp/jetbrains/artifact/service/ArtifactTypeService.kt b/core/src/main/kotlin/spp/jetbrains/artifact/service/ArtifactTypeService.kt index daf27d58a..61c8b8edd 100644 --- a/core/src/main/kotlin/spp/jetbrains/artifact/service/ArtifactTypeService.kt +++ b/core/src/main/kotlin/spp/jetbrains/artifact/service/ArtifactTypeService.kt @@ -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 @@ -52,6 +53,10 @@ object ArtifactTypeService : AbstractSourceMarkerService() 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) }