Adapt Python highlights to new query syntax

This commit is contained in:
Stephan Seitz 2020-06-21 16:32:25 +02:00 committed by Thomas Vigouroux
parent 51a52b85cf
commit dfead6caca
2 changed files with 66 additions and 81 deletions

View file

@ -77,8 +77,7 @@
; Literals ; Literals
(none) @constant.builtin (none) @constant.builtin
(true) @boolean [(true) (false)] @boolean
(false) @boolean
((identifier) @constant.builtin ((identifier) @constant.builtin
(match? @constant.builtin "self")) (match? @constant.builtin "self"))
@ -91,88 +90,78 @@
; Tokens ; Tokens
"-" @operator [
"->" @operator "-"
"-=" @operator "-="
"!=" @operator "!="
"*" @operator "*"
"**" @operator "**"
"**=" @operator "**="
"*=" @operator "*="
"/" @operator "/"
"//" @operator "//"
"//=" @operator "//="
"/=" @operator "/="
"&" @operator "&"
"%" @operator "%"
"%=" @operator "%="
"^" @operator "^"
"+" @operator "+"
"+=" @operator "+="
"<" @operator "<"
"<<" @operator "<<"
"<=" @operator "<="
"<>" @operator "<>"
"=" @operator "="
"==" @operator "=="
">" @operator ">"
">=" @operator ">="
">>" @operator ">>"
"|" @operator "|"
"~" @operator "~"
"and" @operator "and"
"in" @operator "in"
"is" @operator "is"
"not" @operator "not"
"or" @operator "or"
] @operator
; Keywords ; Keywords
"as" @include [
"assert" @keyword "assert"
"async" @keyword "await"
"await" @keyword "class"
"break" @repeat "def"
"class" @keyword "del"
"continue" @repeat "except"
"def" @keyword "exec"
"del" @keyword "finally"
"elif" @conditional "global"
"else" @conditional "lambda"
"except" @keyword "nonlocal"
"exec" @keyword "pass"
"finally" @keyword "print"
"for" @repeat "raise"
"from" @include "return"
"global" @keyword "try"
"if" @conditional "with"
"import" @include "yield"
"lambda" @keyword ] @keyword
"nonlocal" @keyword
"pass" @keyword
"print" @keyword
"raise" @keyword
"return" @keyword
"try" @keyword
"while" @repeat
"with" @keyword
"yield" @keyword
; Additions for nvim-treesitter [ "as" "from" "import"] @include
"(" @punctuation.bracket
")" @punctuation.bracket [ "if" "elif" "else" ] @conditional
"[" @punctuation.bracket
"]" @punctuation.bracket [ "for" "while" "break" "continue" ] @repeat
"{" @punctuation.bracket
"}" @punctuation.bracket [ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
(interpolation (interpolation
"{" @punctuation.special "{" @punctuation.special
"}" @punctuation.special) @embedded "}" @punctuation.special) @embedded
"," @punctuation.delimiter [ "," "." ":" ] @punctuation.delimiter
"." @punctuation.delimiter
":" @punctuation.delimiter
; Class definitions ; Class definitions

View file

@ -30,12 +30,8 @@
; Function defines function and scope ; Function defines function and scope
(function_definition (function_definition
name: (identifier) @definition.function) @scope name: (identifier) @definition.function
body: (block (expression_statement (string) @definition.doc)?)) @scope
;; Should be extended to when syntax supported
;(function_definition
;name: (identifier) @definition.function
;body: (block (expression_statement (string) @definition.function.doc)?)) @scope
(class_definition (class_definition