Skip to content

Commit 9344bb4

Browse files
committed
feat(highlight): add syntax highlighting for Shire language
Add DevInHighlightingAnnotator to provide basic identifier highlighting for Shire language in DevIn plugin. This enhances code readability in the IDE.
1 parent dcb3cb1 commit 9344bb4

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package cc.unitmesh.devti.language.highlight
2+
3+
import cc.unitmesh.devti.language.psi.DevInTypes
4+
import com.intellij.lang.annotation.AnnotationHolder
5+
import com.intellij.lang.annotation.Annotator
6+
import com.intellij.lang.annotation.HighlightSeverity
7+
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors
8+
import com.intellij.psi.PsiElement
9+
import com.intellij.psi.util.PsiUtilCore
10+
11+
class DevInHighlightingAnnotator : Annotator {
12+
override fun annotate(element: PsiElement, holder: AnnotationHolder) {
13+
when (PsiUtilCore.getElementType(element)) {
14+
DevInTypes.IDENTIFIER -> {
15+
holder.newSilentAnnotation(HighlightSeverity.INFORMATION)
16+
.textAttributes(DefaultLanguageHighlighterColors.IDENTIFIER)
17+
.create()
18+
}
19+
}
20+
}
21+
}

exts/devins-lang/src/main/resources/cc.unitmesh.devti.language.xml

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
<lang.syntaxHighlighterFactory language="DevIn"
2525
implementationClass="cc.unitmesh.devti.language.highlight.DevInSyntaxHighlighterFactory"/>
2626

27+
<annotator language="Shire" implementationClass="cc.unitmesh.devti.language.highlight.DevInHighlightingAnnotator"/>
28+
2729
<lang.ast.factory language="DevIn"
2830
implementationClass="cc.unitmesh.devti.language.DevInAstFactory"/>
2931

0 commit comments

Comments
 (0)