From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov 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 19:25:22 +0200 Organization: LINKOV.NET Message-ID: <87ed1xkn7h.fsf@mail.linkov.net> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19772"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: Dmitry Gutov , Theodor Thornhill , 73978@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 24 18:29:28 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 1tQ8ik-0004xq-PD for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Dec 2024 18:29:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQ8iP-00073B-Ab; Tue, 24 Dec 2024 12:29:06 -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 1tQ8iN-00072x-CH for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 12:29:03 -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 1tQ8iN-0002PS-3X for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 12:29:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=7RhIh1dninIXncmO6xX26JKt/DK3v+vymcA2DIJ/9y0=; b=PuXS11YoXDoiu7qppvI7ofXYO7VY8V7nG7i1L5uYKNhzU4rPUC8lYgPupMAA5EDM6k4pCAerRojBsj6apvBDEgvBydHv2qq2Qm6lsHwiStbnGecO0EsXXa9N4gAMtzFTfq4E+Y8Mhb7fomk7yCZkCnuAyb9+Bvv8nubqaLnri0k4q53QEbkfMN9hkIjkmD4XmA++xPelWDTz2bHaB/LWUa/NGBdMnTArvH9oBrDA87KeGe/HG1IirvQYN6o4uq2jDvfsMM8W2jYx+zMjb2X+SEOMhjxfv8CrRD0Ubwb/5t/b3h31SctkTxnqEHjN7wA6aOY4RfE+X2IObpmrjAxM0A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQ8iM-0004YJ-EY for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 12:29:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Dec 2024 17:29:02 +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.173506132117472 (code B ref 73978); Tue, 24 Dec 2024 17:29:02 +0000 Original-Received: (at 73978) by debbugs.gnu.org; 24 Dec 2024 17:28:41 +0000 Original-Received: from localhost ([127.0.0.1]:34079 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQ8i0-0004Xj-SA for submit@debbugs.gnu.org; Tue, 24 Dec 2024 12:28:41 -0500 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:37933) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQ8hw-0004XO-4o for 73978@debbugs.gnu.org; Tue, 24 Dec 2024 12:28:39 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id B0B4EC0002; Tue, 24 Dec 2024 17:28:08 +0000 (UTC) In-Reply-To: <9C416A93-5E86-4FE5-ADFB-092365169F09@gmail.com> (Yuan Fu's message of "Tue, 24 Dec 2024 00:52:24 -0800") X-GND-Sasl: juri@linkov.net 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:297695 Archived-At: >> @@ -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))))) >> >> (defun typescript-ts--syntax-propertize (beg end) >> (let ((captures (treesit-query-capture 'typescript typescript-ts--s-p-query beg end))) > > Thanks for looking into this! But what’s the intention of this change? > In a snippet like this: > > > > Only the “Text” part should be marked as string. With the change you > proposed, the part would be marked as string. How could I see that text is marked as string? I see no different fontification. > We must mark text as strings because they could include /(/) etc > and mess with syntax-ppss. With the updates in 'tsx-ts-mode' that I just pushed to master please try in the following example: ReactDOM.render(

Hello, Welcome to React and TypeScript

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

2. type C-M-b 3. point incorrectly moves to inside
However, this the above patch, point doesn't move that is correct. Another test case: 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" 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 All these cases work correctly with the patch above.