Refactor highlighting

tree-sitter now uses last-wins rules for highlighting.
This moves the rules around to match the older highlighting.
Except operator, which I've now let it take precedence over `function.call`.
pull/659/head
Eugene Yokota 2024-03-11 10:22:30 +07:00
parent fb4e246cff
commit 7dd646ff64
2 changed files with 18 additions and 18 deletions

@ -1,5 +1,11 @@
; CREDITS @stumash (stuart.mashaal@gmail.com) ; CREDITS @stumash (stuart.mashaal@gmail.com)
(field_expression field: (identifier) @property)
(field_expression value: (identifier) @type
(#match? @type "^[A-Z]"))
(type_identifier) @type
(class_definition (class_definition
name: (identifier) @type) name: (identifier) @type)
@ -20,7 +26,7 @@
;; variables ;; variables
(class_parameter (class_parameter
name: (identifier) @parameter) name: (identifier) @parameter)
(self_type (identifier) @parameter) (self_type (identifier) @parameter)
@ -33,8 +39,6 @@
(type_definition (type_definition
name: (type_identifier) @type.definition) name: (type_identifier) @type.definition)
(type_identifier) @type
;; val/var definitions/declarations ;; val/var definitions/declarations
(val_definition (val_definition
@ -49,14 +53,6 @@
(var_declaration (var_declaration
name: (identifier) @variable) name: (identifier) @variable)
; method definition
(function_declaration
name: (identifier) @method)
(function_definition
name: (identifier) @method)
; imports/exports ; imports/exports
(import_declaration (import_declaration
@ -110,11 +106,15 @@
(binding (binding
name: (identifier) @parameter) name: (identifier) @parameter)
; expressions ; method definition
(field_expression field: (identifier) @property) (function_declaration
(field_expression value: (identifier) @type name: (identifier) @method)
(#match? @type "^[A-Z]"))
(function_definition
name: (identifier) @method)
; expressions
(infix_expression operator: (identifier) @operator) (infix_expression operator: (identifier) @operator)
(infix_expression operator: (operator_identifier) @operator) (infix_expression operator: (operator_identifier) @operator)
@ -235,8 +235,8 @@
"return" @keyword.return "return" @keyword.return
(comment) @comment @spell (comment) @spell @comment
(block_comment) @comment @spell (block_comment) @spell @comment
;; `case` is a conditional keyword in case_block ;; `case` is a conditional keyword in case_block

@ -117,7 +117,7 @@ object A:
// ^type // ^type
::(123) ::(123)
//^function.call //^operator
// ^number // ^number
object bla: object bla: