Skip to content

Commit

Permalink
fix(queries): use last-precedence for highlights
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Feb 26, 2024
1 parent 0bb270c commit 671bb1b
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
; Identifier naming conventions

(identifier) @variable

((identifier) @constructor
(#match? @constructor "^[A-Z]"))

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

; Builtin functions

((call
function: (identifier) @function.builtin)
(#match?
@function.builtin
"^(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__)$"))

; Function calls

(decorator) @function
Expand All @@ -23,12 +17,19 @@
(call
function: (identifier) @function)

; Builtin functions

((call
function: (identifier) @function.builtin)
(#match?
@function.builtin
"^(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__)$"))

; Function definitions

(function_definition
name: (identifier) @function)

(identifier) @variable
(attribute attribute: (identifier) @property)
(type (identifier) @type)

Expand Down

0 comments on commit 671bb1b

Please sign in to comment.