From 33ffdce6906b0946a6503c73b7fc71250cc938aa Mon Sep 17 00:00:00 2001 From: John Drouhard Date: Thu, 19 Nov 2020 09:50:47 -0600 Subject: 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. --- queries/c/highlights.scm | 5 +++++ queries/cpp/highlights.scm | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index ccda6632c..af4012810 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -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 [ diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index 05d50426a..81e4c544d 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -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)) -- cgit v1.2.3-70-g09d2