Skip to content

Commit 0e116fc

Browse files
tangzxleinlin
authored andcommitted
refactor: highlight operators without 'and' 'or'
1 parent 674644f commit 0e116fc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/com/tang/intellij/lua/highlighting/LuaSyntaxHighlighter.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import com.intellij.openapi.editor.colors.TextAttributesKey
2222
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase
2323
import com.intellij.psi.StringEscapesTokenTypes
2424
import com.intellij.psi.tree.IElementType
25+
import com.jetbrains.rd.util.remove
2526
import com.tang.intellij.lua.comment.psi.LuaDocTokenType
2627
import com.tang.intellij.lua.comment.psi.LuaDocTypes
2728
import com.tang.intellij.lua.lang.LuaParserDefinition.Companion.DOC_KEYWORD_TOKENS
@@ -65,11 +66,13 @@ class LuaSyntaxHighlighter : SyntaxHighlighterBase() {
6566
init {
6667
ourMap1 = HashMap()
6768
ourMap2 = HashMap()
69+
val operatorsWithOutKeyword = (LuaElementTypes.BINARY_OPS + LuaElementTypes.UNARY_OPS)
70+
.remove(LuaTypes.AND).remove(LuaTypes.OR)
6871

6972
fillMap(ourMap1, KEYWORD_TOKENS, LuaHighlightingData.KEYWORD)
7073
fillMap(ourMap1, LuaHighlightingData.SEMICOLON, LuaTypes.SEMI)
7174
fillMap(ourMap1, LuaHighlightingData.COMMA, LuaTypes.COMMA)
72-
fillMap(ourMap1, LuaHighlightingData.OPERATORS, LuaElementTypes.BINARY_OPS + LuaElementTypes.UNARY_OPS)
75+
fillMap(ourMap1, LuaHighlightingData.OPERATORS, operatorsWithOutKeyword)
7376
fillMap(ourMap1, LuaHighlightingData.BRACKETS, LuaTypes.LBRACK, LuaTypes.RBRACK)
7477
fillMap(ourMap1, LuaHighlightingData.BRACES, LuaTypes.LCURLY, LuaTypes.RCURLY)
7578
fillMap(ourMap1, LuaHighlightingData.PARENTHESES, LuaTypes.LPAREN, LuaTypes.RPAREN)

0 commit comments

Comments
 (0)