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#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode Date: Tue, 24 Dec 2024 12:57:15 -0800 Message-ID: <5626DFE7-CA89-4A39-A896-99D8814FD6CD@gmail.com> References: <1A3DAA8F-F00A-4984-AC0F-E62F021A690B@gmail.com> <87r05xmr24.fsf@mail.linkov.net> <87jzbpmqhm.fsf@mail.linkov.net> <9C416A93-5E86-4FE5-ADFB-092365169F09@gmail.com> <87ed1xkn7h.fsf@mail.linkov.net> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) 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="16456"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Dmitry Gutov , Theodor Thornhill , 73978@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 24 21:59:24 2024 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 1tQBzw-00049U-Pe for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Dec 2024 21:59:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQBzc-0000va-JU; Tue, 24 Dec 2024 15:59:04 -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 1tQBza-0000vK-Ai for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 15:59:02 -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 1tQBza-0008Lk-2t for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 15:59:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:Date:In-Reply-To:From:Mime-Version:To:Subject; bh=1UtGZWaJLtbpSTQfqq36FkdGwlUZFxO5x9nx3Zs63MM=; b=KskI0mbNfzGTKuZ3e15I7nJLN/AVPe78G6Vb1EzZKjdL8gVGQiMnozfkJFIoiNyxrTL0R+vKmNZDuxJegO9a6tPp0N0oqj/lnd8DD0ByGuukZO/ycck0g0WqmhyS0kQBfZrL8JPLB/ieOf6TZ0lhwbz1aZdwm6SIP3LaaOO/XRIhMEOd7GMN7/qoPPMfPIUO64u3Wj3e+nI/dBY2z6lOJX5VDxSOpSLMa38xS1+ShOgD7eSB+aQuAm5mVv8j7kbft4JHhd4mFJGnbXjJH5V1EhUNGAXoGt2W1EQoP8NiOWG085zSZCyelymRj46rsDzmCey4rBgnWDSAUwN8PeeFJA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQBzZ-0006ii-RD for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 15:59:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Dec 2024 20:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73978 X-GNU-PR-Package: emacs Original-Received: via spool by 73978-submit@debbugs.gnu.org id=B73978.173507391325785 (code B ref 73978); Tue, 24 Dec 2024 20:59:01 +0000 Original-Received: (at 73978) by debbugs.gnu.org; 24 Dec 2024 20:58:33 +0000 Original-Received: from localhost ([127.0.0.1]:34818 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQBz7-0006hp-2S for submit@debbugs.gnu.org; Tue, 24 Dec 2024 15:58:33 -0500 Original-Received: from mail-pl1-f177.google.com ([209.85.214.177]:46341) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQBz2-0006hX-Ui for 73978@debbugs.gnu.org; Tue, 24 Dec 2024 15:58:31 -0500 Original-Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-21649a7bcdcso57747635ad.1 for <73978@debbugs.gnu.org>; Tue, 24 Dec 2024 12:58:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735073848; x=1735678648; 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=1UtGZWaJLtbpSTQfqq36FkdGwlUZFxO5x9nx3Zs63MM=; b=JSkKdkqk2Gz2HaYR0FTtU2biGZpIHS/AcJdMtB+mfYKQ4kWxS1q+lSUkv+TiuFxTbB Kjf/dsjYBYBp0TDIxtDcegr6du5o+6QCfZlEbnwCVXqdDL9ktOPh5sokc5ObwFVts3ie 2rv8cI8JjB/sNl7wg/llNZ7kDlsQCmSA7SG4/i+TsvpjtYyR/cWQgWIOaWaSCmu9sPCN 3ihHKAYnLlSgp68LSm+Kyq4WBgjiVwxTyj2TcWV7pDWlHFzokknxpqBfLxL2KU3AXHc5 AEcEWwgwI7Z/8a0F+r3FbtM5DyAqOgOue+K+LpXV7+o8WhoUt2iUqovRG9qvhxvGIhDo Xp/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735073848; x=1735678648; 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=1UtGZWaJLtbpSTQfqq36FkdGwlUZFxO5x9nx3Zs63MM=; b=Ro27HZKTvyhhD/9j106Z+soWKvxX1poPc9F81g2/f5pjIVuBqkJlVwCtPyK6vgQrCs 2HZ8Jrd9rl23x+tdJY46QVCoojFqXrhXHFkZ4SCWUJsQ61pPjn/1WD0k+cUyib2t3Jsg 6AisZUTQosvr19/I9IK4BJMU2Nyb6hiuY61t16RqP/Fek/bKCmage6kn3B2njQSDUk3c EuJ19jGaELZD6YsnjWqQjLAtIv5cG4ax/pvjLf9AhyKS2ejRIZusBF7p96ADWzljamS4 uk9TdMTAYBZ0t/y9Q21v+QMgxc62Sda02SFDtoiflcUqvS7QvMJHXwLq5NuW8/ZVpgq+ ZZQg== X-Forwarded-Encrypted: i=1; AJvYcCWLrfbeWtC13AytYfsbRqZG6wppmL1TahRI51yd0zom20CIgUxnnmRucflKouzo6VtPaImbaA==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxieiYWxsqU1KtUOUgOJyWE8FWGpOXHwAwiv+Yz9mEPdMYKfgiK t52HWAuyLaKL+yjfqOCEMJe2Sb7tvdEgwI8MHPj7tRAYlKYer8jf X-Gm-Gg: ASbGnctPvHEbdJug80kXh4x4rWVL8PcC5r3KnS6aMTMHFzWfGTy0LnQRfTLYFe5C7R0 jUfEL+WBKPcK1sCl5D3C4iu7NT+wSXxHP9eRmF7gHsmZutwXpFz5iBlg4hrFfZWxXANm/1UQ2mz zWlnFRTf/h2V6unp6U4pmJlfjJz9JiHOlvKxbF8KOLGn8b/vdMLpZyKwhzH0YVbTBrHnX6GysBy lPiZKG58jEu/xS3fS09fVMhioyN2BMrktl526iHZ3eZSmXAvtFGzua4ZiNXj3ZoDnEOgAKh7wR8 D1wJ X-Google-Smtp-Source: AGHT+IHNtYPzEGUVMa7G0WAwC4T2zRd6HPdjD7hkoP2e4REDV2KvbtvXf2JL8rjezRkZR6RlM96FjQ== X-Received: by 2002:a17:902:db0e:b0:216:2259:a4bd with SMTP id d9443c01a7336-219e70dd108mr272769085ad.52.1735073847612; Tue, 24 Dec 2024 12:57:27 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:1d98:6810:9846:b152]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9cde0dsm93905555ad.140.2024.12.24.12.57.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Dec 2024 12:57:26 -0800 (PST) In-Reply-To: <87ed1xkn7h.fsf@mail.linkov.net> X-Mailer: Apple Mail (2.3776.700.51) 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:297699 Archived-At: > On Dec 24, 2024, at 9:25=E2=80=AFAM, Juri Linkov = wrote: >=20 >>> @@ -630,7 +640,8 @@ tsx-ts--s-p-query >>> (when (treesit-available-p) >>> (treesit-query-compile 'tsx >>> '(((regex pattern: (regex_pattern) = @regexp)) >>> - ((jsx_text) @jsx))))) >>> + ((jsx_opening_element) @jsx) >>> + ((jsx_closing_element) @jsx))))) >>>=20 >>> (defun typescript-ts--syntax-propertize (beg end) >>> (let ((captures (treesit-query-capture 'typescript = typescript-ts--s-p-query beg end))) >>=20 >> Thanks for looking into this! But what=E2=80=99s the intention of = this change? >> In a snippet like this: >>=20 >> >>=20 >> Only the =E2=80=9CText=E2=80=9D part should be marked as string. = With the change you >> proposed, the part would be marked = as string. >=20 > How could I see that text is marked as string? > I see no different fontification. It=E2=80=99s marked as string for syntax-ppss purpose, so that = syntax-ppss skips it when scanning for balanced pairs. It=E2=80=99s not = related to fontification. >=20 >> We must mark text as strings because they could include /(/) etc >> and mess with syntax-ppss. >=20 > With the updates in 'tsx-ts-mode' that I just pushed to master > please try in the following example: >=20 > ReactDOM.render( >
>

Hello, Welcome to React and TypeScript

>
, > document.getElementById("root") > ); >=20 > 1. move point to the beginning of

> 2. type C-M-b > 3. point incorrectly moves to inside
>=20 > However, this the above patch, point doesn't move > that is correct. >=20 > Another test case: >=20 > 1. move point to the beginning of the word "Welcome" > 2. type C-M-b > 3. point incorrectly moves to the letter "e" instead of correct "H" >=20 > 4. type C-M-f a few times until the end of text > 5. point stops at the letter "t" instead of moving after the last = letter >=20 > All these cases work correctly with the patch above. I understand the problem you want to solve, but the patch above will = bring back the bug I was trying to fix in the first place.=20 And I still don=E2=80=99t understand the intention of your patch. Maybe = I missed something. Am I correct that you want to apply string syntax on = the tags, eg,
, ,
?=20 Yuan=