From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= Newsgroups: gmane.emacs.bugs Subject: bug#65470: 29.1.50; js-ts-mode: regex pattern can cause incorrect parenthesis matching Date: Fri, 15 Sep 2023 14:11:12 +0200 Message-ID: References: <127B5BEA-A24B-48A3-9827-85B7CDB67D10@secure.kjonigsen.net> <5f823f8f-d249-f4a1-71e6-083e47d0d123@gutov.dev> <83jztbeeh2.fsf@gnu.org> <03415a27-f082-b204-cece-19a9859e178d@gutov.dev> <8334zze5l4.fsf@gnu.org> <1363c54f-5109-f000-3333-78d291b2096d@gutov.dev> <2D516F0C-D7A8-49D2-8009-F911EFC55C78@secure.kjonigsen.net> <2f525ebe-74e5-dcbe-4403-5e9ae001795c@gutov.dev> <5e57b91b-2967-d82d-eca5-65dc206887cf@gutov.dev> <16E4F60E-5216-457F-A79F-F8FBB5A01D61@secure.kjonigsen.net> 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="8150"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Yuan Fu , 65470@debbugs.gnu.org, Theodor Thornhill , btuin@mailo.com, Eli Zaretskii , Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 15 14:12:23 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 1qh7gL-0001qo-Vk for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Sep 2023 14:12:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qh7gA-0007XH-Ho; Fri, 15 Sep 2023 08:12:13 -0400 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 1qh7g6-0007Wm-29 for bug-gnu-emacs@gnu.org; Fri, 15 Sep 2023 08:12:06 -0400 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 1qh7fv-0000bq-A6 for bug-gnu-emacs@gnu.org; Fri, 15 Sep 2023 08:12:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qh7g1-000651-Lb for bug-gnu-emacs@gnu.org; Fri, 15 Sep 2023 08:12:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Sep 2023 12:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65470 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65470-submit@debbugs.gnu.org id=B65470.169477990323340 (code B ref 65470); Fri, 15 Sep 2023 12:12:01 +0000 Original-Received: (at 65470) by debbugs.gnu.org; 15 Sep 2023 12:11:43 +0000 Original-Received: from localhost ([127.0.0.1]:42319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh7fi-00064N-JS for submit@debbugs.gnu.org; Fri, 15 Sep 2023 08:11:42 -0400 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:54855) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh7fg-000649-LM for 65470@debbugs.gnu.org; Fri, 15 Sep 2023 08:11:41 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id A3CE8320034E; Fri, 15 Sep 2023 08:11:26 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 15 Sep 2023 08:11:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= secure.kjonigsen.net; 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=fm1; t=1694779886; x=1694866286; bh=7S zfr26V9W6mAzx9+z3AyqgbHu3cOspRkuLM06b7MtE=; b=AWkIK1k8I1xLXQhYw8 JCGKV/vsfIH8UJyoBXy2RKaP4o4gphbsz0pTLgxsShvx0Yba8vxRhxKgXQli53Se 6Lc+b8BnU0a9J5/YB2GxlB+aflkqKL054OBagnTtU5Iv+S8SAF7qrKomYYE+iY0C I42Jdcncl90LWiHCO9Wyhf+4PruR80mOXKrDDYLKAtQXY0n1OoBO1XO4AQl+Vapw P7Ok3Z6ayux2LrfD7ETS/3PYOxZNcoqubosyd/p/c/Z2xCSgTQopaHidCzS4UnKG Vl6RQIRhb0l4kGZmeMT8YIRvScqlTExOAyrs2JpaBR1aCWbBUOrepKQoYLEV+b6E 4Qvg== 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=fm2; t= 1694779886; x=1694866286; bh=7Szfr26V9W6mAzx9+z3AyqgbHu3cOspRkuL M06b7MtE=; b=hmb/AobkgErKz2JNZbG9Fz3cTja5DwMm4gPgPlQdupiVyPw0zUv BxdyPzVQPCpCMAEH1nExKNe5NasaDo2B+hWPQDbciEtZ2ZKo4alOTlIHdFEv6DEf XVCsJYhBplQIpRk5/kxJvQdMNhd9FJc/oEo2bbg/IQLcpPhl2cuKgMQw1hUN/LaK 9m0ajOT0vHlRDQKnbIE0PI9nmSUX1pibqNqzTPkWhdmpAwRrJN16UlMXrWDE4W/T /y6cdfnsfGe65ooBFDtmsLsZtTmWPwcyQooiErNfsqEyMIMGsL5TbbS8t+5ZGxWw 89fa7iwBv3Kxv59APHgi8LSnEUyS1jc+hfQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudejvddggeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurheptggguffhjgffvefgkfhfvffosehtqhhmtdhhtdejnecuhfhrohhmpeflohhs thgvihhnucfmjhppnhhighhsvghnuceojhhoshhtvghinhesshgvtghurhgvrdhkjhhonh highhsvghnrdhnvghtqeenucggtffrrghtthgvrhhnpeevueffheeiledttdegudegveef tedtheelteetjedvieejhfdvtdffvdduheehtdenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehjohhsthgvihhnsehsvggtuhhrvgdrkhhjohhn ihhgshgvnhdrnhgvth X-ME-Proxy: Feedback-ID: ib2f84088:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 15 Sep 2023 08:11:24 -0400 (EDT) In-Reply-To: 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:270521 Archived-At: > On 13 Sep 2023, at 01:14, Dmitry Gutov wrote: >=20 > On 12/09/2023 09:29, Jostein Kj=C3=B8nigsen wrote: >> Good feedback. I=E2=80=99ve tested and included those as well. = Attached is a new patch. >=20 > Thanks! Installed. It would've been better with a commit message too = (next time). >=20 > Speaking of the TSX difficulties, though, which Yuan hinted at = recently: I think the current fix = (tsx-ts-mode--font-lock-compatibility-bb1f97b) is not working. To be = clear, that's unrelated to the current patch. >=20 > Basically, the query for ((member_expression) @capture) succeeds, but = then the more complex one fails with >=20 > Structure error at: 22 > (jsx_opening_element [(member_expression (identifier)) (identifier)] = @typescript-ts-jsx-tag-face) (jsx_closing_element [(member_expression = (identifier)) (identifier)] @typescript-ts-jsx-tag-face) = (jsx_self_closing_element [(member_expression (identifier)) = (identifier)] @typescript-ts-jsx-tag-face) >=20 > This patch seems to fix that and bring JSX syntax highlighting back: >=20 > diff --git a/lisp/progmodes/typescript-ts-mode.el = b/lisp/progmodes/typescript-ts-mode.el > index 57382c9cb31..7108ff49b28 100644 > --- a/lisp/progmodes/typescript-ts-mode.el > +++ b/lisp/progmodes/typescript-ts-mode.el > @@ -163,7 +163,7 @@ tsx-ts-mode--font-lock-compatibility-bb1f97b > ;; but then raises an error if the wrong node type is used. So it is > ;; important to check with the new node type (member_expression) > (condition-case nil > - (progn (treesit-query-capture language '((member_expression) = @capture)) > + (progn (treesit-query-capture language '(jsx_opening_element = (member_expression) @capture)) > '((jsx_opening_element > [(member_expression (identifier)) (identifier)] > @typescript-ts-jsx-tag-face) >=20 I really don=E2=80=99t know this part of the code very well. If you=E2=80=99= ve identified an issue/bug for a specific TSX use-case, and found a fix = for it, I have no objections to it being applied. =E2=80=94 Jostein