mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-07 22:10:01 -04:00
feat(highlights): add is predicate
This commit is contained in:
parent
994baf4539
commit
579c9936d6
16 changed files with 102 additions and 39 deletions
|
|
@ -8,7 +8,12 @@
|
|||
(#match? @field "_$"))
|
||||
|
||||
; function(Foo ...foo)
|
||||
(variadic_parameter_declaration) @parameter
|
||||
(variadic_parameter_declaration
|
||||
declarator: (variadic_declarator
|
||||
(identifier) @parameter))
|
||||
; int foo = 0
|
||||
(optional_parameter_declaration
|
||||
declarator: (identifier) @parameter)
|
||||
|
||||
;(field_expression) @parameter ;; How to highlight this?
|
||||
(template_function
|
||||
|
|
@ -42,20 +47,20 @@
|
|||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
(call_expression
|
||||
function: (scoped_identifier
|
||||
function: (scoped_identifier
|
||||
name: (identifier) @function))
|
||||
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function))
|
||||
|
||||
((call_expression
|
||||
function: (scoped_identifier
|
||||
function: (scoped_identifier
|
||||
name: (identifier) @constructor))
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
((call_expression
|
||||
function: (field_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @constructor))
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
;; Parameters
|
||||
(variadic_parameter_declaration
|
||||
declarator: (variadic_declarator
|
||||
(identifier) @definition.parameter))
|
||||
(optional_parameter_declaration
|
||||
declarator: (identifier) @definition.parameter)
|
||||
|
||||
;; Class / struct defintions
|
||||
(class_specifier) @scope
|
||||
|
|
@ -10,14 +16,14 @@
|
|||
(identifier) @definition.var)
|
||||
|
||||
(struct_specifier
|
||||
name: (type_identifier) @definition.type)
|
||||
name: (type_identifier) @definition.type)
|
||||
|
||||
(struct_specifier
|
||||
name: (scoped_type_identifier
|
||||
name: (type_identifier) @definition.type))
|
||||
|
||||
(class_specifier
|
||||
name: (type_identifier) @definition.type)
|
||||
name: (type_identifier) @definition.type)
|
||||
|
||||
(class_specifier
|
||||
name: (scoped_type_identifier
|
||||
|
|
@ -32,7 +38,7 @@
|
|||
(template_declaration) @scope
|
||||
|
||||
;; Namespaces
|
||||
(namespace_definition
|
||||
(namespace_definition
|
||||
name: (identifier) @definition.namespace
|
||||
body: (_) @scope)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue