mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-12 16:30:02 -04:00
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:
parent
440b69f8d1
commit
f76737ee33
3 changed files with 17 additions and 5 deletions
|
|
@ -6,4 +6,11 @@
|
||||||
(AsmExpr)
|
(AsmExpr)
|
||||||
(ErrorSetDecl)
|
(ErrorSetDecl)
|
||||||
(LINESTRING)
|
(LINESTRING)
|
||||||
|
(
|
||||||
|
[
|
||||||
|
(IfPrefix)
|
||||||
|
(WhilePrefix)
|
||||||
|
(ForPrefix)
|
||||||
|
]
|
||||||
|
)
|
||||||
] @fold
|
] @fold
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ parameter: (IDENTIFIER) @parameter
|
||||||
field_access: (IDENTIFIER)
|
field_access: (IDENTIFIER)
|
||||||
parameter: (IDENTIFIER)
|
parameter: (IDENTIFIER)
|
||||||
] @type
|
] @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
|
;; assume camelCase is a function
|
||||||
(
|
(
|
||||||
|
|
@ -51,6 +51,13 @@ parameter: (IDENTIFIER) @parameter
|
||||||
|
|
||||||
exception: "!" @exception
|
exception: "!" @exception
|
||||||
|
|
||||||
|
(
|
||||||
|
(IDENTIFIER) @variable.builtin
|
||||||
|
(#eq? @variable.builtin "_")
|
||||||
|
)
|
||||||
|
|
||||||
|
(PtrTypeStart "c" @variable.builtin)
|
||||||
|
|
||||||
(
|
(
|
||||||
(ContainerDeclType
|
(ContainerDeclType
|
||||||
[
|
[
|
||||||
|
|
@ -58,9 +65,7 @@ exception: "!" @exception
|
||||||
"enum"
|
"enum"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
(ContainerMembers
|
(ContainerField (IDENTIFIER) @constant)
|
||||||
(ContainerField (IDENTIFIER) @constant)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
field_constant: (IDENTIFIER) @constant
|
field_constant: (IDENTIFIER) @constant
|
||||||
|
|
@ -199,6 +204,7 @@ field_constant: (IDENTIFIER) @constant
|
||||||
".?"
|
".?"
|
||||||
".*"
|
".*"
|
||||||
"="
|
"="
|
||||||
|
"?"
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
(ContainerDecl)
|
(ContainerDecl)
|
||||||
(SwitchExpr)
|
(SwitchExpr)
|
||||||
(InitList)
|
(InitList)
|
||||||
(ContainerDecl)
|
|
||||||
] @indent
|
] @indent
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue