GNU bug report logs - #66988
30.0.50; treesit-forward-sexp not working properly in js-ts-mode and tsx-ts-mode

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Loïc Lemaître <loic.lemaitre@HIDDEN>; Done: Yuan Fu <casouri@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug marked as fixed in version 30.1, send any further explanations to 66988 <at> debbugs.gnu.org and Loïc Lemaître <loic.lemaitre@HIDDEN> Request was from Yuan Fu <casouri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 66988 <at> debbugs.gnu.org:


Received: (at 66988) by debbugs.gnu.org; 19 Nov 2023 06:19:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 19 01:19:39 2023
Received: from localhost ([127.0.0.1]:49805 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r4b9f-0005BA-8Z
	for submit <at> debbugs.gnu.org; Sun, 19 Nov 2023 01:19:39 -0500
Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]:61739)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1r4b9a-0005Al-0Z
 for 66988 <at> debbugs.gnu.org; Sun, 19 Nov 2023 01:19:37 -0500
Received: by mail-oi1-x233.google.com with SMTP id
 5614622812f47-3b2ec5ee2e4so2353426b6e.3
 for <66988 <at> debbugs.gnu.org>; Sat, 18 Nov 2023 22:19:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1700374767; x=1700979567; darn=debbugs.gnu.org;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=MlajGaMV6ygFBtmvogs7GxKfBc9Ap9LPG3MeqLOKOdU=;
 b=gosvcTw44hK0lnVLpJVLx+WmjDATXZkNzkXMo6jz2kri0oig63oHrQxdB7xoiR+MYN
 DlbY4J7/Zeak+Px2NVrT3Ss8AbtLN6oY9Ysn8TIVgmDGl1KsVVN4B3XSeZV4rWn1lOcS
 akw4IEUSFZMnKzV5q/o3VxlbQ9h7klwCTdsmbQgDKuRHs8USWpKCqL8Bx2RsKLAR53tW
 0KQ5jCDKZ2P81X1kNoblfMvi9Uy3mxoEGt+8ewI0zprkUT6PGTBI1UwAdW/sbk3oRUnW
 g9npOLodc6YitDtirTTEnRQP5XQqNNf350OQVPUleuUOy4en/n6mkHIY2PpaBQbfKKXK
 0Dxw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1700374767; x=1700979567;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=MlajGaMV6ygFBtmvogs7GxKfBc9Ap9LPG3MeqLOKOdU=;
 b=ROP85+xvB9TXUh03aAeXvLz4qn3odRe2nlkxAJDSWJge7WuZSRA2aAOyMwEsWAmRRH
 DIMJ62oJb5lvuJuc4+wMxS0vwDcoRvXG05BSvgySWO3Oz4+gVAfSMZ7FCsQ80DTKGfSB
 kgKSqDca3ZQEQ/1xCDNg5ekpN2FHn5rQIRuRYddKOtywIzzKOst9TGmWai7u5YTnj34P
 xm2GlcoIQ06emqqz0M87494Tu1ZbmmU6CVm0jFuMsU1ljHnGQlanpGYoe60r6GAMSVYU
 Cxz7Xzs4G6V2IIdLXmFxfAhjxEWopHBCFVRTQli7a29hBS5qIC9a+KSLTBEJT9LNn0nf
 VB9A==
X-Gm-Message-State: AOJu0Yypq763cPEDrCf0VCMOV7ICe7/dqs5+49MvrHNJ89okds+FHXKF
 poBhXjY4Im1ABIGt851UzCHtYH5cYEDNsA==
X-Google-Smtp-Source: AGHT+IFN89z0Iwk8F+2Pg2Gx7GgNWMUKNDutECEUZy4m7h/nrZFRJMyWCJs1kL1yFTQ0WBNLZwNW+A==
X-Received: by 2002:a05:6808:4497:b0:3b2:e6a4:e177 with SMTP id
 eq23-20020a056808449700b003b2e6a4e177mr6167763oib.51.1700374767052; 
 Sat, 18 Nov 2023 22:19:27 -0800 (PST)
Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com.
 [172.117.161.177]) by smtp.gmail.com with ESMTPSA id
 h24-20020aa786d8000000b006c60b150383sm4021878pfo.12.2023.11.18.22.19.26
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 18 Nov 2023 22:19:26 -0800 (PST)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\))
Subject: Re: bug#66988: 30.0.50; treesit-forward-sexp not working properly in
 js-ts-mode and tsx-ts-mode
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <83zfzal2el.fsf@HIDDEN>
Date: Sat, 18 Nov 2023 22:19:15 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <BB88A921-47ED-425B-8FD5-A1F0DF557B72@HIDDEN>
References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
 <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
 <BFD5D5A3-8E6C-463F-AE8A-CE12256D16D0@HIDDEN> <83zfzkwxlv.fsf@HIDDEN>
 <1C21FE6B-D54E-4301-AB87-5F15EE06D7D1@HIDDEN> <83cywbryxi.fsf@HIDDEN>
 <6042B192-0400-48E4-9290-940E019B01E3@HIDDEN> <83zfzal2el.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3731.700.6)
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 66988
Cc: Dmitry Gutov <dmitry@HIDDEN>, 66988 <at> debbugs.gnu.org,
 =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>,
 Theodor Thornhill <theo@HIDDEN>,
 =?utf-8?B?TG/Dr2MgTGVtYcOudHJl?= <loic.lemaitre@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Nov 18, 2023, at 9:48 PM, Eli Zaretskii <eliz@HIDDEN> wrote:
>=20
>> From: Yuan Fu <casouri@HIDDEN>
>> Date: Sat, 18 Nov 2023 10:57:56 -0800
>> Cc: Dmitry Gutov <dmitry@HIDDEN>,
>> Theodor Thornhill <theo@HIDDEN>,
>> 66988 <at> debbugs.gnu.org,
>> Lo=C3=AFc Lema=C3=AEtre <loic.lemaitre@HIDDEN>,
>> Mattias Engdeg=C3=A5rd <mattias.engdegard@HIDDEN>
>>=20
>>=20
>>=20
>>> On Nov 15, 2023, at 4:19 AM, Eli Zaretskii <eliz@HIDDEN> wrote:
>>>=20
>>>> From: Yuan Fu <casouri@HIDDEN>
>>>> Date: Tue, 14 Nov 2023 22:28:34 -0800
>>>> Cc: Dmitry Gutov <dmitry@HIDDEN>,
>>>> Theodor Thornhill <theo@HIDDEN>,
>>>> 66988 <at> debbugs.gnu.org,
>>>> loic.lemaitre@HIDDEN
>>>>=20
>>>>> Is it feasible to have a variable that controls whether the full
>>>>> matches are implied in these APIs?  Then we could start by making =
it
>>>>> optional, and at some later time make it the default.
>>>>=20
>>>> It=E2=80=99s feasible, but I don=E2=80=99t think it=E2=80=99s TRT. =
The major mode author should have the control over whether the full =
match is implied, not the user. It doesn=E2=80=99t make sense to toggle =
the variable either. If you change that variable, major mode code must =
also change to be correct.
>>>=20
>>> So what do you suggest that we do about this issue?
>>=20
>> We change every treesit function that takes a regexp for matching =
node type names to imply full match. I think most people wrote code as =
if these functions use full match, so the breakage should be small. And =
I can forecast this change in as many channels as I can.
>=20
> Fine by me, so let's do it.

Ok, I=E2=80=99ll start preparing the patch and news. Meanwhile, folks, =
let me know if anyone has objections.

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.

Message received at 66988 <at> debbugs.gnu.org:


Received: (at 66988) by debbugs.gnu.org; 19 Nov 2023 05:48:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 19 00:48:37 2023
Received: from localhost ([127.0.0.1]:49772 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r4afc-0001Wl-Tr
	for submit <at> debbugs.gnu.org; Sun, 19 Nov 2023 00:48:37 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:53856)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1r4afb-0001Vy-IN
 for 66988 <at> debbugs.gnu.org; Sun, 19 Nov 2023 00:48:36 -0500
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 <eliz@HIDDEN>)
 id 1r4afU-00017L-KC; Sun, 19 Nov 2023 00:48:28 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=ImpgpKeu+/OFOrdznwoG7F3JFkCWjlHOlJhsJFANeyM=; b=j3tvr4a9uU6FD9gz+ogJ
 zYULV2iIJyWZP7hMoGvGRZSRpl6BEDBZ4nG1rKAn0Wb7mMKl8V3BjuJLiqzZuJUkDYS06ay70Q5tM
 NvINV7kjvFndyVjX9TeileEqaLxtIdw0Fjf60JcRolmZiYLnhyCxalY1WEV75j/ukdsbOPUKEBVbL
 47TM3jU5pMDPDCqxshrqTnwTUDWhiSHLb9U88Ee+Q0JSqcskSwDMKzJM8rnSsj8pHB7WKDTfYlVYv
 aJYeIWjtatzvmdmOUvSmhe70xgggj+/8+ZT8sNuJqlmkgmaFkkS+KkiXbzAQ4DxoXVqX2HOV00hUp
 62ullMdK83U1BA==;
Date: Sun, 19 Nov 2023 07:48:02 +0200
Message-Id: <83zfzal2el.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <6042B192-0400-48E4-9290-940E019B01E3@HIDDEN> (message from
 Yuan Fu on Sat, 18 Nov 2023 10:57:56 -0800)
Subject: Re: bug#66988: 30.0.50; treesit-forward-sexp not working properly in
 js-ts-mode and tsx-ts-mode
References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
 <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
 <BFD5D5A3-8E6C-463F-AE8A-CE12256D16D0@HIDDEN> <83zfzkwxlv.fsf@HIDDEN>
 <1C21FE6B-D54E-4301-AB87-5F15EE06D7D1@HIDDEN> <83cywbryxi.fsf@HIDDEN>
 <6042B192-0400-48E4-9290-940E019B01E3@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 66988
Cc: dmitry@HIDDEN, 66988 <at> debbugs.gnu.org, mattias.engdegard@HIDDEN,
 theo@HIDDEN, loic.lemaitre@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Yuan Fu <casouri@HIDDEN>
> Date: Sat, 18 Nov 2023 10:57:56 -0800
> Cc: Dmitry Gutov <dmitry@HIDDEN>,
>  Theodor Thornhill <theo@HIDDEN>,
>  66988 <at> debbugs.gnu.org,
>  Loïc Lemaître <loic.lemaitre@HIDDEN>,
>  Mattias Engdegård <mattias.engdegard@HIDDEN>
> 
> 
> 
> > On Nov 15, 2023, at 4:19 AM, Eli Zaretskii <eliz@HIDDEN> wrote:
> > 
> >> From: Yuan Fu <casouri@HIDDEN>
> >> Date: Tue, 14 Nov 2023 22:28:34 -0800
> >> Cc: Dmitry Gutov <dmitry@HIDDEN>,
> >> Theodor Thornhill <theo@HIDDEN>,
> >> 66988 <at> debbugs.gnu.org,
> >> loic.lemaitre@HIDDEN
> >> 
> >>> Is it feasible to have a variable that controls whether the full
> >>> matches are implied in these APIs?  Then we could start by making it
> >>> optional, and at some later time make it the default.
> >> 
> >> It’s feasible, but I don’t think it’s TRT. The major mode author should have the control over whether the full match is implied, not the user. It doesn’t make sense to toggle the variable either. If you change that variable, major mode code must also change to be correct.
> > 
> > So what do you suggest that we do about this issue?
> 
> We change every treesit function that takes a regexp for matching node type names to imply full match. I think most people wrote code as if these functions use full match, so the breakage should be small. And I can forecast this change in as many channels as I can.

Fine by me, so let's do it.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.

Message received at 66988 <at> debbugs.gnu.org:


Received: (at 66988) by debbugs.gnu.org; 18 Nov 2023 18:58:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 18 13:58:19 2023
Received: from localhost ([127.0.0.1]:49525 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r4QWI-0000wr-RS
	for submit <at> debbugs.gnu.org; Sat, 18 Nov 2023 13:58:19 -0500
Received: from mail-oa1-x31.google.com ([2001:4860:4864:20::31]:51213)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1r4QWF-0000wb-JK
 for 66988 <at> debbugs.gnu.org; Sat, 18 Nov 2023 13:58:17 -0500
Received: by mail-oa1-x31.google.com with SMTP id
 586e51a60fabf-1efad296d42so1751586fac.2
 for <66988 <at> debbugs.gnu.org>; Sat, 18 Nov 2023 10:58:14 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1700333889; x=1700938689; darn=debbugs.gnu.org;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=+q+BGbuwY6KgMHxzzy3Nf+XUkcCzl9Fv9tqaB29VeWM=;
 b=mC3FKX+OLJibEjVYIpn2H3ApQQnNG3OOH2wvtAI8GPDdBzy0OEZDGcUmIM7q5kLW7n
 DB/x6hWYLKuy/DQqeUpnJUNuvXFkVLXYyiJT6NliEgyqiqT6GPLZuXr9ZZyNApzE8EaU
 +xUYrS5b13nx9wvGMlq4J2JOuzRAve6tJbN6h/98c63sWCqIrF/bSf3Tv4ChLrR5lKUF
 GKcTXYnuVVHlw6Mko6JF4kW8nl0UrZpr+7at1XNfqXw4VzN6bicOBL8EHJLrNlzWAzHL
 Xb8CbmLuRm8hAZ5crGsR4kbPl+adiWsOHMmM7vj3dS5r+gKHwhgxzJyD2PFqz7MUUYdT
 9MPQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1700333889; x=1700938689;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=+q+BGbuwY6KgMHxzzy3Nf+XUkcCzl9Fv9tqaB29VeWM=;
 b=iQnEGbXIHs80huRItTZ25DAJSh2BeYOkX9I4L62NH0qPSen0GaYTLo2BMXatMMOfhg
 yvSFXKKMGxL7tr/+UtJAOmspQ7tUdKTULoN96qGb5HQ3b+790jRsxRW0RfBZXOE24YB1
 ThujvSEJtRRQ96ZaILd3yx8qposBrVMXYlm7u/UHOLuwQOxPAzZ6xDXNAzPCM3nA0ZkN
 pZtHdgyd8DjqKWelW/mERt4KPeHs4+CePn2CaZiRbvL6FMHJU4MbuPMt8/erbK7jHZkn
 atq9XkD/Wx9HNBELDuN3+/CS002OhOfsuqUM36XRM5m3oe5SondsmirU0JNh3EI5zmuX
 sqoQ==
X-Gm-Message-State: AOJu0YwgRw7wBOBoReF6OzSlT5ETEboprW2Y9wFoOOuBwETSHWaWv+RT
 OqW4x6UD0LXH0+6fEQ1E5DE=
X-Google-Smtp-Source: AGHT+IH2++Uylmc49fDfWhkd+U6LUxGKos6h17IeKcMeB/+ozVGUV83IFOS2FG3JTC1KCs3WqxGZVA==
X-Received: by 2002:a05:6870:aa85:b0:1e9:a713:7ad6 with SMTP id
 gr5-20020a056870aa8500b001e9a7137ad6mr3459095oab.44.1700333888802; 
 Sat, 18 Nov 2023 10:58:08 -0800 (PST)
Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com.
 [172.117.161.177]) by smtp.gmail.com with ESMTPSA id
 7-20020a17090a01c700b0027d0a60b9c9sm5556417pjd.28.2023.11.18.10.58.07
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 18 Nov 2023 10:58:08 -0800 (PST)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\))
Subject: Re: bug#66988: 30.0.50; treesit-forward-sexp not working properly in
 js-ts-mode and tsx-ts-mode
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <83cywbryxi.fsf@HIDDEN>
Date: Sat, 18 Nov 2023 10:57:56 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <6042B192-0400-48E4-9290-940E019B01E3@HIDDEN>
References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
 <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
 <BFD5D5A3-8E6C-463F-AE8A-CE12256D16D0@HIDDEN> <83zfzkwxlv.fsf@HIDDEN>
 <1C21FE6B-D54E-4301-AB87-5F15EE06D7D1@HIDDEN> <83cywbryxi.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3731.700.6)
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 66988
Cc: Dmitry Gutov <dmitry@HIDDEN>, 66988 <at> debbugs.gnu.org,
 =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>,
 Theodor Thornhill <theo@HIDDEN>,
 =?utf-8?B?TG/Dr2MgTGVtYcOudHJl?= <loic.lemaitre@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Nov 15, 2023, at 4:19 AM, Eli Zaretskii <eliz@HIDDEN> wrote:
>=20
>> From: Yuan Fu <casouri@HIDDEN>
>> Date: Tue, 14 Nov 2023 22:28:34 -0800
>> Cc: Dmitry Gutov <dmitry@HIDDEN>,
>> Theodor Thornhill <theo@HIDDEN>,
>> 66988 <at> debbugs.gnu.org,
>> loic.lemaitre@HIDDEN
>>=20
>>> Is it feasible to have a variable that controls whether the full
>>> matches are implied in these APIs?  Then we could start by making it
>>> optional, and at some later time make it the default.
>>=20
>> It=E2=80=99s feasible, but I don=E2=80=99t think it=E2=80=99s TRT. =
The major mode author should have the control over whether the full =
match is implied, not the user. It doesn=E2=80=99t make sense to toggle =
the variable either. If you change that variable, major mode code must =
also change to be correct.
>=20
> So what do you suggest that we do about this issue?

We change every treesit function that takes a regexp for matching node =
type names to imply full match. I think most people wrote code as if =
these functions use full match, so the breakage should be small. And I =
can forecast this change in as many channels as I can.

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.

Message received at 66988 <at> debbugs.gnu.org:


Received: (at 66988) by debbugs.gnu.org; 15 Nov 2023 17:07:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 15 12:07:48 2023
Received: from localhost ([127.0.0.1]:53460 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r3JMi-0006Dm-J2
	for submit <at> debbugs.gnu.org; Wed, 15 Nov 2023 12:07:48 -0500
Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]:59852)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1r3JMg-0006DT-5z
 for 66988 <at> debbugs.gnu.org; Wed, 15 Nov 2023 12:07:47 -0500
Received: by mail-qv1-xf31.google.com with SMTP id
 6a1803df08f44-6711dd6595fso36493926d6.3
 for <66988 <at> debbugs.gnu.org>; Wed, 15 Nov 2023 09:07:46 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1700068061; x=1700672861; darn=debbugs.gnu.org;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=7qqLfiPEjK9FtR30Si6VvIn2YdOJ0ePJkJ51c5yXvCY=;
 b=NKrZASM17kqk7ViesamYRkgjAF8wkSjljmYV94lZ58exOtSN+7kudHsGDFKRcC0a+k
 KCR42mlK+UKDqwYmmRLYgFjBwOLdPRFSBXjxflbC/zi8YRl9jPG2s7JxhdMpmxJ6VA/p
 V4tGXY5DgN/SUyOUANdK97vN2gyI1IVVne8P0YDGu7VySo5Og60wy9nXP4P9u7KSCVpR
 an69Di0lSH1Rd3JOEdbHnqYtTxC/FV9pT7/45Z8m+ye85kohWJXVjcfE6sTEj8rdrwI5
 2ZvHrHp5Fq01weE8YIMsWlRf5uJCLbqLBwsXxxPiOSIFZlzklqd4Tc/RwZTxHWL8LQtJ
 QI8A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1700068061; x=1700672861;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=7qqLfiPEjK9FtR30Si6VvIn2YdOJ0ePJkJ51c5yXvCY=;
 b=N4DDAAkWjvIGVvB6bs8644hOux+fqogiqJtr5hQfAIZi7FRXX8xwvGD9GZ40xPyVU/
 sr827wpEA+cjH80s1U0SwtJkN53B8YU/rxEU6HFmfDvrcbPkB3CtVVrMORw3D7hKnxF3
 gC7rFd2GMFxSmfVwvCr7Be50zg+BYWBljYdDu6PDuJYz4U21LrfyK0mDXLDIQLrfxgso
 FkPOQtIYUYfLxCWVy+o1OrmngFTbgSYBvo10vLixS4I51WADTiX32DFaamRDbm8igyAL
 txEcW/bgvQfdJN/NdzQChWvIXC7RtFRLcp4yTYopvlwC3bAksyBV9PDs+wL0HJKxB+3V
 BKWA==
X-Gm-Message-State: AOJu0YyKxYC22FiUo8izHUXSrSpv+xQYX1e1gxGoNCQ/Zj0gpLb3+7ca
 z9xaXAhR0xDJXkMHWFwUpw7g8dBI3CY=
X-Google-Smtp-Source: AGHT+IERpLqeBp93tHq2pK3wFOfGkZlhGTGCvgKk4CZXJumwHeIyFUvmsvQ4oKqEbQ4ov9H8QGw3cQ==
X-Received: by 2002:a05:6a00:4186:b0:6bd:a8a3:cc59 with SMTP id
 ca6-20020a056a00418600b006bda8a3cc59mr15755245pfb.24.1700029727449; 
 Tue, 14 Nov 2023 22:28:47 -0800 (PST)
Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com.
 [172.117.161.177]) by smtp.gmail.com with ESMTPSA id
 x37-20020a056a000be500b006b22218cb92sm2185435pfu.43.2023.11.14.22.28.46
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 14 Nov 2023 22:28:47 -0800 (PST)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\))
Subject: Re: bug#66988: 30.0.50; treesit-forward-sexp not working properly in
 js-ts-mode and tsx-ts-mode
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <83zfzkwxlv.fsf@HIDDEN>
Date: Tue, 14 Nov 2023 22:28:34 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <1C21FE6B-D54E-4301-AB87-5F15EE06D7D1@HIDDEN>
References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
 <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
 <BFD5D5A3-8E6C-463F-AE8A-CE12256D16D0@HIDDEN> <83zfzkwxlv.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3731.700.6)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 66988
Cc: Dmitry Gutov <dmitry@HIDDEN>, 66988 <at> debbugs.gnu.org,
 Theodor Thornhill <theo@HIDDEN>, loic.lemaitre@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Nov 10, 2023, at 11:35 PM, Eli Zaretskii <eliz@HIDDEN> wrote:
>=20
>> Cc: Theodor Thornhill <theo@HIDDEN>, 66988 <at> debbugs.gnu.org,
>> Lo=C3=AFc Lema=C3=AEtre <loic.lemaitre@HIDDEN>
>> From: Yuan Fu <casouri@HIDDEN>
>> Date: Fri, 10 Nov 2023 18:41:20 -0800
>>=20
>>> Alternatively, treesit-thing-settings could be interpreted to imply =
full matches, then the code using it should not only match against the =
regexps but also check that the entire string (type name) is matched.
>>=20
>> I regret not doing this by default for treesit-indent-rules and =
traverse functions. Now it=E2=80=99s hard to change without creating =
confusion and breaking backward compatibility. I wonder if there are =
good way to smoothly transition to match full names by default=E2=80=A6
>>=20
>> Treesit-thing-settings can be changed to match full names, but only =
if we can change treesit-indent-rules and friends too. Otherwise it =
would be too confusing.
>=20
> Is it feasible to have a variable that controls whether the full
> matches are implied in these APIs?  Then we could start by making it
> optional, and at some later time make it the default.

It=E2=80=99s feasible, but I don=E2=80=99t think it=E2=80=99s TRT. The =
major mode author should have the control over whether the full match is =
implied, not the user. It doesn=E2=80=99t make sense to toggle the =
variable either. If you change that variable, major mode code must also =
change to be correct.

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.

Message received at 66988 <at> debbugs.gnu.org:


Received: (at 66988) by debbugs.gnu.org; 15 Nov 2023 16:28:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 15 11:28:10 2023
Received: from localhost ([127.0.0.1]:53126 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r3IkL-00028J-8c
	for submit <at> debbugs.gnu.org; Wed, 15 Nov 2023 11:28:09 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:58120)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1r3IQh-0001QS-K1
 for 66988 <at> debbugs.gnu.org; Wed, 15 Nov 2023 11:07:52 -0500
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 <eliz@HIDDEN>)
 id 1r3EsF-00068a-B1; Wed, 15 Nov 2023 07:20:04 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=Y0ixRc1bbth1NhemQ8VhnMtmWHIm6ll0jIrvzpV80fM=; b=FzvjSrqSZHUvMAm3/RAm
 xgPaitA2eCcVQ/7UuGfKFf/2U+fxBm8iy1v4sOX6nHu1ytlERr1CuCGNIDeqxcWA4/oNKw3hyQ14r
 yutrWAfQDEs+UmxDOXqp2WTxA5dBRCtlYInoAoqqcfPr9dy2GAfQx2jpFaIeqiuXzWpurmWew+n71
 kbZAgLvLufcYHsfaAMQi/8yqnmvqdmsD+95bgblzjPFEeYnM4y/hRuzLIUbVuzi5F0ow+KKbZqQE6
 qvbb/sF84I7dTGPc3LXP1DMotDnhaq1DnbKnSbTfEIOzUoQuzZULN0+gvlrr68NXEYnewPubF36Ta
 s0IMvVFufoSvDA==;
Date: Wed, 15 Nov 2023 14:19:53 +0200
Message-Id: <83cywbryxi.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <1C21FE6B-D54E-4301-AB87-5F15EE06D7D1@HIDDEN> (message from
 Yuan Fu on Tue, 14 Nov 2023 22:28:34 -0800)
Subject: Re: bug#66988: 30.0.50; treesit-forward-sexp not working properly in
 js-ts-mode and tsx-ts-mode
References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
 <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
 <BFD5D5A3-8E6C-463F-AE8A-CE12256D16D0@HIDDEN> <83zfzkwxlv.fsf@HIDDEN>
 <1C21FE6B-D54E-4301-AB87-5F15EE06D7D1@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 66988
Cc: dmitry@HIDDEN, 66988 <at> debbugs.gnu.org, theo@HIDDEN,
 loic.lemaitre@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Yuan Fu <casouri@HIDDEN>
> Date: Tue, 14 Nov 2023 22:28:34 -0800
> Cc: Dmitry Gutov <dmitry@HIDDEN>,
>  Theodor Thornhill <theo@HIDDEN>,
>  66988 <at> debbugs.gnu.org,
>  loic.lemaitre@HIDDEN
> 
> > Is it feasible to have a variable that controls whether the full
> > matches are implied in these APIs?  Then we could start by making it
> > optional, and at some later time make it the default.
> 
> It’s feasible, but I don’t think it’s TRT. The major mode author should have the control over whether the full match is implied, not the user. It doesn’t make sense to toggle the variable either. If you change that variable, major mode code must also change to be correct.

So what do you suggest that we do about this issue?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.

Message received at 66988 <at> debbugs.gnu.org:


Received: (at 66988) by debbugs.gnu.org; 15 Nov 2023 15:58:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 15 10:58:50 2023
Received: from localhost ([127.0.0.1]:52971 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r3IHy-0001Aw-6Z
	for submit <at> debbugs.gnu.org; Wed, 15 Nov 2023 10:58:50 -0500
Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:57798)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1r3IHv-0001Ah-NJ
 for 66988 <at> debbugs.gnu.org; Wed, 15 Nov 2023 10:58:49 -0500
Received: by mail-pj1-x102f.google.com with SMTP id
 98e67ed59e1d1-28094a3b760so570574a91.3
 for <66988 <at> debbugs.gnu.org>; Wed, 15 Nov 2023 07:58:48 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1700063922; x=1700668722; darn=debbugs.gnu.org;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=xIZzjr2SBWaFD8s+O0cBG1CS9ZPWNI244ON+uSfpU2c=;
 b=nH8Piqc8xxDQp0UBzlhObqrS96x/+y/tqeboXgj4lkctk44GEQ9ZbCl8bp7xctI3qc
 F/sjJjoZc+SzdVq+gq8IRAXRBmHIGLM6xsDy4HgjSmN0zuQBz/tP36NyxxBBKZ6XMBJW
 bPspep8kOLRCzdwkkFj+PLxd1hfjwrTBeKkkXLE8rZdSujPGjbyWIolgJc8E4Bn6WWzt
 8IMJbLBy6i8rst1fi+mfIVjvB8nWEY7iW1iGsGgpYnyAeZILNO2zLpu0UqmIRrRzTuMf
 gTcvjeoM9NMefOcGhA4HoWXvx6PPvamtTHbHCbe78Y/YLx4/BA9WEwgq/pkry6ewPhqg
 RqlA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1700063922; x=1700668722;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=xIZzjr2SBWaFD8s+O0cBG1CS9ZPWNI244ON+uSfpU2c=;
 b=ZRrVO9VPBe0GS7dJxSXhyh4xq1gus5zT5kuKXEeoXPmJihFnDv4/kuvee3TxK4xfbO
 728nFgtIpFJ0VPG2kHZtZJe9feFN4ABDaZ/a6zyResfHyOlNOHbRAYOsIL0h/bvO985e
 swHY7SCIaRSIHsu/MAGZHfKzgBkg/x2verNJ7IFvbTi8d2Zff8jxYwfmLVKwd26Ako5N
 3gB6yhj+JdH3rziJXXrPNoSn4QYBKD38r7SJaKQFIYUM8Zf8s41tVeUbCMjkRN25EX5q
 d6frRFsXK3voLyKPt7Yjq5TOiBoxN5V4mWZhUJfdsC8vxwkeraU9bUWn2qaxR8ZTFVfs
 s+WA==
X-Gm-Message-State: AOJu0Yw16PKq4+0esiqy0ehZsuD1vDe92yVVSiSYmii5BMkz94vfb0H0
 rrSnefV/ibizE1y3oS42L9y1pDomwY8=
X-Google-Smtp-Source: AGHT+IEplFS9TzedmweDiuc9C0qQIi3jyD0Zw4qLSxM26YVTcOoY6xb0J1tizmrzmsK1djesXSZPMw==
X-Received: by 2002:a17:903:244d:b0:1cc:2ef7:2abe with SMTP id
 l13-20020a170903244d00b001cc2ef72abemr5176670pls.48.1700029955665; 
 Tue, 14 Nov 2023 22:32:35 -0800 (PST)
Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com.
 [172.117.161.177]) by smtp.gmail.com with ESMTPSA id
 j9-20020a170903024900b001b8b1f6619asm6741401plh.75.2023.11.14.22.32.34
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 14 Nov 2023 22:32:35 -0800 (PST)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\))
Subject: Re: bug#66988: 30.0.50; treesit-forward-sexp not working properly in
 js-ts-mode and tsx-ts-mode
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <e88344bd-0acc-a9a1-b91f-bd4339282824@HIDDEN>
Date: Tue, 14 Nov 2023 22:32:24 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <54F9F1A6-5162-4115-93CE-633B2349AC76@HIDDEN>
References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
 <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
 <BFD5D5A3-8E6C-463F-AE8A-CE12256D16D0@HIDDEN>
 <e88344bd-0acc-a9a1-b91f-bd4339282824@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
X-Mailer: Apple Mail (2.3731.700.6)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 66988
Cc: Theodor Thornhill <theo@HIDDEN>, 66988 <at> debbugs.gnu.org,
 =?utf-8?B?TG/Dr2MgTGVtYcOudHJl?= <loic.lemaitre@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Nov 11, 2023, at 2:49 AM, Dmitry Gutov <dmitry@HIDDEN> wrote:
>=20
> On 11/11/2023 04:41, Yuan Fu wrote:
>> I regret not doing this by default for treesit-indent-rules and =
traverse functions. Now it=E2=80=99s hard to change without creating =
confusion and breaking backward compatibility. I wonder if there are =
good way to smoothly transition to match full names by default=E2=80=A6
>> Treesit-thing-settings can be changed to match full names, but only =
if we can change treesit-indent-rules and friends too. Otherwise it =
would be too confusing.
>=20
> It's my understanding that the current implementation, when it doesn't =
use a full match, is a potential bug in every single instance.

That=E2=80=99s a good point.

> Perhaps you have an example of when partial match is intended and =
beneficial? If so, we can just go through all other regexps and wrap =
them in \` and \'. And should.

I don=E2=80=99t, except for a very few cases where I saved typing a few =
characters.

You have a good point. I think most people instinctively write the full =
match in their code anyway, so changing to the full match should be =
fine. We can start from master and see if the world ends or not.=20

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.

Message received at 66988 <at> debbugs.gnu.org:


Received: (at 66988) by debbugs.gnu.org; 12 Nov 2023 12:11:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 12 07:11:06 2023
Received: from localhost ([127.0.0.1]:55183 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r29Iw-0000tb-1w
	for submit <at> debbugs.gnu.org; Sun, 12 Nov 2023 07:11:06 -0500
Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:60553)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <loic.lemaitre@HIDDEN>) id 1r29It-0000t5-H0
 for 66988 <at> debbugs.gnu.org; Sun, 12 Nov 2023 07:11:04 -0500
Received: by mail-wr1-x42e.google.com with SMTP id
 ffacd0b85a97d-32db188e254so2121474f8f.0
 for <66988 <at> debbugs.gnu.org>; Sun, 12 Nov 2023 04:10:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1699791016; x=1700395816; darn=debbugs.gnu.org;
 h=content-transfer-encoding:in-reply-to:from:references:to
 :content-language:subject:user-agent:mime-version:date:message-id
 :from:to:cc:subject:date:message-id:reply-to;
 bh=F1JltHOS9GIKUza5gD/nAii8qvfSjuIEdwhairDrgvI=;
 b=HxOHHBxHX/5sv/4BFgW3NJRqk0qWVxO2HE9blacrOPygUMPlRc05YurSaH9fbzIhm1
 DOgpldZt9kKjtc12EDatXkrEXoMaBTx9arESQyd7797KSKjuJX9tcruFfNnxtEij1vgX
 /dgOgWAluRe3zyKTrQMFhL9R8XXznRPgdiwmRa0GW+OoXDKkASBU0RZ4qz3JzMNOfU1U
 cthTiOmMNS3Eu8ZB70jxm6IYLRkeT6+JcIeivImNDTZX4rpmyYTjEmjWjQr94BDFmgG2
 sio7ZgNk+TH7MT+Dow1hvZWkSC3ubkQLliPuhD/2aFdsIY5PgJITzaXNL6eUvVSP0CzD
 Ubjg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1699791016; x=1700395816;
 h=content-transfer-encoding:in-reply-to:from:references:to
 :content-language:subject:user-agent:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=F1JltHOS9GIKUza5gD/nAii8qvfSjuIEdwhairDrgvI=;
 b=tKDmlfVQiCw1UeW7tBdI75BZ3I+3mCPK/kzsSaNriiMjblgK9ItENlgSwmzYKGYixT
 HEalxchE2nI6arTT9InnvgXRAJAN3zn0Re1mvHkFdGKh8M93dJUKEzV+zPoxxoz+DyHS
 JlK1UKJElHEwXYiEX4hi9VrPm2EpKWN30fiJPaxrWriYmjLXRhn1MGUrSGdd0eVhxp2e
 w9vK/XDlmKwO07bcvDQP3L3MwEFRtjVonCgV4zcCRWaBZ5BY89SXttmAiMXuf4VWvmO2
 8pr/tadieFSEx9CwfDVid7OLGL8JBt0FAOf279WJF3kG8GqDT2cW6MbdnDTFkRfCYLRd
 bjtQ==
X-Gm-Message-State: AOJu0YzYwxBzsJNm6UfMQqNdJ9k3POdOViogmMMRxACaVCrE7jtvhupS
 MTVSKnp2xrf8Qr/9tJBjkpY=
X-Google-Smtp-Source: AGHT+IGv8i/xqTITN2EkNA4TBsN2aV7LBstSwdtOVsB86w7AWm+W2YWo60zHS5lJUMEkDQ3vQVzvYQ==
X-Received: by 2002:a05:6000:18ad:b0:331:325d:6309 with SMTP id
 b13-20020a05600018ad00b00331325d6309mr3684455wri.69.1699791016306; 
 Sun, 12 Nov 2023 04:10:16 -0800 (PST)
Received: from ?IPV6:2a02:8428:2fa4:4b01:ef35:71a1:d98d:592e?
 ([2a02:8428:2fa4:4b01:ef35:71a1:d98d:592e])
 by smtp.gmail.com with ESMTPSA id
 d13-20020a056000114d00b003140f47224csm3220946wrx.15.2023.11.12.04.10.15
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sun, 12 Nov 2023 04:10:15 -0800 (PST)
Message-ID: <b43386de-1444-458f-8203-c914ab51e9a8@HIDDEN>
Date: Sun, 12 Nov 2023 13:10:14 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#66988: 30.0.50; treesit-forward-sexp not working properly in
 js-ts-mode and tsx-ts-mode
Content-Language: fr
To: Dmitry Gutov <dmitry@HIDDEN>, 66988 <at> debbugs.gnu.org,
 Yuan Fu <casouri@HIDDEN>, Theodor Thornhill <theo@HIDDEN>
References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
 <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
 <102c3f66-4d74-49b9-a099-0c54e5d1c635@HIDDEN>
 <a26ca9d5-54de-0079-6f68-5d13f2a9d8a0@HIDDEN>
From: =?UTF-8?B?TG/Dr2MgTGVtYcOudHJl?= <loic.lemaitre@HIDDEN>
In-Reply-To: <a26ca9d5-54de-0079-6f68-5d13f2a9d8a0@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66988
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Sorry for my example that is actually not valid JSX...
Yours demontrates better the remaining issue.

Thanks

Loïc

Le 12/11/2023 à 00:40, Dmitry Gutov a écrit :
> On 11/11/2023 17:43, Loïc Lemaître wrote:
>> Thanks for the patch ! It fixes the bug.
>> But unfortunatly, there is another similar bug in 
>> /treesit-forward-sexp/, that you can reproduce with that example:
>> ({(<A></A>)});
>
> The problem in this case is that the code doesn't parse (one of the 
> nodes in the parse tree is ERROR). Removing either the curlies, or the 
> outer parens pair makes the code valid and the behavior 
> correspondingly better.
>
> Although for treesit-forward-sexp to jump between curlies in
>
>   {(<A></A>)};
>
> we'll also need to add "statement_block" to js--treesit-sexp-nodes.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.

Message received at 66988 <at> debbugs.gnu.org:


Received: (at 66988) by debbugs.gnu.org; 11 Nov 2023 23:41:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 11 18:41:16 2023
Received: from localhost ([127.0.0.1]:54664 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r1xbH-0003El-Q5
	for submit <at> debbugs.gnu.org; Sat, 11 Nov 2023 18:41:16 -0500
Received: from out3-smtp.messagingengine.com ([66.111.4.27]:43373)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1r1xbF-0003ET-4C
 for 66988 <at> debbugs.gnu.org; Sat, 11 Nov 2023 18:41:13 -0500
Received: from compute7.internal (compute7.nyi.internal [10.202.2.48])
 by mailout.nyi.internal (Postfix) with ESMTP id 06EB45C00E7;
 Sat, 11 Nov 2023 18:40:27 -0500 (EST)
Received: from mailfrontend2 ([10.202.2.163])
 by compute7.internal (MEProxy); Sat, 11 Nov 2023 18:40:27 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :content-transfer-encoding:content-type:content-type:date:date
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm2; t=
 1699746027; x=1699832427; bh=VZzJKqvr7/8eR6XetrjCJSG+INyw+2Q6wIw
 rhqUysz8=; b=VnBYiIh67mXu2Ebm5VPQtPPATPNko0RstQzgUWSQuN3hXSeSD5/
 gsbJ43UxZ6lk5WZPOr6kqyWOFRS1b57/JMcksyeOUYdjvQXig9Q45snpTGeoku/Q
 Iijk712l8l379z6zZdlb1qGW1Or26t62EiNSQBJzEesIVEVc74Bq9tfqx1QD6rk5
 HGJpKVgAUzawj8ELRyhfmFf3Sd5dr1+hjxDaFx61O3DOCWxYzXc7T0ATte6hPoMV
 sQrkYQfi7IRfP41nxW38JPSyGcMjNRE6h1ZT+S61w6S55SenTY17xjJrYjB+mqR+
 qHv4IQKHUNh5P5FDxqVgMc9A4Is67/QdTgQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :content-type:date:date:feedback-id:feedback-id:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1699746027; x=
 1699832427; bh=VZzJKqvr7/8eR6XetrjCJSG+INyw+2Q6wIwrhqUysz8=; b=F
 FksTyO6jz0qWxh3b8OgbNOOSYWqBzqTT02NrVyHLp+QcPVKRi+4fGpTRewQQR5Be
 zsd8vyKfrlgYdDcU96E2OI3UDDQsRXx8KNJGSW5jv/AKHLfzyQCBkIjZE/xykqX6
 w306YcJaS/FNaVuts4B0W3K59ikDzmZBhg1ugETLOCldbXd6eBH1dZ9sxctP/BEA
 nRFmc4+wvIYX6+YWuQcJ4tPvhiexGN96r11H/mO/zKTJEYfUGNkETfa8FTDZ6HfP
 W8EfZwimvkzeEvRjnMGPtVdFoHfZzEyLHNESpLpFEKFngV4GqWwScvcKrlHbQsej
 roJpymjQlMaRJFI92s8TA==
X-ME-Sender: <xms:6hBQZaC3YZVSa2Xaq2cBtwU4PWCvxQnb6AqCcMBQMMur9mOB7nUtag>
 <xme:6hBQZUgLC7VI4B8acXv_SJRh3-5Ew10hthQTuhG7Xhr-q3qMXXGZB7SUSY3n2GbId
 EWfXKIKXQ9GHB9YSlg>
X-ME-Received: <xmr:6hBQZdnVls8nP97_I3vS85bQTKYtK48-UWWvjKuWw0BGt9Ws8Mv_zJo5ocK3UQA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddviedgudefucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvfhfhjggtgfesthekredttdefjeenucfhrhhomhepffhmihht
 rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth
 gvrhhnpeefjeekvedvfeelfedufeevgeetvdevkeelvddtueetteefudefgfduieekffei
 leenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh
 hithhrhiesghhuthhovhdruggvvh
X-ME-Proxy: <xmx:6hBQZYxvSX6etRCJSMziPEcjhjSIWdLPRMCrc6wu5D-C7sQ4bKZsyA>
 <xmx:6hBQZfQK0DgQBZHbpOhbF9-6AiLzGMBLZHhYF0Tm2eXkkE3gW9d_kw>
 <xmx:6hBQZTZ-Qkw4dn76DJWNqNn0JX1PsqkRJZhDt3605_CAoE6vRxbQBg>
 <xmx:6xBQZacCrmd6nv7xlw0YJg0ktU4lPQ_J-3360fyyNe3YEabHtXxutw>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 11 Nov 2023 18:40:25 -0500 (EST)
Message-ID: <a26ca9d5-54de-0079-6f68-5d13f2a9d8a0@HIDDEN>
Date: Sun, 12 Nov 2023 01:40:22 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#66988: 30.0.50; treesit-forward-sexp not working properly in
 js-ts-mode and tsx-ts-mode
Content-Language: en-US
To: =?UTF-8?B?TG/Dr2MgTGVtYcOudHJl?= <loic.lemaitre@HIDDEN>,
 66988 <at> debbugs.gnu.org, Yuan Fu <casouri@HIDDEN>,
 Theodor Thornhill <theo@HIDDEN>
References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
 <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
 <102c3f66-4d74-49b9-a099-0c54e5d1c635@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <102c3f66-4d74-49b9-a099-0c54e5d1c635@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.2 (--)
X-Debbugs-Envelope-To: 66988
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.2 (---)

On 11/11/2023 17:43, Loïc Lemaître wrote:
> Thanks for the patch ! It fixes the bug.
> But unfortunatly, there is another similar bug in 
> /treesit-forward-sexp/, that you can reproduce with that example:
> ({(<A></A>)});

The problem in this case is that the code doesn't parse (one of the 
nodes in the parse tree is ERROR). Removing either the curlies, or the 
outer parens pair makes the code valid and the behavior correspondingly 
better.

Although for treesit-forward-sexp to jump between curlies in

   {(<A></A>)};

we'll also need to add "statement_block" to js--treesit-sexp-nodes.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.

Message received at 66988 <at> debbugs.gnu.org:


Received: (at 66988) by debbugs.gnu.org; 11 Nov 2023 15:43:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 11 10:43:58 2023
Received: from localhost ([127.0.0.1]:53964 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r1q9N-00025M-LQ
	for submit <at> debbugs.gnu.org; Sat, 11 Nov 2023 10:43:58 -0500
Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:49567)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <loic.lemaitre@HIDDEN>) id 1r1q9L-000254-1R
 for 66988 <at> debbugs.gnu.org; Sat, 11 Nov 2023 10:43:55 -0500
Received: by mail-wr1-x435.google.com with SMTP id
 ffacd0b85a97d-32d9d8284abso1890127f8f.3
 for <66988 <at> debbugs.gnu.org>; Sat, 11 Nov 2023 07:43:14 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1699717388; x=1700322188; darn=debbugs.gnu.org;
 h=in-reply-to:from:references:to:content-language:subject:user-agent
 :mime-version:date:message-id:from:to:cc:subject:date:message-id
 :reply-to; bh=7DB2JawNbtaEmE9xXgifP+V41AkfRHKBnSKYfTGXHVk=;
 b=g06CEDt28tKYdDrMkmbYrMsow8v7GF6yE5qXAgenth+eybQOKzYGzBvxxl2cfa+Op0
 u3oh1r8acbMjUeqlF5AZHpVBvA/+411bBfWQx7ouASJ9CihKvWhxmHM53xq6DAHGma5G
 k58ngLYxrfEg7LIpmuhlZvocRCxzcINLPWMuY+h0HYsjEHuuc8w7AzMpCEiV7a5O9Gx1
 YCTGw7Q6BCYSt1zmiojH13uM2swaMGK+DHLSwEfvygCdsgMukPtWjQ2zZUs8WRl3wbES
 syh76qkQo0MnqkuxsKoZ3n247MUw03uXhwoFsvVSKeI1Hwkjc4gufZoVuMs17rthJHHp
 1D7A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1699717388; x=1700322188;
 h=in-reply-to:from:references:to:content-language:subject:user-agent
 :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
 :date:message-id:reply-to;
 bh=7DB2JawNbtaEmE9xXgifP+V41AkfRHKBnSKYfTGXHVk=;
 b=aa5ZZkkPddyXrhb2ubEFzonGBn9CXHoTKqqqR4RWvtn51FISPclR4y3dOeeeMsVoY3
 Jkwfk+ce/8i1JwqolP2U0oXQsf82qMGsKr+OEMxmOtD2M2v16Dtefor3Cn2PUBvlR/2b
 qeWBEZuxmnbqIu7GWUTW/z1x5XrtbcNZZiBRGTupgOAVsbAXynxK/GgyMREmjPSDh8qv
 2kuPfkev9RHbpO2s5zIU/GDtlM6anj6t43EI9TXtEqt42Hpe2JgNTkUaX779MJ6NcET2
 0UVfvzFPNuNSvM5o9L5b/rRmW6wbh3rVarmVi2kEBAaOtmSRRxobrZgoJEJMXME5LWg+
 I9eg==
X-Gm-Message-State: AOJu0Yzu59GIMmmC+zI2Y4dBQT1fObHyW3nVejpTAk5sZ00EmzH9nZ5e
 crnwzR3vIAp2/tYHCL5/Tk0=
X-Google-Smtp-Source: AGHT+IEvxbU9MfL21lak/SrxZ6D6i8PIi8jkJMFU1EZu1Lj6EpkJwVs1F1H130bnz2iWly6jfXYFXA==
X-Received: by 2002:a5d:45c6:0:b0:31a:d450:c513 with SMTP id
 b6-20020a5d45c6000000b0031ad450c513mr1204998wrs.26.1699717388376; 
 Sat, 11 Nov 2023 07:43:08 -0800 (PST)
Received: from ?IPV6:2a02:8428:2fa4:4b01:6dfd:3e89:8000:413c?
 ([2a02:8428:2fa4:4b01:6dfd:3e89:8000:413c])
 by smtp.gmail.com with ESMTPSA id
 k16-20020adff290000000b00323287186aasm1693836wro.32.2023.11.11.07.43.07
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sat, 11 Nov 2023 07:43:07 -0800 (PST)
Content-Type: multipart/alternative;
 boundary="------------3zN0kKWv67kudEL5Gi0YLJyw"
Message-ID: <102c3f66-4d74-49b9-a099-0c54e5d1c635@HIDDEN>
Date: Sat, 11 Nov 2023 16:43:06 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#66988: 30.0.50; treesit-forward-sexp not working properly in
 js-ts-mode and tsx-ts-mode
Content-Language: fr
To: Dmitry Gutov <dmitry@HIDDEN>, 66988 <at> debbugs.gnu.org,
 Yuan Fu <casouri@HIDDEN>, Theodor Thornhill <theo@HIDDEN>
References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
 <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
From: =?UTF-8?B?TG/Dr2MgTGVtYcOudHJl?= <loic.lemaitre@HIDDEN>
In-Reply-To: <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66988
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------3zN0kKWv67kudEL5Gi0YLJyw
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Thanks for the patch ! It fixes the bug.
But unfortunatly, there is another similar bug in 
/treesit-forward-sexp/, that you can reproduce with that example:
({(<A></A>)});

/(treesit-forward-sexp)/ does not work as expected for both the opening 
parentheses and the brace.

I have checked that it is not a regression due to the patch. That said,  
the patch changes the results (that are not what we expect in any cases).

Loïc

Le 10/11/2023 à 02:41, Dmitry Gutov a écrit :
> Hi!
>
> On 07/11/2023 16:56, Loïc Lemaître wrote:
>> Hi Emacs team,
>>
>> Here the steps to demonstrate the bug :
>>
>> 1. Compile Emacs from master branch with tree-sitter support
>> 2. Install javascript and tsx languages
>> 3. Run Emacs
>> 4. Create a new buffer
>> 5. Turn major mode to either js-ts-mode or tsx-ts-mode
>> 6. Past the following content into the buffer:
>> (
>>    <div>
>>    </div>
>> );
>> 7. Place point before opening parenthese
>> 8. M-x forward-sexp (which will call treesit-forward-sexp)
>>
>> => New position is right after the semi-colon instead of being before 
>> the semi-colon.
>>
>> Note that the bug disappear if the buffer content is changed for :
>> const component = (
>>    <div>
>>    </div>
>> );
>>
>> But previous content, while not being very usefull, is valid JSX, as 
>> far as I know.
>> I use this syntax for unit test purpose, since it is very short.
>
> Thanks for the report.
>
> The patch below should fix it.
>
> Yuan, what do you think? A similar change (bos and eos anchors) might 
> be useful for other things and other modes.
>
> Alternatively, treesit-thing-settings could be interpreted to imply 
> full matches, then the code using it should not only match against the 
> regexps but also check that the entire string (type name) is matched.
>
> Also Cc'ing Theodor.
>
> diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
> index 5a669fdbd42..d81fa9ed322 100644
> --- a/lisp/progmodes/js.el
> +++ b/lisp/progmodes/js.el
> @@ -3843,6 +3843,7 @@ js--treesit-sexp-nodes
>      "undefined"
>      "arguments"
>      "pair"
> +    "parenthesized_expression"
>      "jsx")
>    "Nodes that designate sexps in JavaScript.
>  See `treesit-thing-settings' for more information.")
> @@ -3886,7 +3887,7 @@ js-ts-mode
>
>      (setq-local treesit-thing-settings
>                  `((javascript
> -                   (sexp ,(regexp-opt js--treesit-sexp-nodes))
> +                   (sexp ,(format "\\`%s\\'" (regexp-opt 
> js--treesit-sexp-nodes)))
>                     (sentence ,(regexp-opt js--treesit-sentence-nodes))
>                     (text ,(regexp-opt '("comment"
>                                          "template_string"))))))
>
--------------3zN0kKWv67kudEL5Gi0YLJyw
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Thanks for the patch ! It fixes the bug.<br>
      But unfortunatly, there is another similar bug in <i>treesit-forward-sexp</i>,
      that you can reproduce with that example:<br>
      ({(&lt;A&gt;&lt;/A&gt;)});</p>
    <p><i>(treesit-forward-sexp)</i> does not work as expected for both
      the opening parentheses and the brace.<br>
    </p>
    <p>I have checked that it is not a regression due to the patch. That
      said,  the patch changes the results (that are not what we expect
      in any cases).<br>
    </p>
    <div class="moz-cite-prefix">Loïc<br>
      <br>
    </div>
    <div class="moz-cite-prefix">Le 10/11/2023 à 02:41, Dmitry Gutov a
      écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN">Hi!
      <br>
      <br>
      On 07/11/2023 16:56, Loïc Lemaître wrote:
      <br>
      <blockquote type="cite">Hi Emacs team,
        <br>
        <br>
        Here the steps to demonstrate the bug :
        <br>
        <br>
        1. Compile Emacs from master branch with tree-sitter support
        <br>
        2. Install javascript and tsx languages
        <br>
        3. Run Emacs
        <br>
        4. Create a new buffer
        <br>
        5. Turn major mode to either js-ts-mode or tsx-ts-mode
        <br>
        6. Past the following content into the buffer:
        <br>
        (
        <br>
           &lt;div&gt;
        <br>
           &lt;/div&gt;
        <br>
        );
        <br>
        7. Place point before opening parenthese
        <br>
        8. M-x forward-sexp (which will call treesit-forward-sexp)
        <br>
        <br>
        =&gt; New position is right after the semi-colon instead of
        being before the semi-colon.
        <br>
        <br>
        Note that the bug disappear if the buffer content is changed for
        :
        <br>
        const component = (
        <br>
           &lt;div&gt;
        <br>
           &lt;/div&gt;
        <br>
        );
        <br>
        <br>
        But previous content, while not being very usefull, is valid
        JSX, as far as I know.
        <br>
        I use this syntax for unit test purpose, since it is very short.
        <br>
      </blockquote>
      <br>
      Thanks for the report.
      <br>
      <br>
      The patch below should fix it.
      <br>
      <br>
      Yuan, what do you think? A similar change (bos and eos anchors)
      might be useful for other things and other modes.
      <br>
      <br>
      Alternatively, treesit-thing-settings could be interpreted to
      imply full matches, then the code using it should not only match
      against the regexps but also check that the entire string (type
      name) is matched.
      <br>
      <br>
      Also Cc'ing Theodor.
      <br>
      <br>
      diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
      <br>
      index 5a669fdbd42..d81fa9ed322 100644
      <br>
      --- a/lisp/progmodes/js.el
      <br>
      +++ b/lisp/progmodes/js.el
      <br>
      @@ -3843,6 +3843,7 @@ js--treesit-sexp-nodes
      <br>
           "undefined"
      <br>
           "arguments"
      <br>
           "pair"
      <br>
      +    "parenthesized_expression"
      <br>
           "jsx")
      <br>
         "Nodes that designate sexps in JavaScript.
      <br>
       See `treesit-thing-settings' for more information.")
      <br>
      @@ -3886,7 +3887,7 @@ js-ts-mode
      <br>
      <br>
           (setq-local treesit-thing-settings
      <br>
                       `((javascript
      <br>
      -                   (sexp ,(regexp-opt js--treesit-sexp-nodes))
      <br>
      +                   (sexp ,(format "\\`%s\\'" (regexp-opt
      js--treesit-sexp-nodes)))
      <br>
                          (sentence ,(regexp-opt
      js--treesit-sentence-nodes))
      <br>
                          (text ,(regexp-opt '("comment"
      <br>
                                               "template_string"))))))
      <br>
      <br>
    </blockquote>
  </body>
</html>

--------------3zN0kKWv67kudEL5Gi0YLJyw--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.

Message received at 66988 <at> debbugs.gnu.org:


Received: (at 66988) by debbugs.gnu.org; 11 Nov 2023 10:50:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 11 05:50:17 2023
Received: from localhost ([127.0.0.1]:52137 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r1lZA-00058Z-V1
	for submit <at> debbugs.gnu.org; Sat, 11 Nov 2023 05:50:17 -0500
Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:42631)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1r1lZ6-00058I-9M
 for 66988 <at> debbugs.gnu.org; Sat, 11 Nov 2023 05:50:15 -0500
Received: from compute6.internal (compute6.nyi.internal [10.202.2.47])
 by mailout.west.internal (Postfix) with ESMTP id 2F02B3200957;
 Sat, 11 Nov 2023 05:49:25 -0500 (EST)
Received: from mailfrontend2 ([10.202.2.163])
 by compute6.internal (MEProxy); Sat, 11 Nov 2023 05:49:25 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm2; t=
 1699699764; x=1699786164; bh=ovlbu77Ag5OJV/fSb5xMAq3/K57M0D/Lxvy
 K1xkdshg=; b=ihK72ODXCwLgxFG1oE3cNWv4nNx+gdJ3g3J/9JuJ9qjzJjqphMB
 WLHF7wVsGwWaByb0bV6ryh97buhyxHc7FluLAqiojZ1JCT1VstzgQ3xw1T6/wM8O
 j+E1TNhJhJXUvTfp5gbIwLaw/+YKnnuXEbanqoPACeHkbltv4+iK9XUHpt7GM5n2
 TKphLBOCmKrdYvrOFmtDRGp6M+Faeszz2D1N6o9SqvQPbf6tysL5PWyWnPK4fci4
 Pq11oTFd5AufPEvMEAIE05t1LZPVyyU7EqV5y4BX8NRprJ88WDB7LxwPSyTzofvN
 03l9KrisROr6H+mpVPWYH5CfTH9Pp7QxZ5g==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=
 1699699764; x=1699786164; bh=ovlbu77Ag5OJV/fSb5xMAq3/K57M0D/Lxvy
 K1xkdshg=; b=gCPyMIYcFGvtvB1cMnENXgY10N6+DBfbYQ6ISxz+a7LreT4NFIK
 OgeqVbna446QkyI8ClRoeBfBBN4jvuEsIKexuCiS6SxakggCKrjJkBrZCrcWY5Eq
 R9AL8Sh+c4XrU2EFCConPqluKouidG1l0vfGMYTUweehnD50zs5HnKfN1PADIbA7
 nC7JyP3kw1R7t/A1VTC3nPDqgdBa1PtEVnhPGPVJaWfM9UvoJ/2Gw6tFtadGlOr0
 NI0LB9xz8xa/S5QQ/z/r/vz4HTcrReXVgT1I6fkGfB19Ogv5SOmbu6KXhCHKcvqX
 ZeiECQvIStA1tmAzqWH6UHPQpTswFwmeAZg==
X-ME-Sender: <xms:NFxPZd6it0ROxoTDBNRYnocZQcX_KJVqISb_mCNeCqF8zUEhl-lxnQ>
 <xme:NFxPZa7oIS_0-R0WmvucgwiScFrKSL102PfFgyH9KZMjzmgseot08vd8tlKteu1NY
 a9MgRJpaQWgQ13GSu8>
X-ME-Received: <xmr:NFxPZUe-ROTFdELI9h5z9LHQBG2z_-9vm9LA14hCZo1yvtVypbUJoVUl2ECZFHk>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddvhedgvddtucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhephfffheeljeffgeffueeghfekkedtfffgheejvdegjeettdduheeufffggfef
 jeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:NFxPZWI6kDQpj1d5goEmH86Id0UlrZA9KiPX-evNLFemNOwbmfMLqQ>
 <xmx:NFxPZRKseAAZ4i3YUB_skoQEJC5fCMF5_LzY8VYXZI57a_suxaxnhg>
 <xmx:NFxPZfwLeFugbmoaH72c6BxQc9PQuY8fCpSi0ULkLQwf1pzgbLNw_w>
 <xmx:NFxPZYVp0suElj5NPxmre963gaQI4B59Zi5-emzyTpJeOSLQAf6PNQ>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 11 Nov 2023 05:49:22 -0500 (EST)
Message-ID: <e88344bd-0acc-a9a1-b91f-bd4339282824@HIDDEN>
Date: Sat, 11 Nov 2023 12:49:21 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#66988: 30.0.50; treesit-forward-sexp not working properly in
 js-ts-mode and tsx-ts-mode
Content-Language: en-US
To: Yuan Fu <casouri@HIDDEN>
References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
 <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
 <BFD5D5A3-8E6C-463F-AE8A-CE12256D16D0@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <BFD5D5A3-8E6C-463F-AE8A-CE12256D16D0@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.2 (--)
X-Debbugs-Envelope-To: 66988
Cc: Theodor Thornhill <theo@HIDDEN>, 66988 <at> debbugs.gnu.org,
 =?UTF-8?B?TG/Dr2MgTGVtYcOudHJl?= <loic.lemaitre@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.2 (---)

On 11/11/2023 04:41, Yuan Fu wrote:
> I regret not doing this by default for treesit-indent-rules and traverse functions. Now it’s hard to change without creating confusion and breaking backward compatibility. I wonder if there are good way to smoothly transition to match full names by default…
> 
> Treesit-thing-settings can be changed to match full names, but only if we can change treesit-indent-rules and friends too. Otherwise it would be too confusing.

It's my understanding that the current implementation, when it doesn't 
use a full match, is a potential bug in every single instance.

Perhaps you have an example of when partial match is intended and 
beneficial? If so, we can just go through all other regexps and wrap 
them in \` and \'. And should.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.

Message received at 66988 <at> debbugs.gnu.org:


Received: (at 66988) by debbugs.gnu.org; 11 Nov 2023 07:37:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 11 02:37:00 2023
Received: from localhost ([127.0.0.1]:51420 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r1iY8-00085o-Ab
	for submit <at> debbugs.gnu.org; Sat, 11 Nov 2023 02:37:00 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:57430)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1r1iY5-00085U-ND
 for 66988 <at> debbugs.gnu.org; Sat, 11 Nov 2023 02:36:58 -0500
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 <eliz@HIDDEN>)
 id 1r1iXL-0000LB-Q6; Sat, 11 Nov 2023 02:36:11 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=W3gkhA1awnhkoNttAGwR47W3IhbXBLx9VNwKyJCToKk=; b=D1ezAwCQdWikCBjgju6o
 MKf5b2KifEzr1FwhMpE9IeTydb6zWubmYva2CLJQuV1wkpjHx4LHArwCUCXHhr1pUE1RYdS/tTy6j
 Em8NlaRu3i8EG8q4N/h1Q8dxSH2qlvBlhVDYUHmn1HnuWsnsEZ5VtNmO/P5RphCgPRDn+4fEOxUr7
 mgZCjvdhThhRIMIuIlGqbfdCry92HJG22s+zhq38bnLca3h3WOFJ/cn8p1JYBDYB5lnDhFZCxqPGN
 ZnZZum4jnbPam2ogJd+6dTfet02/quaEemUay0hmUhdsjF/1r/ZaQ3ThoJz6IFG+3q9aywBX2P+Y1
 65UHrOVduOBUzQ==;
Date: Sat, 11 Nov 2023 09:35:56 +0200
Message-Id: <83zfzkwxlv.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <BFD5D5A3-8E6C-463F-AE8A-CE12256D16D0@HIDDEN> (message from
 Yuan Fu on Fri, 10 Nov 2023 18:41:20 -0800)
Subject: Re: bug#66988: 30.0.50;
 treesit-forward-sexp not working properly in js-ts-mode and
 tsx-ts-mode
References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
 <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
 <BFD5D5A3-8E6C-463F-AE8A-CE12256D16D0@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 66988
Cc: dmitry@HIDDEN, 66988 <at> debbugs.gnu.org, theo@HIDDEN,
 loic.lemaitre@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: Theodor Thornhill <theo@HIDDEN>, 66988 <at> debbugs.gnu.org,
>  Loïc Lemaître <loic.lemaitre@HIDDEN>
> From: Yuan Fu <casouri@HIDDEN>
> Date: Fri, 10 Nov 2023 18:41:20 -0800
> 
> > Alternatively, treesit-thing-settings could be interpreted to imply full matches, then the code using it should not only match against the regexps but also check that the entire string (type name) is matched.
> 
> I regret not doing this by default for treesit-indent-rules and traverse functions. Now it’s hard to change without creating confusion and breaking backward compatibility. I wonder if there are good way to smoothly transition to match full names by default…
> 
> Treesit-thing-settings can be changed to match full names, but only if we can change treesit-indent-rules and friends too. Otherwise it would be too confusing.

Is it feasible to have a variable that controls whether the full
matches are implied in these APIs?  Then we could start by making it
optional, and at some later time make it the default.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.

Message received at 66988 <at> debbugs.gnu.org:


Received: (at 66988) by debbugs.gnu.org; 11 Nov 2023 02:42:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 10 21:42:23 2023
Received: from localhost ([127.0.0.1]:51277 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r1dx0-0008WB-TS
	for submit <at> debbugs.gnu.org; Fri, 10 Nov 2023 21:42:23 -0500
Received: from mail-yw1-x1132.google.com ([2607:f8b0:4864:20::1132]:46175)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1r1dwv-0008Vu-P8
 for 66988 <at> debbugs.gnu.org; Fri, 10 Nov 2023 21:42:22 -0500
Received: by mail-yw1-x1132.google.com with SMTP id
 00721157ae682-5a7afd45199so32081647b3.0
 for <66988 <at> debbugs.gnu.org>; Fri, 10 Nov 2023 18:41:37 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1699670492; x=1700275292; darn=debbugs.gnu.org;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=+HWw3PYokgbG8BlMnbIexO5ylxOlnwz01czXJG9dsbE=;
 b=m181iw6YqWcQMhl74PZCp4rtBH75uZxb+xdrR7MbdaeFrekIzStvejGcc6ksC+wqep
 xfDfawnjX3RDyJCeYD/L8jzSdl38gLsVA1xUfXeGKuzz8G7PwOWaaqol+5XcIYF86yVo
 yZJNEY4LX/BwVlfuUmK5BGun5f6cdla8I1X0xMZo+yvQj5g4Gq5xAG6Hrf6UGCNS7S0a
 jln3czoz/axXcMerR4FjX0FW+G/Y5Z2VELxJFMEE5IV2U9cwT4KkDu8EXk+ij/j77nH6
 CDsHnxcPXU3VVhQ3AzLwC57oXYJp1MHFURNTeGWwgoUR03KCa1Mg5amDagdcQTQf7vch
 7AAw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1699670492; x=1700275292;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=+HWw3PYokgbG8BlMnbIexO5ylxOlnwz01czXJG9dsbE=;
 b=g0cSa/MZxEGfRttgBoG7EDn4YtFVnrlnbE28NlFBcJPk2V8QV/Q5VZ3DBafy8FOnpz
 9eo+aBXIzb87InSatt//pVbcQT0LIiahfE0tKMiq+uenYtK9MoaBgFc1Q+hCU1+4s87D
 F6bTG8+lhUe4bYAOso0lK4i9E3kloQe0LiCzgFVI7fC5pwsCmTj1k2hjH8+EXF6+gVtf
 xoT5AsGi6xAO2BDVmo10FpKAMUgfeulssGCjs5faP/sRdjWuR7ks5gg0MWa/T/6ecYm7
 foaStF56k6hqZ/3EYlzof9B7LtF9BYxgxE3DUps10gwnql14mPfiS5/MbzZOT4dwIOL7
 pzKQ==
X-Gm-Message-State: AOJu0YzAZeTXeSVTdhcXX+gFliUtv6/x8imBLGomATOFHKnssiGk85ZN
 ngoEhku+x3BxTTr5wHjVFXM=
X-Google-Smtp-Source: AGHT+IGuP7gL9mQthOHPGt8mCEgQ2Y/pkgcoWBsSFlbTE290RygHrnk6RlNI7wOAhy9Hjf8pVYftMQ==
X-Received: by 2002:a0d:cb0c:0:b0:5a7:bc38:fff2 with SMTP id
 n12-20020a0dcb0c000000b005a7bc38fff2mr1027062ywd.15.1699670491965; 
 Fri, 10 Nov 2023 18:41:31 -0800 (PST)
Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com.
 [172.117.161.177]) by smtp.gmail.com with ESMTPSA id
 cf3-20020a056a02084300b005aa800c149bsm326089pgb.39.2023.11.10.18.41.31
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 10 Nov 2023 18:41:31 -0800 (PST)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\))
Subject: Re: bug#66988: 30.0.50; treesit-forward-sexp not working properly in
 js-ts-mode and tsx-ts-mode
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
Date: Fri, 10 Nov 2023 18:41:20 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <BFD5D5A3-8E6C-463F-AE8A-CE12256D16D0@HIDDEN>
References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
 <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
X-Mailer: Apple Mail (2.3731.700.6)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66988
Cc: Theodor Thornhill <theo@HIDDEN>, 66988 <at> debbugs.gnu.org,
 =?utf-8?B?TG/Dr2MgTGVtYcOudHJl?= <loic.lemaitre@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Nov 9, 2023, at 5:41 PM, Dmitry Gutov <dmitry@HIDDEN> wrote:
>=20
> Hi!
>=20
> On 07/11/2023 16:56, Lo=C3=AFc Lema=C3=AEtre wrote:
>> Hi Emacs team,
>> Here the steps to demonstrate the bug :
>> 1. Compile Emacs from master branch with tree-sitter support
>> 2. Install javascript and tsx languages
>> 3. Run Emacs
>> 4. Create a new buffer
>> 5. Turn major mode to either js-ts-mode or tsx-ts-mode
>> 6. Past the following content into the buffer:
>> (
>>   <div>
>>   </div>
>> );
>> 7. Place point before opening parenthese
>> 8. M-x forward-sexp (which will call treesit-forward-sexp)
>> =3D> New position is right after the semi-colon instead of being =
before the semi-colon.
>> Note that the bug disappear if the buffer content is changed for :
>> const component =3D (
>>   <div>
>>   </div>
>> );
>> But previous content, while not being very usefull, is valid JSX, as =
far as I know.
>> I use this syntax for unit test purpose, since it is very short.
>=20
> Thanks for the report.
>=20
> The patch below should fix it.
>=20
> Yuan, what do you think? A similar change (bos and eos anchors) might =
be useful for other things and other modes.
>=20
> Alternatively, treesit-thing-settings could be interpreted to imply =
full matches, then the code using it should not only match against the =
regexps but also check that the entire string (type name) is matched.

I regret not doing this by default for treesit-indent-rules and traverse =
functions. Now it=E2=80=99s hard to change without creating confusion =
and breaking backward compatibility. I wonder if there are good way to =
smoothly transition to match full names by default=E2=80=A6

Treesit-thing-settings can be changed to match full names, but only if =
we can change treesit-indent-rules and friends too. Otherwise it would =
be too confusing.

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.

Message received at 66988 <at> debbugs.gnu.org:


Received: (at 66988) by debbugs.gnu.org; 10 Nov 2023 07:51:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 10 02:51:54 2023
Received: from localhost ([127.0.0.1]:49453 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r1MJ0-0000JC-Eh
	for submit <at> debbugs.gnu.org; Fri, 10 Nov 2023 02:51:54 -0500
Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]:37641)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1r1MIw-0000Ij-3t
 for 66988 <at> debbugs.gnu.org; Fri, 10 Nov 2023 02:51:52 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id 62A6F240008;
 Fri, 10 Nov 2023 07:51:02 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#66988: 30.0.50; treesit-forward-sexp not working properly
 in js-ts-mode and tsx-ts-mode
In-Reply-To: <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN> (Dmitry Gutov's
 message of "Fri, 10 Nov 2023 03:41:00 +0200")
Organization: LINKOV.NET
References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
 <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
Date: Fri, 10 Nov 2023 09:37:38 +0200
Message-ID: <86sf5enlyt.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 66988
Cc: Theodor Thornhill <theo@HIDDEN>, 66988 <at> debbugs.gnu.org,
 =?iso-8859-1?Q?Lo=EFc_Lema=EEtre?= <loic.lemaitre@HIDDEN>,
 Yuan Fu <casouri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> @@ -3843,6 +3843,7 @@ js--treesit-sexp-nodes
>      "undefined"
>      "arguments"
>      "pair"
> +    "parenthesized_expression"
>      "jsx")
>    "Nodes that designate sexps in JavaScript.
>  See `treesit-thing-settings' for more information.")

I had the same problem and to make this mode more usable had to use such patch:

diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 5a669fdbd42..4c07fbd94b7 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3825,7 +3825,9 @@ js--treesit-sentence-nodes
 See `treesit-thing-settings' for more information.")
 
 (defvar js--treesit-sexp-nodes
-  '("expression"
+  '("expression" ;; SHOULD NOT MATCH "expression_statement", BUT SHOULD MATCH "parenthesized_expression"
+    "parenthesized_expression"
+    "formal_parameters"
     "pattern"
     "array"
     "function"
@@ -3843,7 +3845,13 @@ js--treesit-sexp-nodes
     "undefined"
     "arguments"
     "pair"
-    "jsx")
+    "jsx"
+    "statement_block"
+    "object"
+    "object_pattern"
+    "named_imports"
+    "class_body"
+    )
   "Nodes that designate sexps in JavaScript.
 See `treesit-thing-settings' for more information.")
 
PS:
Also tried to replace
  (setq-local treesit-sexp-type-regexp (regexp-opt js--treesit-sexp-nodes))
with
  (setq-local treesit-sexp-type-regexp (rx-to-string `(seq bol (or ,@js--treesit-sexp-nodes) eol)))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.

Message received at 66988 <at> debbugs.gnu.org:


Received: (at 66988) by debbugs.gnu.org; 10 Nov 2023 01:41:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 09 20:41:55 2023
Received: from localhost ([127.0.0.1]:49217 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r1GWx-0004Xp-11
	for submit <at> debbugs.gnu.org; Thu, 09 Nov 2023 20:41:55 -0500
Received: from out3-smtp.messagingengine.com ([66.111.4.27]:34241)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1r1GWr-0004XV-BK
 for 66988 <at> debbugs.gnu.org; Thu, 09 Nov 2023 20:41:53 -0500
Received: from compute7.internal (compute7.nyi.internal [10.202.2.48])
 by mailout.nyi.internal (Postfix) with ESMTP id D66D15C0244;
 Thu,  9 Nov 2023 20:41:03 -0500 (EST)
Received: from mailfrontend2 ([10.202.2.163])
 by compute7.internal (MEProxy); Thu, 09 Nov 2023 20:41:03 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :content-transfer-encoding:content-type:content-type:date:date
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm2; t=
 1699580463; x=1699666863; bh=RrBoWK16pYN2MuL3rR9wP1NmjY+I2OeZw2L
 UiDK0zLU=; b=JP7h7NEDuxD/2PfHb0b8JDgQP58j+IBCHq7Ep+OfBknIWjfZ+D8
 6leuLDk/tq62TYhOjepegm4g5EjYu4qev9vdF2iSR29edaS047TZVuHLgdgm4OUd
 qyXimyQBTaJGhjesiDSqosjCWrYjPGQnzO6lAQUEP7M0uuuuE5oZt5B0u3N41dTA
 mIMbTLukgEVBYwuJ7ZV2Ln0OQosh+gX1xmc2AZ60Y0Olx1h83ny2TUAoTl925Pgn
 DH7kRpNudCqMQPCDRf5lI4j/wq9hs2Jgo+bWamBhNUqn1ljVdfklQ0vQTmznYAxy
 WL4AXpiZivHnBT1PbETIbXT2U6cEiO6vFyw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :content-type:date:date:feedback-id:feedback-id:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1699580463; x=
 1699666863; bh=RrBoWK16pYN2MuL3rR9wP1NmjY+I2OeZw2LUiDK0zLU=; b=I
 5qsYKWAy185HTLhAn7XZm/pIN0TVJyLvL2pPGFclSCwPeCHDqMkefi/lopxtnJji
 njuxNOdAiItDTsmvEA5q3wqRS7bC6cPgNFscTvpgccL+ubE9Wy4Pq6fZ5Rj8/GnX
 2KxQSJStiKQJCSZ1fq+IljGjQrD48+Eio2VFV7ig5juJkm0mevoYR2HJvZwVw4jM
 jLEMaHddDKH7fRhSZB75+k7I/m6u3NQCyi7bt7Isu7BR1JlnON3t5q2AWtCjyqFW
 c+BvjlO20+4oS2BqYkjcBAaL0nVgCXzDI2KG6b6CbvgDWYi2xHf48sZyS3xy6L3F
 MejKg8FGucUBcGiLxU9Ug==
X-ME-Sender: <xms:L4pNZfKg4GdbK-GPkD0yTyOvfs3vD1qJlxau7RVGmGQOHx0rMukR-A>
 <xme:L4pNZTIPTI4V9E2BkKy2NZ_EX7pOPergmvl16PjTCwgfh4nsngP1NIiGHbfnC_mZa
 NoRj2spRW2SWdekYgk>
X-ME-Received: <xmr:L4pNZXu8gUFT1CBAlJ4UNg4chWh2FrALeMLanzvGpK_ws9oUOfeC8Zova1nYwjM>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddvvddgfeehucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvfhfhjggtgfesthekredttdefjeenucfhrhhomhepffhmihht
 rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth
 gvrhhnpeefjeekvedvfeelfedufeevgeetvdevkeelvddtueetteefudefgfduieekffei
 leenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh
 hithhrhiesghhuthhovhdruggvvh
X-ME-Proxy: <xmx:L4pNZYYu2yOfzJPAE7HIVUXLm53s4YiwZa8dxu2klTt07BrOO2k1oA>
 <xmx:L4pNZWb36oOKQLeeBd4PlVQsGCLBEGDrV3yelgBpC9eY9MJPkFWJPQ>
 <xmx:L4pNZcCWP0zP1HzrE7dPuKiQKkRT1J_FIBQNvVSVSBhB53jJxhlnJQ>
 <xmx:L4pNZVlLe8nrKUMVxlmDgtDrOkhk8xJVSVfwxnFwDg72NCLgUIdZUA>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
 9 Nov 2023 20:41:02 -0500 (EST)
Message-ID: <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@HIDDEN>
Date: Fri, 10 Nov 2023 03:41:00 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#66988: 30.0.50; treesit-forward-sexp not working properly in
 js-ts-mode and tsx-ts-mode
Content-Language: en-US
To: =?UTF-8?B?TG/Dr2MgTGVtYcOudHJl?= <loic.lemaitre@HIDDEN>,
 66988 <at> debbugs.gnu.org, Yuan Fu <casouri@HIDDEN>,
 Theodor Thornhill <theo@HIDDEN>
References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.2 (--)
X-Debbugs-Envelope-To: 66988
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.2 (---)

Hi!

On 07/11/2023 16:56, Loïc Lemaître wrote:
> Hi Emacs team,
> 
> Here the steps to demonstrate the bug :
> 
> 1. Compile Emacs from master branch with tree-sitter support
> 2. Install javascript and tsx languages
> 3. Run Emacs
> 4. Create a new buffer
> 5. Turn major mode to either js-ts-mode or tsx-ts-mode
> 6. Past the following content into the buffer:
> (
>    <div>
>    </div>
> );
> 7. Place point before opening parenthese
> 8. M-x forward-sexp (which will call treesit-forward-sexp)
> 
> => New position is right after the semi-colon instead of being before 
> the semi-colon.
> 
> Note that the bug disappear if the buffer content is changed for :
> const component = (
>    <div>
>    </div>
> );
> 
> But previous content, while not being very usefull, is valid JSX, as far 
> as I know.
> I use this syntax for unit test purpose, since it is very short.

Thanks for the report.

The patch below should fix it.

Yuan, what do you think? A similar change (bos and eos anchors) might be 
useful for other things and other modes.

Alternatively, treesit-thing-settings could be interpreted to imply full 
matches, then the code using it should not only match against the 
regexps but also check that the entire string (type name) is matched.

Also Cc'ing Theodor.

diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 5a669fdbd42..d81fa9ed322 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3843,6 +3843,7 @@ js--treesit-sexp-nodes
      "undefined"
      "arguments"
      "pair"
+    "parenthesized_expression"
      "jsx")
    "Nodes that designate sexps in JavaScript.
  See `treesit-thing-settings' for more information.")
@@ -3886,7 +3887,7 @@ js-ts-mode

      (setq-local treesit-thing-settings
                  `((javascript
-                   (sexp ,(regexp-opt js--treesit-sexp-nodes))
+                   (sexp ,(format "\\`%s\\'" (regexp-opt 
js--treesit-sexp-nodes)))
                     (sentence ,(regexp-opt js--treesit-sentence-nodes))
                     (text ,(regexp-opt '("comment"
                                          "template_string"))))))





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Nov 2023 16:19:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 07 11:19:35 2023
Received: from localhost ([127.0.0.1]:43097 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r0Onf-0003TR-0m
	for submit <at> debbugs.gnu.org; Tue, 07 Nov 2023 11:19:35 -0500
Received: from lists.gnu.org ([2001:470:142::17]:46170)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <loic.lemaitre@HIDDEN>) id 1r0NVk-0001Ge-Eg
 for submit <at> debbugs.gnu.org; Tue, 07 Nov 2023 09:57:01 -0500
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 <loic.lemaitre@HIDDEN>)
 id 1r0NV2-0000Vl-O7
 for bug-gnu-emacs@HIDDEN; Tue, 07 Nov 2023 09:56:16 -0500
Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <loic.lemaitre@HIDDEN>)
 id 1r0NV0-0007St-Pl
 for bug-gnu-emacs@HIDDEN; Tue, 07 Nov 2023 09:56:16 -0500
Received: by mail-lf1-x135.google.com with SMTP id
 2adb3069b0e04-50797cf5b69so7574017e87.2
 for <bug-gnu-emacs@HIDDEN>; Tue, 07 Nov 2023 06:56:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1699368971; x=1699973771; darn=gnu.org;
 h=content-transfer-encoding:subject:from:to:content-language
 :user-agent:mime-version:date:message-id:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Ylst9q8E1verJwLQG6Beln7ghj2/ZCzubUsKMBFGdDk=;
 b=X7qMqPVMInyhlASOP4bEI6blfVqlL3rLCfcZ4mjlHAAr6/8DkrHUJ8YG9Z5ktVGQBR
 vTnojXJrP3O+OhjMEzuXG9kVAYrb6OolSEw+YjaxUyIjnhhOEJKL5RFiNMeNoMDmC8xu
 X+B1K+4tW++hpvmnOq2ErUmHqsBbX86GWKV7C+SFfRlzlnngmdQjYPfNYt9B60rIhnQl
 wQmdsa7EmLKHYu/GEGng6TNRgMphGRG/HXTtY5Qg7c+yHpHKvM14KwDHJOKCnlxlfJVe
 1RBIr7VSq46rlRmt8D+GfbawLsUzVjIPTGh/E+tywue7D92Ss7DUw2KqjbG3WCQJDF0s
 YY9Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1699368971; x=1699973771;
 h=content-transfer-encoding:subject:from:to:content-language
 :user-agent:mime-version:date:message-id:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=Ylst9q8E1verJwLQG6Beln7ghj2/ZCzubUsKMBFGdDk=;
 b=QJSNZrNIDiMuydF9fW65P0uTx2RZgQwuADRH0zf+5aN7EErTqjYdEGgwcbExVP1bLI
 Ot82kqQmgofBWBx3LSLLt22K7LB/aBTK9MSfmKYNrNR2f6wXlMtr212tg6KxfQAeK5PB
 SIzKMjgF0D/Z8zN2IE+jQ/E4hOENyFe+5MhmrUjR1UxvwC4CQD5bVLEP2wUDl+vX1X/g
 2+N1IgG+W77uSy5rvjx/a/3lHEbHgcPSvrMYOJf3cqTkb1bnhcTFnnMK2eacujWPfoNQ
 7hI1U77vteujbsgWjZSRYYpTkliZVmQclHMScyu4X8onXeiqxQWvIx0TkpQ76Lb2CHv4
 v44g==
X-Gm-Message-State: AOJu0YyvTi1Ublrd8c9xjTDbRPR7zUHHCqBKdfTdLb3ANS9fnhfomWtQ
 kUAIuw8qt9FARQi0ZTwYXp4g13qjGqI=
X-Google-Smtp-Source: AGHT+IHnnnE7hwSggHCt6rnyDlNS/qZFlHIS8sYFO/SenANgoAcmcMZjQazwvypeHenNFtSCBVfPnA==
X-Received: by 2002:a05:6512:12c3:b0:509:4c31:98c6 with SMTP id
 p3-20020a05651212c300b005094c3198c6mr15625019lfg.60.1699368971185; 
 Tue, 07 Nov 2023 06:56:11 -0800 (PST)
Received: from ?IPV6:2a02:8428:2fa4:4b01:9014:73d1:7491:c499?
 ([2a02:8428:2fa4:4b01:9014:73d1:7491:c499])
 by smtp.gmail.com with ESMTPSA id
 g3-20020adffc83000000b00323293bd023sm2586789wrr.6.2023.11.07.06.56.10
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Tue, 07 Nov 2023 06:56:10 -0800 (PST)
Message-ID: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@HIDDEN>
Date: Tue, 7 Nov 2023 15:56:09 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: fr
To: bug-gnu-emacs@HIDDEN
From: =?UTF-8?B?TG/Dr2MgTGVtYcOudHJl?= <loic.lemaitre@HIDDEN>
Subject: 30.0.50; treesit-forward-sexp not working properly in js-ts-mode and
 tsx-ts-mode
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2a00:1450:4864:20::135;
 envelope-from=loic.lemaitre@HIDDEN; helo=mail-lf1-x135.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 07 Nov 2023 11:19:34 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Hi Emacs team,

Here the steps to demonstrate the bug :

1. Compile Emacs from master branch with tree-sitter support
2. Install javascript and tsx languages
3. Run Emacs
4. Create a new buffer
5. Turn major mode to either js-ts-mode or tsx-ts-mode
6. Past the following content into the buffer:
(
   <div>
   </div>
);
7. Place point before opening parenthese
8. M-x forward-sexp (which will call treesit-forward-sexp)

=> New position is right after the semi-colon instead of being before 
the semi-colon.

Note that the bug disappear if the buffer content is changed for :
const component = (
   <div>
   </div>
);

But previous content, while not being very usefull, is valid JSX, as far 
as I know.
I use this syntax for unit test purpose, since it is very short.

Thanks !

Loïc Lemaître

In GNU Emacs 30.0.50 (build 5, x86_64-pc-linux-gnu, GTK+ Version
  3.24.33, cairo version 1.16.0) of 2023-11-05 built on
  loic-Latitude-E5470
Repository revision: f0c0ff6bf23ec667ff5487fd94b7f46803ea00ac
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12201001
System Description: Ubuntu 22.04.3 LTS

Configured using:
  'configure --with-native-compilation=aot --with-tree-sitter
  --with-json'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE
XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
   value of $LANG: fr_FR.UTF-8
   value of $XMODIFIERS: @im=ibus
   locale-coding-system: utf-8-unix

Major mode: TypeScript[TSX]

Minor modes in effect:
   tooltip-mode: t
   global-eldoc-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   minibuffer-regexp-mode: t
   line-number-mode: t
   indent-tabs-mode: t
   transient-mark-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t

Load-path shadows:
None found.

Features:
(pp shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils typescript-ts-mode js
c-ts-common treesit json map byte-opt imenu cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs comp
cl-seq comp-cstr cl-extra help-mode warnings icons rx gv bytecomp
byte-compile time-date subr-x cl-loaddefs cl-lib rmc iso-transl tooltip
cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 125398 22424) (symbols 48 9683 4) (strings 32 28484 2423)
  (string-bytes 1 1002643) (vectors 16 20759)
  (vector-slots 8 406881 18596) (floats 8 38 27) (intervals 56 891 0)
  (buffers 992 15))





Acknowledgement sent to Loïc Lemaître <loic.lemaitre@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#66988; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 9 Apr 2024 04:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.