mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 10:50:06 -04:00
fix(predicates): Fix #446: highlight property only if not a method
This commit is contained in:
parent
f4979e5379
commit
3674ad89df
3 changed files with 7 additions and 3 deletions
|
|
@ -54,6 +54,7 @@ local function has_ancestor(match, pattern, bufnr, pred)
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
query.add_predicate('has-ancestor?', has_ancestor)
|
query.add_predicate('has-ancestor?', has_ancestor)
|
||||||
|
|
||||||
query.add_predicate('has-parent?', has_ancestor)
|
query.add_predicate('has-parent?', has_ancestor)
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,9 @@
|
||||||
] @function.macro
|
] @function.macro
|
||||||
; TODO (preproc_arg) @embedded
|
; TODO (preproc_arg) @embedded
|
||||||
|
|
||||||
(field_identifier) @property
|
(((field_expression
|
||||||
|
(field_identifier) @property)) @_parent
|
||||||
|
(not-has-parent? @_parent template_method function_declarator call_expression))
|
||||||
(statement_identifier) @label
|
(statement_identifier) @label
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,9 @@
|
||||||
(template_function
|
(template_function
|
||||||
name: (identifier) @function)
|
name: (identifier) @function)
|
||||||
|
|
||||||
(template_method
|
(((field_expression
|
||||||
name: (field_identifier) @method)
|
(field_identifier) @method)) @_parent
|
||||||
|
(has-parent? @_parent template_method function_declarator call_expression))
|
||||||
|
|
||||||
(template_function
|
(template_function
|
||||||
name: (scoped_identifier
|
name: (scoped_identifier
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue