Skip to content

Commit ece0f86

Browse files
committed
feat: suppress html tags errors
1 parent e025b06 commit ece0f86

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.github.tempest.framework.views
2+
3+
import com.github.tempest.framework.TempestFrameworkUtil
4+
import com.intellij.codeInspection.XmlInspectionSuppressor
5+
import com.intellij.psi.PsiElement
6+
import com.intellij.psi.html.HtmlTag
7+
import com.intellij.psi.util.elementType
8+
import com.intellij.psi.xml.XmlTokenType
9+
10+
class TempestComponentsInspectionSuppressor : XmlInspectionSuppressor() {
11+
override fun isSuppressedFor(element: PsiElement, toolId: String) = when {
12+
element.elementType == XmlTokenType.XML_NAME -> isTagSuppressed(element.text, toolId)
13+
element is HtmlTag -> isTagSuppressed(element.name, toolId)
14+
else -> false
15+
}
16+
17+
private fun isTagSuppressed(tagName: String, toolId: String): Boolean {
18+
return tagName.startsWith(TempestFrameworkUtil.COMPONENT_NAME_PREFIX)
19+
&& toolId in listOf("HtmlUnknownTag", "CheckEmptyScriptTag")
20+
}
21+
}

src/main/resources/META-INF/plugin.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
implementation="com.github.tempest.framework.views.references.ComponentReferenceContributor"/>
2323
<spellchecker.bundledDictionaryProvider
2424
implementation="com.github.tempest.framework.SpellcheckingDictionaryProvider"/>
25+
<lang.inspectionSuppressor
26+
language="HTML"
27+
implementationClass="com.github.tempest.framework.views.TempestComponentsInspectionSuppressor"/>
2528
</extensions>
2629
<extensions defaultExtensionNs="com.jetbrains.php">
2730

0 commit comments

Comments
 (0)