mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 03:10:04 -04:00
Add @keyword.operator for operators that are English words and add @exception for Java/JS
This commit is contained in:
parent
c1313ba7af
commit
7e3c4f8089
10 changed files with 75 additions and 27 deletions
|
|
@ -131,9 +131,10 @@ are optional and will not have any effect for now.
|
||||||
@conditional
|
@conditional
|
||||||
@repeat
|
@repeat
|
||||||
@label for C/Lua-like labels
|
@label for C/Lua-like labels
|
||||||
@operator
|
|
||||||
@keyword
|
@keyword
|
||||||
@keyword.function
|
@keyword.function
|
||||||
|
@keyword.operator (for operators that are English words, e.g. `and`, `or`)
|
||||||
|
@operator (for symbolic operators, e.g. `+`, `*`)
|
||||||
@exception
|
@exception
|
||||||
@include keywords for including modules (e.g. import/from in Python)
|
@include keywords for including modules (e.g. import/from in Python)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,10 @@ hlmap["constructor"] = "TSConstructor"
|
||||||
hlmap["conditional"] = "TSConditional"
|
hlmap["conditional"] = "TSConditional"
|
||||||
hlmap["repeat"] = "TSRepeat"
|
hlmap["repeat"] = "TSRepeat"
|
||||||
hlmap["label"] = "TSLabel"
|
hlmap["label"] = "TSLabel"
|
||||||
hlmap["operator"] = "TSOperator"
|
|
||||||
hlmap["keyword"] = "TSKeyword"
|
hlmap["keyword"] = "TSKeyword"
|
||||||
hlmap["keyword.function"] = "TSKeywordFunction"
|
hlmap["keyword.function"] = "TSKeywordFunction"
|
||||||
|
hlmap["keyword.operator"] = "TSKeywordOperator"
|
||||||
|
hlmap["operator"] = "TSOperator"
|
||||||
hlmap["exception"] = "TSException"
|
hlmap["exception"] = "TSException"
|
||||||
|
|
||||||
hlmap["type"] = "TSType"
|
hlmap["type"] = "TSType"
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ highlight default link TSLabel Label
|
||||||
highlight default link TSOperator Operator
|
highlight default link TSOperator Operator
|
||||||
highlight default link TSKeyword Keyword
|
highlight default link TSKeyword Keyword
|
||||||
highlight default link TSKeywordFunction Keyword
|
highlight default link TSKeywordFunction Keyword
|
||||||
|
highlight default link TSKeywordOperator TSOperator
|
||||||
highlight default link TSException Exception
|
highlight default link TSException Exception
|
||||||
|
|
||||||
highlight default link TSType Type
|
highlight default link TSType Type
|
||||||
|
|
|
||||||
|
|
@ -101,13 +101,11 @@
|
||||||
"class"
|
"class"
|
||||||
"decltype"
|
"decltype"
|
||||||
"constexpr"
|
"constexpr"
|
||||||
"delete"
|
|
||||||
"explicit"
|
"explicit"
|
||||||
"final"
|
"final"
|
||||||
"friend"
|
"friend"
|
||||||
"mutable"
|
"mutable"
|
||||||
"namespace"
|
"namespace"
|
||||||
"new"
|
|
||||||
"override"
|
"override"
|
||||||
"private"
|
"private"
|
||||||
"protected"
|
"protected"
|
||||||
|
|
@ -119,6 +117,26 @@
|
||||||
(auto)
|
(auto)
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
|
[
|
||||||
|
"new"
|
||||||
|
"delete"
|
||||||
|
|
||||||
|
;; these keywords are not supported by the parser
|
||||||
|
;"eq"
|
||||||
|
;"not_eq"
|
||||||
|
;
|
||||||
|
;"compl"
|
||||||
|
;"and"
|
||||||
|
;"or"
|
||||||
|
;
|
||||||
|
;"bitand"
|
||||||
|
;"bitand_eq"
|
||||||
|
;"bitor"
|
||||||
|
;"bitor_eq"
|
||||||
|
;"xor"
|
||||||
|
;"xor_eq"
|
||||||
|
] @keyword.operator
|
||||||
|
|
||||||
"::" @operator
|
"::" @operator
|
||||||
"..." @operator
|
"..." @operator
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,6 @@
|
||||||
"abstract"
|
"abstract"
|
||||||
"assert"
|
"assert"
|
||||||
"break"
|
"break"
|
||||||
"catch"
|
|
||||||
"class"
|
"class"
|
||||||
"continue"
|
"continue"
|
||||||
"default"
|
"default"
|
||||||
|
|
@ -149,13 +148,11 @@
|
||||||
"exports"
|
"exports"
|
||||||
"extends"
|
"extends"
|
||||||
"final"
|
"final"
|
||||||
"finally"
|
|
||||||
"implements"
|
"implements"
|
||||||
"instanceof"
|
"instanceof"
|
||||||
"interface"
|
"interface"
|
||||||
"module"
|
"module"
|
||||||
"native"
|
"native"
|
||||||
"new"
|
|
||||||
"open"
|
"open"
|
||||||
"opens"
|
"opens"
|
||||||
"package"
|
"package"
|
||||||
|
|
@ -168,17 +165,18 @@
|
||||||
"static"
|
"static"
|
||||||
"strictfp"
|
"strictfp"
|
||||||
"synchronized"
|
"synchronized"
|
||||||
"throw"
|
|
||||||
"throws"
|
|
||||||
"to"
|
"to"
|
||||||
"transient"
|
"transient"
|
||||||
"transitive"
|
"transitive"
|
||||||
"try"
|
|
||||||
"uses"
|
"uses"
|
||||||
"volatile"
|
"volatile"
|
||||||
"with"
|
"with"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
|
[
|
||||||
|
"new"
|
||||||
|
] @keyword.operator
|
||||||
|
|
||||||
; Conditionals
|
; Conditionals
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -218,6 +216,16 @@
|
||||||
")"
|
")"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
; Exceptions
|
||||||
|
|
||||||
|
[
|
||||||
|
"throw"
|
||||||
|
"throws"
|
||||||
|
"finally"
|
||||||
|
"try"
|
||||||
|
"catch"
|
||||||
|
] @exception
|
||||||
|
|
||||||
; Labels
|
; Labels
|
||||||
(labeled_statement
|
(labeled_statement
|
||||||
(identifier) @label)
|
(identifier) @label)
|
||||||
|
|
|
||||||
|
|
@ -184,30 +184,36 @@
|
||||||
"async"
|
"async"
|
||||||
"await"
|
"await"
|
||||||
"break"
|
"break"
|
||||||
"catch"
|
|
||||||
"class"
|
"class"
|
||||||
"const"
|
"const"
|
||||||
"debugger"
|
"debugger"
|
||||||
"delete"
|
|
||||||
"export"
|
"export"
|
||||||
"extends"
|
"extends"
|
||||||
"finally"
|
|
||||||
"function"
|
"function"
|
||||||
"get"
|
"get"
|
||||||
"in"
|
"in"
|
||||||
"instanceof"
|
"instanceof"
|
||||||
"let"
|
"let"
|
||||||
"new"
|
|
||||||
"return"
|
"return"
|
||||||
"set"
|
"set"
|
||||||
"static"
|
"static"
|
||||||
"switch"
|
"switch"
|
||||||
"target"
|
"target"
|
||||||
"throw"
|
|
||||||
"try"
|
|
||||||
"typeof"
|
"typeof"
|
||||||
"var"
|
"var"
|
||||||
"void"
|
"void"
|
||||||
"with"
|
"with"
|
||||||
"yield"
|
"yield"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
|
[
|
||||||
|
"new"
|
||||||
|
"delete"
|
||||||
|
] @keyword.operator
|
||||||
|
|
||||||
|
[
|
||||||
|
"throw"
|
||||||
|
"try"
|
||||||
|
"catch"
|
||||||
|
"finally"
|
||||||
|
] @exception
|
||||||
|
|
|
||||||
|
|
@ -51,15 +51,19 @@
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
;; Operators
|
;; Operators
|
||||||
|
|
||||||
|
[
|
||||||
|
"not"
|
||||||
|
"and"
|
||||||
|
"or"
|
||||||
|
] @keyword.operator
|
||||||
|
|
||||||
[
|
[
|
||||||
"="
|
"="
|
||||||
"~="
|
"~="
|
||||||
"=="
|
"=="
|
||||||
"<="
|
"<="
|
||||||
">="
|
">="
|
||||||
"not"
|
|
||||||
"and"
|
|
||||||
"or"
|
|
||||||
"<"
|
"<"
|
||||||
">"
|
">"
|
||||||
"+"
|
"+"
|
||||||
|
|
|
||||||
|
|
@ -157,15 +157,19 @@
|
||||||
"|"
|
"|"
|
||||||
"|="
|
"|="
|
||||||
"~"
|
"~"
|
||||||
|
"->"
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
; Keywords
|
||||||
|
[
|
||||||
"and"
|
"and"
|
||||||
"in"
|
"in"
|
||||||
"is"
|
"is"
|
||||||
"not"
|
"not"
|
||||||
"or"
|
"or"
|
||||||
"->"
|
|
||||||
] @operator
|
|
||||||
|
|
||||||
; Keywords
|
"del"
|
||||||
|
] @keyword.operator
|
||||||
|
|
||||||
[
|
[
|
||||||
"assert"
|
"assert"
|
||||||
|
|
@ -173,7 +177,6 @@
|
||||||
"await"
|
"await"
|
||||||
"class"
|
"class"
|
||||||
"def"
|
"def"
|
||||||
"del"
|
|
||||||
"except"
|
"except"
|
||||||
"exec"
|
"exec"
|
||||||
"finally"
|
"finally"
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
[
|
[
|
||||||
"alias"
|
"alias"
|
||||||
"and"
|
|
||||||
"begin"
|
"begin"
|
||||||
"break"
|
"break"
|
||||||
"class"
|
"class"
|
||||||
|
|
@ -13,10 +12,8 @@
|
||||||
"do"
|
"do"
|
||||||
"end"
|
"end"
|
||||||
"ensure"
|
"ensure"
|
||||||
"in"
|
|
||||||
"module"
|
"module"
|
||||||
"next"
|
"next"
|
||||||
"or"
|
|
||||||
"rescue"
|
"rescue"
|
||||||
"retry"
|
"retry"
|
||||||
"return"
|
"return"
|
||||||
|
|
@ -24,6 +21,12 @@
|
||||||
"yield"
|
"yield"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
|
[
|
||||||
|
"and"
|
||||||
|
"or"
|
||||||
|
"in"
|
||||||
|
] @keyword.operator
|
||||||
|
|
||||||
[
|
[
|
||||||
"case"
|
"case"
|
||||||
"else"
|
"else"
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,10 @@
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
[
|
[
|
||||||
"as"
|
"as"
|
||||||
|
] @keyword.operator
|
||||||
|
|
||||||
|
[
|
||||||
"*"
|
"*"
|
||||||
"'"
|
"'"
|
||||||
"->"
|
"->"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue