mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17: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)
|
||||
(ErrorSetDecl)
|
||||
(LINESTRING)
|
||||
(
|
||||
[
|
||||
(IfPrefix)
|
||||
(WhilePrefix)
|
||||
(ForPrefix)
|
||||
]
|
||||
)
|
||||
] @fold
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
[
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
(ContainerDecl)
|
||||
(SwitchExpr)
|
||||
(InitList)
|
||||
(ContainerDecl)
|
||||
] @indent
|
||||
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue