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> ({(<A></A>)});</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> <div> <br> </div> <br> ); <br> 7. Place point before opening parenthese <br> 8. M-x forward-sexp (which will call treesit-forward-sexp) <br> <br> => 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> <div> <br> </div> <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--
bug-gnu-emacs@HIDDEN
:bug#66988
; Package emacs
.
Full text available.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.
bug-gnu-emacs@HIDDEN
:bug#66988
; Package emacs
.
Full text available.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.
bug-gnu-emacs@HIDDEN
:bug#66988
; Package emacs
.
Full text available.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=
bug-gnu-emacs@HIDDEN
:bug#66988
; Package emacs
.
Full text available.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)))
bug-gnu-emacs@HIDDEN
:bug#66988
; Package emacs
.
Full text available.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"))))))
bug-gnu-emacs@HIDDEN
:bug#66988
; Package emacs
.
Full text available.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))
Loïc Lemaître <loic.lemaitre@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#66988
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.