Updates zigs highlight to emit right captures

This commit is contained in:
Allan Calix 2024-01-25 19:17:18 -08:00
parent e5b71cc6ac
commit ebbfff5ce8
No known key found for this signature in database
2 changed files with 12 additions and 12 deletions

View file

@ -25,6 +25,7 @@ parameter: (IDENTIFIER) @parameter
] @type ] @type
(#match? @type "^[A-Z]([a-z]+[A-Za-z0-9]*)*$") (#match? @type "^[A-Z]([a-z]+[A-Za-z0-9]*)*$")
) )
;; assume camelCase is a function ;; assume camelCase is a function
( (
[ [
@ -32,7 +33,7 @@ parameter: (IDENTIFIER) @parameter
field_access: (IDENTIFIER) field_access: (IDENTIFIER)
parameter: (IDENTIFIER) parameter: (IDENTIFIER)
] @function ] @function
(#match? @function "^[a-z]+([A-Z][a-z0-9]*)+$") (#match? @function "^[a-z]+([A-Z][a-z0-9]+)$")
) )
;; assume all CAPS_1 is a constant ;; assume all CAPS_1 is a constant
@ -49,7 +50,7 @@ parameter: (IDENTIFIER) @parameter
function: (IDENTIFIER) function: (IDENTIFIER)
] @function ] @function
exception: "!" @exception exception: "!" @keyword.exception
( (
(IDENTIFIER) @variable.builtin (IDENTIFIER) @variable.builtin
@ -72,13 +73,12 @@ field_constant: (IDENTIFIER) @constant
(BUILTINIDENTIFIER) @keyword (BUILTINIDENTIFIER) @keyword
; No idea why this doesnt work ((BUILTINIDENTIFIER) @keyword.import
; ((BUILTINIDENTIFIER) @include (#any-of? @keyword.import "@import" "@cImport"))
; (#any-of? @include "@import" "@cImport"))
(INTEGER) @number (INTEGER) @number
(FLOAT) @float (FLOAT) @number.float
[ [
"true" "true"
@ -135,7 +135,7 @@ field_constant: (IDENTIFIER) @constant
"if" "if"
"else" "else"
"switch" "switch"
] @conditional ] @keyword
[ [
"for" "for"
@ -146,7 +146,7 @@ field_constant: (IDENTIFIER) @constant
[ [
"usingnamespace" "usingnamespace"
] @include ] @keyword.import
[ [
"try" "try"
@ -171,7 +171,7 @@ field_constant: (IDENTIFIER) @constant
"align" "align"
"callconv" "callconv"
"linksection" "linksection"
] @storageclass ] @keyword.storage
[ [
"comptime" "comptime"

View file

@ -3,7 +3,7 @@
(ContainerDecl) (ContainerDecl)
(SwitchExpr) (SwitchExpr)
(InitList) (InitList)
] @indent ] @indent.begin
[ [
"(" "("
@ -12,11 +12,11 @@
"]" "]"
"{" "{"
"}" "}"
] @branch ] @indent.branch
[ [
(line_comment) (line_comment)
(container_doc_comment) (container_doc_comment)
(doc_comment) (doc_comment)
(LINESTRING) (LINESTRING)
] @ignore ] @indent.ignore