diff --git a/build.gradle.kts b/build.gradle.kts index de3510e..3567766 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,7 @@ detekt { } group = "com.carbonblack" -version = "2.1.0" +version = "2.2.0" tasks.compileJava { options.release.set(17) diff --git a/src/main/kotlin/com/carbonblack/intellij/rpmspec/RpmSpecHighlightingAnnotator.kt b/src/main/kotlin/com/carbonblack/intellij/rpmspec/RpmSpecHighlightingAnnotator.kt index b13dbf7..ad6434a 100644 --- a/src/main/kotlin/com/carbonblack/intellij/rpmspec/RpmSpecHighlightingAnnotator.kt +++ b/src/main/kotlin/com/carbonblack/intellij/rpmspec/RpmSpecHighlightingAnnotator.kt @@ -144,6 +144,33 @@ class RpmSpecHighlightingAnnotator : Annotator { } } + // Explicitly highlight the section headers; this resolves issues with the shell sections + // causing the headers to be un-highlighted. + when (element) { + is RpmSpecFilesSection, + is RpmSpecPackageSection, + is RpmSpecDescriptionSection, + is RpmSpecChangelogSection, + -> element.node.getChildren(TokenSet.ANY) + .firstOrNull { + it.elementType == RpmSpecTypes.FILES || + it.elementType == RpmSpecTypes.PACKAGE || + it.elementType == RpmSpecTypes.CHANGELOG || + it.elementType == RpmSpecTypes.DESCRIPTION + }?.let { + holder.newSilentAnnotation(HighlightSeverity.INFORMATION) + .textAttributes(RpmSpecSyntaxHighligher.RESERVED) + .range(it.textRange).create() + } + is RpmSpecGenericSection -> element.node.getChildren(TokenSet.ANY).firstOrNull()?.let { + if (element.text.firstOrNull() == '%') { + holder.newSilentAnnotation(HighlightSeverity.INFORMATION) + .textAttributes(RpmSpecSyntaxHighligher.RESERVED) + .range(it.textRange).create() + } + } + } + val colorType = when (element) { is RpmSpecChangelogItem -> RpmSpecSyntaxHighligher.TEXT is RpmSpecChangelogEntry -> RpmSpecSyntaxHighligher.TEXT diff --git a/src/main/kotlin/com/carbonblack/intellij/rpmspec/psi/RpmSpecMacroElementImpl.kt b/src/main/kotlin/com/carbonblack/intellij/rpmspec/psi/RpmSpecMacroElementImpl.kt index edf2839..ac45e6c 100644 --- a/src/main/kotlin/com/carbonblack/intellij/rpmspec/psi/RpmSpecMacroElementImpl.kt +++ b/src/main/kotlin/com/carbonblack/intellij/rpmspec/psi/RpmSpecMacroElementImpl.kt @@ -5,7 +5,6 @@ import com.intellij.extapi.psi.ASTWrapperPsiElement import com.intellij.lang.ASTNode import com.intellij.openapi.util.TextRange import com.intellij.psi.* -import java.util.* abstract class RpmSpecMacroElementImpl(node: ASTNode) : ASTWrapperPsiElement(node), PsiNameIdentifierOwner, RpmSpecMacroElement { diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 963d247..de115c6 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -9,10 +9,10 @@ - Changes in version 2.1.0: + Changes in version 2.2.0:
]]>