Skip to content

Commit fb37393

Browse files
committed
Annotate YAML tags as metadata.
1 parent 903fc21 commit fb37393

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ repositories {
3434
dependencies {
3535
intellijPlatform {
3636
intellijIdea(providers.gradleProperty("platformVersion"))
37-
bundledPlugins("org.jetbrains.kotlin", "com.intellij.java")
37+
bundledPlugins("com.intellij.java", "org.jetbrains.kotlin", "org.jetbrains.plugins.yaml")
3838
plugins(
3939
"com.cursiveclojure.cursive:2025.2-252",
4040
"com.jetbrains.rust:252.27397.133",
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.github.simy4.alabaster
2+
3+
import com.intellij.lang.annotation.AnnotationHolder
4+
import com.intellij.lang.annotation.Annotator
5+
import com.intellij.lang.annotation.HighlightSeverity
6+
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors
7+
import com.intellij.psi.PsiElement
8+
import com.intellij.psi.util.elementType
9+
import org.jetbrains.yaml.YAMLTokenTypes
10+
11+
class YAMLAnnotator : Annotator {
12+
override fun annotate(element: PsiElement, holder: AnnotationHolder) {
13+
val elementType = element.elementType
14+
when (elementType) {
15+
YAMLTokenTypes.TAG ->
16+
holder.newSilentAnnotation(HighlightSeverity.TEXT_ATTRIBUTES)
17+
.textAttributes(DefaultLanguageHighlighterColors.METADATA)
18+
.create()
19+
}
20+
}
21+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Other languages work perfectly fine as well, but may do some extra unnecessary h
4040
<depends optional="true" config-file="with-python.xml">PythonCore</depends>
4141
<depends optional="true" config-file="with-rust.xml">com.jetbrains.rust</depends>
4242
<depends optional="true" config-file="with-scala.xml">org.intellij.scala</depends>
43+
<depends optional="true" config-file="with-yaml.xml">org.jetbrains.plugins.yaml</depends>
4344

4445
<extensions defaultExtensionNs="com.intellij">
4546
<themeProvider id="com.github.simy4.alabaster.light" path="/themes/alabaster.theme.json"/>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<idea-plugin>
2+
<extensions defaultExtensionNs="com.intellij">
3+
<annotator language="yaml" implementationClass="com.github.simy4.alabaster.YAMLAnnotator"/>
4+
</extensions>
5+
</idea-plugin>

0 commit comments

Comments
 (0)