Skip to content

Commit

Permalink
Color all declaration statements(Close #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
oovm committed Apr 16, 2024
1 parent ba7a39d commit 91d1517
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/main/kotlin/valkyrie/ide/highlight/NodeHighlighter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class NodeHighlighter : ValkyrieVisitor(), HighlightVisitor {
highlight(o.nameIdentifier, HighlightColor.SYM_FUNCTION_FREE)
}

override fun visitDeclareDomain(o: ValkyrieDeclareDomain) {
o as ValkyrieDeclareDomainNode
highlight(o.nameIdentifier, HighlightColor.SYM_MACRO)
}

override fun visitDeclareUnion(o: ValkyrieDeclareUnion) {
o as ValkyrieDeclareUnionNode
highlight(o.nameIdentifier, HighlightColor.SYM_MACRO)
Expand Down Expand Up @@ -98,6 +103,11 @@ class NodeHighlighter : ValkyrieVisitor(), HighlightVisitor {
highlight(o.nameIdentifier, HighlightColor.SYM_MACRO)
}

override fun visitMacroCall(o: ValkyrieMacroCall) {
highlight(o.firstChild, HighlightColor.SYM_MACRO)
highlight(o.namepath, HighlightColor.SYM_MACRO)
}


override fun visitDeclareVariable(o: ValkyrieDeclareVariable) {
super.visitDeclareVariable(o)
Expand Down Expand Up @@ -156,6 +166,10 @@ class NodeHighlighter : ValkyrieVisitor(), HighlightVisitor {
}
}

override fun visitSlot(o: ValkyrieSlot) {
highlight(o, HighlightColor.KEYWORD)
}

fun highlight(element: PsiElement?, color: HighlightColor) {
element ?: return
val builder = HighlightInfo.newHighlightInfo(HighlightInfoType.INFORMATION)
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/valkyrie/ide/highlight/TokenHighlighter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import valkyrie.psi.ValkyrieTypes.*

class TokenHighlighter : SyntaxHighlighter {
override fun getHighlightingLexer(): Lexer {
return ParserDefinition.createLexer()
return ParserDefinition.Instance.lexer()
}

override fun getTokenHighlights(tokenType: IElementType): Array<TextAttributesKey> {
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/valkyrie/ide/hint/VisionInheritors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package valkyrie.ide.hint
import com.intellij.codeInsight.CodeInsightBundle
import com.intellij.codeInsight.codeVision.CodeVisionEntry
import com.intellij.codeInsight.codeVision.settings.PlatformCodeVisionIds
import com.intellij.codeInsight.completion.CompletionData

import com.intellij.psi.PsiElement
import valkyrie.psi.node.ValkyrieDeclareClass
import valkyrie.psi.node.ValkyrieDeclareTrait
Expand Down

0 comments on commit 91d1517

Please sign in to comment.