mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17: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_identifier) @property)) @_parent
|
||||
(#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
|
||||
|
||||
[
|
||||
|
|
|
|||
|
|
@ -27,6 +27,12 @@
|
|||
(field_identifier) @method)) @_parent
|
||||
(#has-parent? @_parent template_method function_declarator call_expression))
|
||||
|
||||
(field_initializer
|
||||
(field_identifier) @property)
|
||||
|
||||
(function_declarator
|
||||
declarator: (field_identifier) @method)
|
||||
|
||||
(template_function
|
||||
name: (scoped_identifier
|
||||
name: (identifier) @function))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue