on a6da99a help sign in
helix/runtime/queries/python/highlights.scm
136 lines 2.1 kB history raw
1; Identifier naming conventions
3((identifier) @constant
4 (#match? @constant "^[A-Z_]*$"))
6((identifier) @constructor
7 (#match? @constructor "^[A-Z]"))
9; Types
11((identifier) @type
12 (#match?
13 @type
14 "^(bool|bytes|dict|float|frozenset|int|list|set|str|tuple)$"))
16(type (identifier)) @type
18; Builtin functions
20((call
21 function: (identifier) @function.builtin)
22 (#match?
23 @function.builtin
24 "^(abs|all|any|ascii|bin|breakpoint|bytearray|callable|chr|classmethod|compile|complex|delattr|dir|divmod|enumerate|eval|exec|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|setattr|slice|sorted|staticmethod|sum|super|type|vars|zip|__import__)$"))
26; Function calls
28(decorator) @function
30(call
31 function: (attribute attribute: (identifier) @function.method))
32(call
33 function: (identifier) @function)
35; Function definitions
37(function_definition
38 name: (identifier) @function)
40(identifier) @variable
41(attribute attribute: (identifier) @variable.other.member)
43; Literals
46 (none)
47 (true)
48 (false)
49] @constant.builtin
51(integer) @constant.numeric.integer
52(float) @constant.numeric.float
53(comment) @comment
54(string) @string
55(escape_sequence) @constant.character.escape
57(interpolation
58 "{" @punctuation.special
59 "}" @punctuation.special) @embedded
62 "-"
63 "-="
64 "!="
65 "*"
66 "**"
67 "**="
68 "*="
69 "/"
70 "//"
71 "//="
72 "/="
73 "&"
74 "%"
75 "%="
76 "^"
77 "+"
78 "->"
79 "+="
80 "<"
81 "<<"
82 "<="
83 "<>"
84 "="
85 ":="
86 "=="
87 ">"
88 ">="
89 ">>"
90 "|"
91 "~"
92] @operator
95 "as"
96 "assert"
97 "await"
98 "break"
99 "continue"
100 "elif"
101 "else"
102 "except"
103 "finally"
104 "for"
105 "from"
106 "if"
107 "import"
108 "pass"
109 "raise"
110 "return"
111 "try"
112 "while"
113 "with"
114 "yield"
115] @keyword.control
117(for_statement "in" @keyword.control)
118(for_in_clause "in" @keyword.control)
121 "and"
122 "async"
123 "class"
124 "def"
125 "del"
126 "exec"
127 "global"
128 "in"
129 "is"
130 "lambda"
131 "nonlocal"
132 "not"
133 "or"
134 "print"
135] @keyword