From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#66988: 30.0.50; treesit-forward-sexp not working properly in js-ts-mode and tsx-ts-mode Date: Fri, 10 Nov 2023 18:41:20 -0800 Message-ID: References: <9cf7d7d0-33a3-4c07-bd66-bc4c59bdfefb@gmail.com> <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@gutov.dev> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11021"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Theodor Thornhill , 66988@debbugs.gnu.org, =?UTF-8?Q?Lo=C3=AFc_?= =?UTF-8?Q?Lema=C3=AEtre?= To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 11 03:42:40 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r1dxI-0002eZ-1F for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Nov 2023 03:42:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r1dx3-0001Yl-Hv; Fri, 10 Nov 2023 21:42:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r1dx0-0001YS-N3 for bug-gnu-emacs@gnu.org; Fri, 10 Nov 2023 21:42:23 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r1dx0-0007FU-F8 for bug-gnu-emacs@gnu.org; Fri, 10 Nov 2023 21:42:22 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r1dxe-00005Z-89 for bug-gnu-emacs@gnu.org; Fri, 10 Nov 2023 21:43:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Nov 2023 02:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66988 X-GNU-PR-Package: emacs Original-Received: via spool by 66988-submit@debbugs.gnu.org id=B66988.169967054332751 (code B ref 66988); Sat, 11 Nov 2023 02:43:02 +0000 Original-Received: (at 66988) by debbugs.gnu.org; 11 Nov 2023 02:42:23 +0000 Original-Received: from localhost ([127.0.0.1]:51277 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r1dx0-0008WB-TS for submit@debbugs.gnu.org; Fri, 10 Nov 2023 21:42:23 -0500 Original-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 ) id 1r1dwv-0008Vu-P8 for 66988@debbugs.gnu.org; Fri, 10 Nov 2023 21:42:22 -0500 Original-Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-5a7afd45199so32081647b3.0 for <66988@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) Original-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) In-Reply-To: <39b0057b-ac0c-8271-0fe2-f4deef7ae8d3@gutov.dev> X-Mailer: Apple Mail (2.3731.700.6) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274129 Archived-At: > On Nov 9, 2023, at 5:41 PM, Dmitry Gutov 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: >> ( >>
>>
>> ); >> 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 ( >>
>>
>> ); >> 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=