unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Vincenzo Pupillo <v.pupillo@gmail.com>
To: emacs-devel@gnu.org
Subject: Clarification about treesit-font-lock-settings
Date: Sat, 25 Feb 2023 16:33:13 +0100	[thread overview]
Message-ID: <CA+pSb5tDKRTCid=b7oQ=QVBfWp1VxSdbx_z3CjDKetkc74pX4g@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]

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):

<?php

#[
 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

[-- Attachment #2: Type: text/html, Size: 1514 bytes --]

             reply	other threads:[~2023-02-25 15:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-25 15:33 Vincenzo Pupillo [this message]
2023-02-25 22:18 ` Clarification about treesit-font-lock-settings Vincenzo Pupillo
2023-02-26  9:15   ` Yuan Fu
2023-02-27 11:06     ` vp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+pSb5tDKRTCid=b7oQ=QVBfWp1VxSdbx_z3CjDKetkc74pX4g@mail.gmail.com' \
    --to=v.pupillo@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).