From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vincenzo Pupillo Newsgroups: gmane.emacs.bugs Subject: bug#61913: java-ts-mode query error for string highlight, due to recent commit in tree-sitter-java. Date: Sun, 5 Mar 2023 14:50:39 +0100 Message-ID: References: <23F92D53-993F-43D6-8A22-00F7AAE10505@gmail.com> <83h6v1at5y.fsf@gnu.org> <7F86A486-0C53-4649-8373-91E093A67A19@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000dc9b7305f6277882" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14135"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 61913@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 05 14:52:51 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pYonC-0003V3-5P for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Mar 2023 14:52:50 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYoml-0004Dj-ED; Sun, 05 Mar 2023 08:52:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYomi-0004D8-ND for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2023 08:52:20 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYomR-0006Gs-41 for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2023 08:52:20 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pYomQ-0001BW-IX for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2023 08:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Vincenzo Pupillo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Mar 2023 13:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61913 X-GNU-PR-Package: emacs Original-Received: via spool by 61913-submit@debbugs.gnu.org id=B61913.16780242844503 (code B ref 61913); Sun, 05 Mar 2023 13:52:02 +0000 Original-Received: (at 61913) by debbugs.gnu.org; 5 Mar 2023 13:51:24 +0000 Original-Received: from localhost ([127.0.0.1]:38821 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYoln-0001AZ-QN for submit@debbugs.gnu.org; Sun, 05 Mar 2023 08:51:24 -0500 Original-Received: from mail-ed1-f49.google.com ([209.85.208.49]:38470) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYoll-0001AL-IC for 61913@debbugs.gnu.org; Sun, 05 Mar 2023 08:51:22 -0500 Original-Received: by mail-ed1-f49.google.com with SMTP id cw28so28306813edb.5 for <61913@debbugs.gnu.org>; Sun, 05 Mar 2023 05:51:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0O2BDNzHI1T4+fw2hvCYHS/MjkNfHT5/9KF8Ve3MYT4=; b=b0e7V8LgxzKCPo4FovUfntfqwByAUalLfv48ljDFFehyl3S84tUNJkol/JP2WbVMLG anHWp+UvFpRX2oKnzSfQS0rqhHf1RltxMd0/L1D6sb0oqQX9GI5hfqMmWyPcJzXvztbz /eF5Fk9MOyEkg89MpVChMxpVhcOcwmgHLYtWsEr1yDY0mxSg6E5cp2imyj43KgMA778N JoBmsw28OeL+wtazi6diU/wy/q10Mc8Wk8N0UkKIidFGx9dZO6YXH27maaIW3nDPBoQ5 LnnPFok10PUUY0x2hFJYorqTHEX5iHyYpnxH90rRSih5KJ59WVRaEunsM2EzaeYYLm3V C/eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0O2BDNzHI1T4+fw2hvCYHS/MjkNfHT5/9KF8Ve3MYT4=; b=CJeE+3azTItlJSQKmV3eEwCbCKaxTjwbzxNrnRtbuvPhNGKFiKgcmUVivBh4G5lK3V MUIO8TU+NMnX4N9U8d1drT0TsAozeX9T4VDiPi5sPIHd8q8ZdYzMLw3XhOMPmePfMyrK lieXE0pg1htZ50km6JLOoZecHGnMHnJFUAyO9/dWPkZpBMMdA4tFynqZ6KPrswskSWUH u4oS/5k6M2mMgghsF8hy/+F/+FqVAK14bv1OUyffUVCx5zFm8ndobWfKgsW1sfLZRx7/ d3ENWuurUp2CeM6EW9Km4WoET4erbEIKDAIrDP9Yw0mv1nsYKXoQSsnWS+NH3H1kaBby rAhg== X-Gm-Message-State: AO0yUKW1WsF86HMDpVsaX7O50VW9IXrkRtFjQRM8oLVdFvK1tTdi1ygR KiH3rhfMCYL4XPp1bZRgA1Sa9jMROVHWH8KpPEQ= X-Google-Smtp-Source: AK7set+LMCTl9OR0LRDu6VX0HglU7e7g9tpRTRMgZ7N7gXDHiMl89A7w6GGA0yiyBfwxD2afV6z6rl0rneTT6WduH/s= X-Received: by 2002:a17:906:4997:b0:877:7480:c75d with SMTP id p23-20020a170906499700b008777480c75dmr3662318eju.0.1678024275433; Sun, 05 Mar 2023 05:51:15 -0800 (PST) In-Reply-To: <7F86A486-0C53-4649-8373-91E093A67A19@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:257351 Archived-At: --000000000000dc9b7305f6277882 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable nvim-treesiter seems to use a "lockfile" in which they put the version of the language parser to be installed ( https://github.com/nvim-treesitter/nvim-treesitter/blob/master/lockfile.jso= n) to allow some stability I suppose. Il giorno sab 4 mar 2023 alle ore 10:27 Yuan Fu ha scritto: > > > > On Mar 3, 2023, at 11:10 PM, Eli Zaretskii wrote: > > > >> From: Yuan Fu > >> Date: Fri, 3 Mar 2023 14:32:02 -0800 > >> Cc: Eli Zaretskii , > >> 61913@debbugs.gnu.org > >> > >>>>> Error during redeployment: (jit-lock-function 8295) reported > >>>>> (treesit-query-error "Node type error at" 42 "(string_literal) > >>>>> @font-lock-string-face (text_block) @font-lock-string-face" > >>>>> "Debugging the query with `treesit-query-validate'") > >>>>> > >>>>> > >>>>> The attached patch fixes the problem. > >>>> > >>>> Wouldn't removing text_block from our code cause problems if someone > >>>> uses tree-sitter-java from before the removal? > >>>> > >>>> Is there a way to write code which handles text_block if it exists? > >>>> > >> > >> Tree-sitter language grammars really need some versioning system. I > >> wonder how do we propose such things to them tho... > > > > That'd be hard, given that many of them don't even make releases. > > > > It should be enough for our purposes to have a possibility of querying > > the grammar about support for specific features. Then the version > > will not matter, only the supported features will. Maybe we could do > > that ourselves, on-the-fly, like we do with programs when we want to > > know whether they support some command-line switch? > > We can test whether a node type exists in the grammar, by trying to > compile a query using that node type. If it returns successfully, then th= e > node type exists. But there are other assumptions we make about a grammar= , > like =E2=80=9Cthe 2nd child of a if node must be the condition=E2=80=9D. = Hopefully these > more subtle things don=E2=80=99t change easily, because we can=E2=80=99t = easily test them. > > Yuan > > --000000000000dc9b7305f6277882 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
nvim-treesiter seems to use a "lockfile" in whic= h they put the version of the language parser to be installed (


> On Mar 3, 2023, at 11:10 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Fri, 3 Mar 2023 14:32:02 -0800
>> Cc: Eli Zaretskii <eliz@gnu.org>,
>> 61913@d= ebbugs.gnu.org
>>
>>>>> Error during redeployment: (jit-lock-function 8295) re= ported
>>>>> (treesit-query-error "Node type error at" 42= "(string_literal)
>>>>> @font-lock-string-face (text_block) @font-lock-string-= face"
>>>>> "Debugging the query with `treesit-query-validate= '")
>>>>>
>>>>>
>>>>> The attached patch fixes the problem.
>>>>
>>>> Wouldn't removing text_block from our code cause probl= ems if someone
>>>> uses tree-sitter-java from before the removal?
>>>>
>>>> Is there a way to write code which handles text_block if i= t exists?
>>>>
>>
>> Tree-sitter language grammars really need some versioning system. = I
>> wonder how do we propose such things to them tho...
>
> That'd be hard, given that many of them don't even make releas= es.
>
> It should be enough for our purposes to have a possibility of querying=
> the grammar about support for specific features.=C2=A0 Then the versio= n
> will not matter, only the supported features will.=C2=A0 Maybe we coul= d do
> that ourselves, on-the-fly, like we do with programs when we want to > know whether they support some command-line switch?

We can test whether a node type exists in the grammar, by trying to compile= a query using that node type. If it returns successfully, then the node ty= pe exists. But there are other assumptions we make about a grammar, like = =E2=80=9Cthe 2nd child of a if node must be the condition=E2=80=9D. Hopeful= ly these more subtle things don=E2=80=99t change easily, because we can=E2= =80=99t easily test them.

Yuan

--000000000000dc9b7305f6277882--