From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition Date: Sat, 22 Jul 2023 13:56:04 +0200 Message-ID: <87mszoqhwr.fsf@thornhill.no> References: <2171209.irdbgypaU6@fedora> <7580204.EvYhyI6sBW@fedora> <87fs5keb9y.fsf@thornhill.no> <1994797.PYKUYFuaPT@3-191.divsi.unimi.it> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4066"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net To: Vincenzo Pupillo , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 22 13:57:16 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 1qNBEa-0000jL-3l for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Jul 2023 13:57:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNBEP-000327-GX; Sat, 22 Jul 2023 07:57:05 -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 1qNBEN-00031k-6N for bug-gnu-emacs@gnu.org; Sat, 22 Jul 2023 07:57: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 1qNBEM-0007B8-TI for bug-gnu-emacs@gnu.org; Sat, 22 Jul 2023 07:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qNBEM-0004A0-4A for bug-gnu-emacs@gnu.org; Sat, 22 Jul 2023 07:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Jul 2023 11:57: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.169002697215925 (code B ref 64647); Sat, 22 Jul 2023 11:57:02 +0000 Original-Received: (at 64647) by debbugs.gnu.org; 22 Jul 2023 11:56:12 +0000 Original-Received: from localhost ([127.0.0.1]:35583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNBDX-00048n-Ht for submit@debbugs.gnu.org; Sat, 22 Jul 2023 07:56:11 -0400 Original-Received: from out-49.mta1.migadu.com ([95.215.58.49]:39172) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNBDU-00048d-Cv for 64647@debbugs.gnu.org; Sat, 22 Jul 2023 07:56:10 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1690026966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sj7X4bs8r0wF96Eu7QWG+iOPROb+7mSmEShBta7aN3U=; b=d/f1Wl0VjdKkTMrWo3oZgPiDrpAzX+qebw4cSYZ+bCJotzJqpwpDzOLQ7AKPLRoYUjjBhY VNlOpGyW1UfBc9cYpGYqfmZTUJGnQe1W1HzJHJ9unFeel9ubFY54G9m3UahmMF3ZxANmZj cVopW4TpjgbBRGWEV2b2IZQwLJq1GxkhB22cKLcHvA7dLpSr4ZVOkUGwvBkJZJWyI5O8bk IoAd6xx+Sj4Y4QW3VwJk3r9eE8UJotowUfBRUwdmJjNm28oCPzxi5RlbRCiQKgAOO16rSb E32LuFqSvhzVaQ7p7gKe5a7+5FOk0lfLY/G43dHfUbgrGfKH8+Qqm9pN/kA1Rg== In-Reply-To: <1994797.PYKUYFuaPT@3-191.divsi.unimi.it> X-Migadu-Flow: FLOW_OUT 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:265802 Archived-At: Vincenzo Pupillo writes: > In data mercoled=C3=AC 19 luglio 2023 07:11:05 CEST, Theodor Thornhill ha= scritto: > >> For Typescript these changes should go into 'tsx-ts-mode, not >> 'typescript-ts-mode. That may be why you are seeing some strange results? > No, exactly the same problem occurs, unfortunately. After all, the source= s of=20 > libtree-sitter-tsx and libtree-sitter-typescript come from the same repos= itory=20 > and the content of tree-sitter-typescript/tsx/grammar.js is just that: > const defineGrammar =3D require('../common/define-grammar'); > module.exports =3D defineGrammar('tsx'); > > >> > --- >>=20 >> "... function to handle ..." > > fixed Thanks for the fixes :) > > > Sorry for the error. I fixed them, tested and fixed the function names ac= cording to your instructions (also in js.el) > Hope the patches are better now. > Thanks. > Vincenzo > No worries! Am I correct in that this patch should be applied as well? If you agree, I'll just apply it myself, no need to make a new patch. Theo diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescri= pt-ts-mode.el index 173ec52f209..39fcd1de30e 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -75,10 +75,10 @@ typescript-ts-mode--syntax-table table) "Syntax table for `typescript-ts-mode'.") =20 -(defun tsx-ts-mode--indent-compatibility-b893426 () +(defun tsx-ts-mode--indent-compatibility-bb1f97b () "Indent rules helper, to handle different releases of tree-sitter-tsx. Check if a node type is available, then return the right indent rules." - ;; handle commit b893426 + ;; handle commit bb1f97b (condition-case nil (progn (treesit-query-capture 'tsx '((jsx_fragment) @capture)) `(((match "<" "jsx_fragment") parent 0) @@ -122,7 +122,7 @@ typescript-ts-mode--indent-rules ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent= -offset) =20 ,@(when (eq language 'tsx) - (append (tsx-ts-mode--indent-compatibility-b893426) + (append (tsx-ts-mode--indent-compatibility-bb1f97b) `(((node-is "jsx_closing_element") parent 0) ((match "jsx_element" "statement") parent typescript-ts-mode-indent-o= ffset) ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset)