From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition Date: Sun, 16 Jul 2023 08:13:43 +0300 Message-ID: <83351obfqw.fsf@gnu.org> References: <2171209.irdbgypaU6@fedora> <874jm5rrgk.fsf@thornhill.no> <83edl9asth.fsf@gnu.org> <2891516.e9J7NaK4W3@fedora> <871qh8sy38.fsf@thornhill.no> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19823"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64647@debbugs.gnu.org, v.pupillo@gmail.com, jostein@kjonigsen.net To: Theodor Thornhill Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 16 07:14:25 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 1qKu5Q-0004uA-MV for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 16 Jul 2023 07:14:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKu59-0002qY-MK; Sun, 16 Jul 2023 01:14:07 -0400 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 1qKu55-0002qI-6O for bug-gnu-emacs@gnu.org; Sun, 16 Jul 2023 01:14:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKu54-0007ug-U5 for bug-gnu-emacs@gnu.org; Sun, 16 Jul 2023 01:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qKu54-0002ju-B6 for bug-gnu-emacs@gnu.org; Sun, 16 Jul 2023 01:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 16 Jul 2023 05:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64647 X-GNU-PR-Package: emacs Original-Received: via spool by 64647-submit@debbugs.gnu.org id=B64647.168948441710490 (code B ref 64647); Sun, 16 Jul 2023 05:14:02 +0000 Original-Received: (at 64647) by debbugs.gnu.org; 16 Jul 2023 05:13:37 +0000 Original-Received: from localhost ([127.0.0.1]:46377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKu4f-0002j8-Af for submit@debbugs.gnu.org; Sun, 16 Jul 2023 01:13:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36950) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKu4c-0002it-Sy for 64647@debbugs.gnu.org; Sun, 16 Jul 2023 01:13:35 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKu4W-0007lK-KC; Sun, 16 Jul 2023 01:13:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=SBbt510Jd9wK2ZDsZ9PR3PmrPDKY93PI7uzWWQLNj0A=; b=XMmCjWPK61pZ jzfQXo8l2uQyJ3CJRAtSSkuW2T9MGvLz8xhXxf6ouZnvPVQfn6fNZnAtCjsKQBM6QVjevKMKAUhqw WHQEaBJEnHvCjcbgBxHTSJKzCk82OAt71GUIF9+iA7VS8nmTsQ2yWBpmiYSmzjuYAzk2W7ZkKH5yV hvyzkcw636+/6ZliwmiXloEH8PrR2waV4Wkg2x7hKOCVRsoFx2DeZUJ4iTx9onfawjy9j/fJzQYDI WNGOfYS3qbbKQCfl/gnXEjHvnuy018DKrehmeLdVIzXyDn1WblKjWL4GOIi6RrdwtiAEei2wmJdJd JtxqMSixvksxCbwCKT3Irw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKu4O-0002vZ-Au; Sun, 16 Jul 2023 01:13:23 -0400 In-Reply-To: <871qh8sy38.fsf@thornhill.no> (message from Theodor Thornhill on Sat, 15 Jul 2023 22:45:31 +0200) 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:265264 Archived-At: > From: Theodor Thornhill > Cc: Eli Zaretskii , 64647@debbugs.gnu.org, > jostein@kjonigsen.net > Date: Sat, 15 Jul 2023 22:45:31 +0200 > > >> > > Will the patch work with the grammar libraries before the recent > >> > > change? > >> > > >> > It will introduce regressions, but the patch itself is a change for the > >> > better, both in emacs land and in the grammar itself. > >> > >> What kinds of regressions? > >> > > Because the nodes seems to have been removed/swapped in for new ones, we > will lose the functionality for people using versions < bb1f97b6. That's what I thought. I think we should try to avoid such regressions if it's feasible. > >> I think what I wrote: that we should try to make our modes work with > >> reasonably old versions of the grammars, if that is practical. While > >> in general it could be a very difficult, if not impossible, to achieve > >> that, the question is whether this particular issue can be solved in > >> that manner. If it can, we should do it. > > Yeah, I think we can do that in this case. I'm just wondering whether > it's worth the effort or not. AFAIU, people tend to have old grammar libraries all the time. For example, we had a couple of bug reports for C or C++ which turned out to be due to grammar libraries that are not the latest HEAD of their respective repositories. Some people tend to use only official releases of those grammar libraries (for those which make releases; many don't). Also, you cannot upgrade the library while the Emacs session which uses it is running, so people who have long-running sessions and don't like to restart Emacs sometimes have no choice but to stay with an old library for some time. For these and other reasons, I think being less rigid in requiring the latest grammar libraries will benefit our users. > Should we introduce some notion of > "deprecated" tree sitter functionalities? Otherwise I guess we'll have > to maintain a growing set of compat-code, which over time will incur a > performance cost, and it may be difficult to remember what code is > compat-code and what isn't. I'm not afraid of compatibility code, as long as it's manageable. We could retire some of that as time passes. But we are not yet at a point where this compatibility code presents any significant issue, so I'd rather we delayed the decision until we come to that bridge. 1> > I can rewrite both patches in the same way I had patched java-ts-mode. > > Basically, there are only two changes. I think it would be useful to have a > > function to check whether grammar features are supported or not. For example, > > a specialized version of treesit-query-validate that could also be used in > > interactive mode (to simplify the development). > > > > Do I rewrite the patches? > > I seem to have missed the java-ts-mode patch. Where is it? Do you have > such an implementation ready at hand? To me it sounds smart to have such > a function, and it sounds like it should be in treesit.el, but that > would probably be too late for emacs-29, I think? A function will probably go to master, but an ad-hoc compatibility fix that doesn't regress for older grammar libraries would be welcome on emacs-29 (assuming it is not very complicated). Thanks.