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#61303: 29.0.60; rust-ts-mode does not consistently fontify nested macro-invocations Date: Sun, 05 Feb 2023 23:26:32 +0100 Message-ID: References: <871qn37nxh.fsf@thornhill.no> Reply-To: jostein@kjonigsen.net Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=a3f919d0a4d04d63862e146b043d2c52 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3830"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.9.0-alpha0-107-g82c3c54364-fm-20230131.002-g82c3c543 Cc: Randy Taylor , Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= , 61303@debbugs.gnu.org To: "Theodor Thornhill" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 05 23:28:20 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 1pOnUg-0000hX-6X for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Feb 2023 23:28:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOnUS-0007uo-1p; Sun, 05 Feb 2023 17:28: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 1pOnUQ-0007uf-N0 for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 17:28:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOnUQ-0006On-EW for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 17:28:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pOnUQ-00022D-9n for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 17:28:02 -0500 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: Sun, 05 Feb 2023 22:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61303 X-GNU-PR-Package: emacs Original-Received: via spool by 61303-submit@debbugs.gnu.org id=B61303.16756360237752 (code B ref 61303); Sun, 05 Feb 2023 22:28:02 +0000 Original-Received: (at 61303) by debbugs.gnu.org; 5 Feb 2023 22:27:03 +0000 Original-Received: from localhost ([127.0.0.1]:46667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOnTT-00020o-6k for submit@debbugs.gnu.org; Sun, 05 Feb 2023 17:27:03 -0500 Original-Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:44229) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOnTR-0001zk-8F for 61303@debbugs.gnu.org; Sun, 05 Feb 2023 17:27:01 -0500 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 6D27F32005D8; Sun, 5 Feb 2023 17:26:54 -0500 (EST) Original-Received: from imap50 ([10.202.2.100]) by compute3.internal (MEProxy); Sun, 05 Feb 2023 17:26:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= secure.kjonigsen.net; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:sender:subject:subject:to:to; s=fm2; t= 1675636014; x=1675722414; bh=Q/FJRL9x04pXZqiZC3nT+Ed+E+PSA9eFStm m+tduSm0=; b=PgvplY1bO9+EcZ5zYv2ZGdCRIBxJHxvT8qntK5YYyluv6fNWoYV gzWaSEkIegI1VxguI12Bvzp9NpCTe4oGR/55KB4UNgAk775dmgIcBfdNk2X6NnFa D5mpRgCwJmDGdG5cRrXY+AZL++/JsQBCEh9LbZROqSGqpB+lLXn865MLMdNcY9VA IKkOx853NR0bqeMVMUptGM7BMhSJrR70vPVTHvvpZc+kvnrkeJ3auR9jy6ljTNve NfWjpr2M9CsFoU/FU4Dy7piDCKs98HW+kyer+kAZkOVPX6OGNO7s7eztYyny1bo6 Xjo00E3E0H//DM48y72rOXj3r/itiRQaxjQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to: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=1675636014; x=1675722414; bh=Q/FJRL9x04pXZ qiZC3nT+Ed+E+PSA9eFStmm+tduSm0=; b=OnOL6SgY7jqfblH5OrrMzd49EIN8J 14NKhwEZ3gPn4E3EQxDhATsl8vMnfq+80PuzWnb7cKSlSgAKNeWF4RehSEGPFUQ4 xYPNMkBuUTc95CC85auUKgme3+uWoehhCxrlQFo9qGsEPX9qGaLGhbDq93eUBXHe CK1qL2j4yKjTq6jgBjvt9boFhiaZp4XcDxD2fKBeBL65vZi0XR+zaFpQ5GxY1hTn pBXwEcg1gq9p9WjHCXlZ6ADM/d95IQH57HBQ5kyyJWRVySvg+ztDnffOLCxUfTSX nf1cHVurWDHPsdr6n1QFGKsyLNKsSEVZYwIM6e2dmZnxAsfUV3yI1LOLA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudeggedgudeiudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhfhrvfevufgtsegrtderreerreejnecuhfhrohhmpefl ohhsthgvihhnucfmjhppnhhighhsvghnuceojhhoshhtvghinhesshgvtghurhgvrdhkjh honhhighhsvghnrdhnvghtqeenucggtffrrghtthgvrhhnpeevheeludehlefgtdetleet veelvedvteeulefhgfelvdetfeegleekveelgeekueenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjohhsthgvihhnsehsvggtuhhrvgdrkhhj ohhnihhgshgvnhdrnhgvth X-ME-Proxy: Feedback-ID: ib2f84088:Fastmail Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id BC4AB1700090; Sun, 5 Feb 2023 17:26:53 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: <871qn37nxh.fsf@thornhill.no> 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:254905 Archived-At: --a3f919d0a4d04d63862e146b043d2c52 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sun, Feb 5, 2023, at 23:22, Theodor Thornhill wrote: > Jostein Kj=C3=B8nigsen writes: >=20 > > Hey there. > > >=20 > Hi! >=20 > > Thanks for another tree-sitter based mode to hack at :D > > > > I think I've found an error/lacking in rust-ts-mode where we may hav= e to move > > upstream to fix it. > > > > Consider the following contrived (and yes, not very idiomatic) rust-= code: > > > > let result =3D format!("{}{}", > > "Well yes", > > format!("Or {} no?", "possibly")); > > > > With rust-ts-mode first format! invocation will get highlighted as a > > macro-invocation, while the second will not. > > > > Inspecting this using treesit-explore-mode, I get the following tree: > > > > (let_declaration let pattern: (identifier) =3D > > value: > > (macro_invocation macro: (identifier) ! > > (token_tree ( > > (string_literal " ") > > (string_literal " ") > > (identifier) > > (token_tree ( > > (string_literal " ") > > (string_literal " ") > > )) > > ))) > > ;) > > > > Notice the lack of a second/nested "macro_invocation"-node. Instead = the second > > macro is just denoted as a "identifier". > > > > To fix this, we'll probably need to upstream some bug-reports and PR= s? >=20 > Sounds like it! Just in case - the code compiles, right? >=20 > Theo >=20 Yes. This is compilable, runnable rust-code.=20 =E2=80=94 Jostein --a3f919d0a4d04d63862e146b043d2c52 Content-Type: text/html;charset=utf-8 Content-Transfer-Encoding: quoted-printable

= On Sun, Feb 5, 2023, at 23:22, Theodor Thornhill wrote:
Jostein Kj=C3=B8nigsen <= jostein@secure.kjonigsen= .net> writes:

> Hey there.
>

Hi!

> Thanks for another tree-sitter based mode to hack at :D
>
> I think I've found an error/lacking in rus= t-ts-mode where we may have to move
> upstream to fix i= t.
>
> Consider the following contrive= d (and yes, not very idiomatic) rust-code:
>
<= div>> let result =3D format!("{}{}",
>   &= nbsp; "Well yes",
>     format!("Or {} n= o?", "possibly"));
>
> With rust-ts-mo= de first format! invocation will get highlighted as a
>= macro-invocation, while the second will not.
>
> Inspecting this using treesit-explore-mode, I get the follow= ing tree:
>
> (let_declaration let pat= tern: (identifier) =3D
>   value:
&g= t;    (macro_invocation macro: (identifier) !
&g= t;     (token_tree (
>    = ;  (string_literal " ")
>     = (string_literal " ")
>      (ident= ifier)
>      (token_tree (
>       (string_literal " ")
>       (string_literal " ")
=
>       ))
>  &nb= sp;   )))
>   ;)
>
<= /div>
> Notice the lack of a second/nested "macro_invocation"-nod= e. Instead the second
> macro is just denoted as a "ide= ntifier".
>
> To fix this, we'll proba= bly need to upstream some bug-reports and PRs?

<= div>Sounds like it!  Just in case - the code compiles, right?

Theo

<= br>
Yes. This is compilable, runnable rust-code. 

=E2=80=94
Jostein
--a3f919d0a4d04d63862e146b043d2c52--