Okay, I figured out how to do it: :language 'php :feature 'attribute '((((attribute (_) @attribute_name) @font-lock-preprocessor-face) (:match "Deprecated" @attribute_name))) However, I cannot understand why "treesit-query-validate" says the query is correct, but I get an error. Thank you. Vincenzo Il giorno sab 25 feb 2023 alle ore 16:33 Vincenzo Pupillo < v.pupillo@gmail.com> ha scritto: > Hi, > I'm trying to understand how treesit-font-lock-settings works. > PHP supports annotations for classes, methods, functions, parameters, > properties and class constants, for e.g (this test come from php-mode): > > > #[ > Deprecated > ] > function f($arg1, > #[Deprecated] $arg2){} > #Deprecated <-- this is a comment > > I would like to highlight the "Deprecated" annotation. > "treesit-query-validation" says that this query is valid: > (treesit-query-validate 'php > '((attribute (name (:match "Deprecated")) > @font-lock-comment-delimiter-face)) > > This is the rule I wrote: > :language 'php > :feature 'attribute > '((attribute (name (:match "Deprecated"))) @font-lock-comment-delimiter- > face) > > > When I use my "php-ts-mode" on that code snippet, emacs reports the > following > errors: > Error during display: (jit-lock-function 1) reported (treesit-query-error > "Predicate `equal' requires two arguments but only given" 1) > Error during display: (jit-lock-function 6) reported (treesit-query-error > "Predicate `equal' requires two arguments but only given" 1) > Set report [2 times] > > Is this a bug or am I doing something wrong? > My "php-ts-mode" works quite well. Except for the annotations the syntax > highlighting is as good as php-mode. > > Thank you. > > Vincenzo >