aboutsummaryrefslogtreecommitdiff
path: root/.live-plugins
diff options
context:
space:
mode:
authorEmpa <42304516+ItsEmpa@users.noreply.github.com>2024-10-12 21:27:39 +0200
committerGitHub <noreply@github.com>2024-10-12 21:27:39 +0200
commit37a06d12289f76ee01903454bf47d4a2b9538934 (patch)
tree9984ad31bfe605a6e25bf4b46ed46117ba037dce /.live-plugins
parent015352cdc9913a60c544433df1992b5f0e7b7723 (diff)
downloadskyhanni-37a06d12289f76ee01903454bf47d4a2b9538934.tar.gz
skyhanni-37a06d12289f76ee01903454bf47d4a2b9538934.tar.bz2
skyhanni-37a06d12289f76ee01903454bf47d4a2b9538934.zip
Backend fix: Module Inspection (#2728)
Co-authored-by: Empa <itsempa@users.noreply.github.com>
Diffstat (limited to '.live-plugins')
-rw-r--r--.live-plugins/module/plugin.kts7
1 files changed, 7 insertions, 0 deletions
diff --git a/.live-plugins/module/plugin.kts b/.live-plugins/module/plugin.kts
index c0a65d3f4..f7471e9fd 100644
--- a/.live-plugins/module/plugin.kts
+++ b/.live-plugins/module/plugin.kts
@@ -18,6 +18,7 @@ val forgeEvent = "SubscribeEvent"
val handleEvent = "HandleEvent"
val skyHanniModule = "SkyHanniModule"
+val skyhanniPath = "at.hannibal2.skyhanni"
val patternGroup = "at.hannibal2.skyhanni.utils.repopatterns.RepoPatternGroup"
val pattern = "java.util.regex.Pattern"
@@ -36,12 +37,17 @@ fun isRepoPattern(property: KtProperty): Boolean {
return false
}
+fun isFromSkyhanni(declaration: KtNamedDeclaration): Boolean {
+ return declaration.fqName?.asString()?.startsWith(skyhanniPath) ?: false
+}
+
class ModuleInspectionKotlin : AbstractKotlinInspection() {
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
val visitor = object : KtVisitorVoid() {
override fun visitClass(klass: KtClass) {
+ if (!isFromSkyhanni(klass)) return
val hasAnnotation = klass.annotationEntries.any { it.shortName?.asString() == skyHanniModule }
if (hasAnnotation) {
@@ -54,6 +60,7 @@ class ModuleInspectionKotlin : AbstractKotlinInspection() {
}
override fun visitObjectDeclaration(declaration: KtObjectDeclaration) {
+ if (!isFromSkyhanni(declaration)) return
val hasAnnotation = declaration.annotationEntries.any { it.shortName?.asString() == skyHanniModule }
if (hasAnnotation) return