mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-15 01:40:02 -04:00
c/cpp highlights: Fix field declarations and initializers
After a recent fix for #446, declarations in class/struct definitions stopped being marked as properties or methods. This fix will add property highlights to field declarations, and method highlight to field function declarations.
This commit is contained in:
parent
d2b8b49ce5
commit
33ffdce690
2 changed files with 11 additions and 0 deletions
|
|
@ -122,6 +122,11 @@
|
||||||
(((field_expression
|
(((field_expression
|
||||||
(field_identifier) @property)) @_parent
|
(field_identifier) @property)) @_parent
|
||||||
(#not-has-parent? @_parent template_method function_declarator call_expression))
|
(#not-has-parent? @_parent template_method function_declarator call_expression))
|
||||||
|
|
||||||
|
(((field_identifier) @property)
|
||||||
|
(#has-ancestor? @property field_declaration)
|
||||||
|
(#not-has-ancestor? @property function_declarator))
|
||||||
|
|
||||||
(statement_identifier) @label
|
(statement_identifier) @label
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,12 @@
|
||||||
(field_identifier) @method)) @_parent
|
(field_identifier) @method)) @_parent
|
||||||
(#has-parent? @_parent template_method function_declarator call_expression))
|
(#has-parent? @_parent template_method function_declarator call_expression))
|
||||||
|
|
||||||
|
(field_initializer
|
||||||
|
(field_identifier) @property)
|
||||||
|
|
||||||
|
(function_declarator
|
||||||
|
declarator: (field_identifier) @method)
|
||||||
|
|
||||||
(template_function
|
(template_function
|
||||||
name: (scoped_identifier
|
name: (scoped_identifier
|
||||||
name: (identifier) @function))
|
name: (identifier) @function))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue