From 30dad7999167ad46814fb7356204ba572447bdea Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 29 Nov 2025 08:04:06 +0100 Subject: [PATCH] fix: skip built-in attributes so the IDE can resolve the symbols Skips reference creation for built-in attributes --- .../com/github/tempest/framework/TempestFrameworkUtil.kt | 8 ++++++++ .../views/references/ComponentReferenceContributor.kt | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/main/kotlin/com/github/tempest/framework/TempestFrameworkUtil.kt b/src/main/kotlin/com/github/tempest/framework/TempestFrameworkUtil.kt index 9d41b6c..8a0349d 100644 --- a/src/main/kotlin/com/github/tempest/framework/TempestFrameworkUtil.kt +++ b/src/main/kotlin/com/github/tempest/framework/TempestFrameworkUtil.kt @@ -3,4 +3,12 @@ package com.github.tempest.framework object TempestFrameworkUtil { const val TEMPLATE_SUFFIX = ".view.php" const val COMPONENT_NAME_PREFIX = "x-" + + val BUILT_IN_DIRECTIVE_ATTRIBUTES = setOf( + ":if", + ":elseif", + ":else", + ":foreach", + ":forelse", + ) } \ No newline at end of file diff --git a/src/main/kotlin/com/github/tempest/framework/views/references/ComponentReferenceContributor.kt b/src/main/kotlin/com/github/tempest/framework/views/references/ComponentReferenceContributor.kt index af39b8b..d7c9078 100644 --- a/src/main/kotlin/com/github/tempest/framework/views/references/ComponentReferenceContributor.kt +++ b/src/main/kotlin/com/github/tempest/framework/views/references/ComponentReferenceContributor.kt @@ -75,6 +75,10 @@ class ComponentReferenceContributor : PsiReferenceContributor() { val attribute = element as? XmlAttribute ?: return emptyArray() val htmlTag = attribute.parent as? HtmlTag ?: return emptyArray() + if (attribute.name in TempestFrameworkUtil.BUILT_IN_DIRECTIVE_ATTRIBUTES) { + return emptyArray() + } + return arrayOf(TempestAttributeReference(element, htmlTag)) // .apply { println("found references for ${element} ${this.joinToString { it.toString() }}") } }