Skip to content

Commit 94b477e

Browse files
committed
fix(queries): use last-precedence for highlights
1 parent c4eb352 commit 94b477e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

queries/highlights.scm

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
; Identifier naming conventions
22

3+
(identifier) @variable
4+
35
((identifier) @constructor
46
(#match? @constructor "^[A-Z]"))
57

68
((identifier) @constant
79
(#match? @constant "^[A-Z][A-Z_]*$"))
810

9-
; Builtin functions
10-
11-
((call
12-
function: (identifier) @function.builtin)
13-
(#match?
14-
@function.builtin
15-
"^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$"))
16-
1711
; Function calls
1812

1913
(decorator) @function
@@ -23,12 +17,19 @@
2317
(call
2418
function: (identifier) @function)
2519

20+
; Builtin functions
21+
22+
((call
23+
function: (identifier) @function.builtin)
24+
(#match?
25+
@function.builtin
26+
"^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$"))
27+
2628
; Function definitions
2729

2830
(function_definition
2931
name: (identifier) @function)
3032

31-
(identifier) @variable
3233
(attribute attribute: (identifier) @property)
3334
(type (identifier) @type)
3435

0 commit comments

Comments
 (0)