Zig queries: highlight, fold and indent

* fold for if/while/for
 * highlight "_" for ignore variable
 * highlight "c" for PtrTypeStart
 * highlight "?" for optional type
 * remove duplicate query node in indent
This commit is contained in:
maxxnino 2021-09-20 17:58:15 +09:00 committed by Stephan Seitz
parent 440b69f8d1
commit f76737ee33
3 changed files with 17 additions and 5 deletions

View file

@ -6,4 +6,11 @@
(AsmExpr)
(ErrorSetDecl)
(LINESTRING)
(
[
(IfPrefix)
(WhilePrefix)
(ForPrefix)
]
)
] @fold

View file

@ -23,7 +23,7 @@ parameter: (IDENTIFIER) @parameter
field_access: (IDENTIFIER)
parameter: (IDENTIFIER)
] @type
(#match? @type "^[A-Z]([a-z0-9]+[A-Za-z0-9]*)*$")
(#match? @type "^[A-Z]([a-z]+[A-Za-z0-9]*)*$")
)
;; assume camelCase is a function
(
@ -51,6 +51,13 @@ parameter: (IDENTIFIER) @parameter
exception: "!" @exception
(
(IDENTIFIER) @variable.builtin
(#eq? @variable.builtin "_")
)
(PtrTypeStart "c" @variable.builtin)
(
(ContainerDeclType
[
@ -58,9 +65,7 @@ exception: "!" @exception
"enum"
]
)
(ContainerMembers
(ContainerField (IDENTIFIER) @constant)
)
(ContainerField (IDENTIFIER) @constant)
)
field_constant: (IDENTIFIER) @constant
@ -199,6 +204,7 @@ field_constant: (IDENTIFIER) @constant
".?"
".*"
"="
"?"
] @operator
[

View file

@ -3,7 +3,6 @@
(ContainerDecl)
(SwitchExpr)
(InitList)
(ContainerDecl)
] @indent
[