From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Noah Peart Newsgroups: gmane.emacs.bugs Subject: bug#71209: [PATCH] Add font-locking for variables in go-ts-mode range clauses Date: Fri, 31 May 2024 18:50:52 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000003ec34f0619ca5513" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12709"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71209@debbugs.gnu.org, Dmitry Gutov To: Randy Taylor Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 01 03:53:06 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 1sDDvd-00034Y-Tx for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Jun 2024 03:53:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sDDvQ-0000cO-2l; Fri, 31 May 2024 21:52:52 -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 1sDDvO-0000bt-Oc for bug-gnu-emacs@gnu.org; Fri, 31 May 2024 21:52:50 -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 1sDDvO-0008GZ-Fn for bug-gnu-emacs@gnu.org; Fri, 31 May 2024 21:52:50 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sDDvZ-00080T-Qc for bug-gnu-emacs@gnu.org; Fri, 31 May 2024 21:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noah Peart Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Jun 2024 01:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71209 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 71209-submit@debbugs.gnu.org id=B71209.171720674330734 (code B ref 71209); Sat, 01 Jun 2024 01:53:01 +0000 Original-Received: (at 71209) by debbugs.gnu.org; 1 Jun 2024 01:52:23 +0000 Original-Received: from localhost ([127.0.0.1]:55524 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDDux-0007ze-Bb for submit@debbugs.gnu.org; Fri, 31 May 2024 21:52:23 -0400 Original-Received: from mail-oa1-f51.google.com ([209.85.160.51]:60564) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDDuv-0007zS-OX for 71209@debbugs.gnu.org; Fri, 31 May 2024 21:52:22 -0400 Original-Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-24cbb884377so1431777fac.0 for <71209@debbugs.gnu.org>; Fri, 31 May 2024 18:52:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717206665; x=1717811465; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=44Am0KC8Vpn92eF0obLQMAtqVC2dAONiMtEJDiY0Dw0=; b=fDUPm8wjsNHvBATmw1ppwgRyhzr+DKqWraL/qWO2VkB7+JbIWB5RLUf5rGYjMnJ06S zIzcW8kfmtLcRWyyIiBICxscWpxuLvFofTdSYfRhEvZ6Ln9vLO2V3xuRyimwCLcHLONS DF/jk5fZkQn6tZUtkBn5j2RjXA80SrzZMcx7SB9PdCdwA0gsX/5DXccJg6km1BzqZG+g oDgi7P60iECGVxsARojIpKPpUuZOhg4G3xd2Lgm++DQfR+WbXYMVGSX+0bFjA36Ndni5 uXHacbS2QecTZIpxRfHrUny2mkgr7NCQLTo/EnflF6VZ4Qq/PUwvcA/TpKIuAJKAEQQg TOOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717206665; x=1717811465; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=44Am0KC8Vpn92eF0obLQMAtqVC2dAONiMtEJDiY0Dw0=; b=kJiyeA+7oVyPqR9xllKD0wxXCL3HdMInbZqLnRChlHWyd1A1meX/Mgq+7MOoUOUx6l COklduqyHkP3EnQBCDZbFCgpw1vluG9D0sHCB6galB1QbwfOaBhhBzsDSgm/ka6Ny4Dy SQxmd56qpixt8jbD2rmo0oE8EdwJVcpk3yGpOVq2ho5cGi5lyGN9J9sjOjxcG93w1LW7 2fe+LTi5WI0fInCyGld2AASA5E20FLqQ3lyIRqoWaKIxabrEuKQzJv35RG8COnBIpfuE EHvYnBH8QLka6hpTod+vzGP/ZPhuv5h/7iitq6f9BXb6Xczcs4TwM7oMgI/lQT6EJNUz aTbg== X-Gm-Message-State: AOJu0YzGNUhtqEMWsbf1170dMI/g8ub0pSo56bYT1VRbQzciYjiLA38j qj98znhZbvUK1Z7BAAShMpk07rCv78G5jXf/MS/4ne0a8XKMBO7l0W16G1clJW3r9276OELUeIr l5sIyeIhi1ttFAeDCUot+O7eFdq4= X-Google-Smtp-Source: AGHT+IEGR49eMl/QO5kQ5oL7VBpbGnlI6cqof0+RryuZzh5FUf57paxF4s0Rp6xR/lVzTj2BKHYJOJgrCcgKNtJEjxY= X-Received: by 2002:a05:6871:b07:b0:250:7d25:b3b7 with SMTP id 586e51a60fabf-2508c1b8a55mr3966814fac.53.1717206664525; Fri, 31 May 2024 18:51:04 -0700 (PDT) In-Reply-To: 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:286308 Archived-At: --0000000000003ec34f0619ca5513 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable There is a similar issue with font-lock-property-name-face and font-lock-property-use-face. I've noticed different modes treat things differently. I think object fields in literals should get property-name-face, but json-ts-mode, for example, doesn't use font-lock-property-name-face at all. On Fri, May 31, 2024 at 6:42=E2=80=AFPM Noah Peart = wrote: > > c++-ts-mode will need to get updated too > > I've been using these for c++, I think they are still missing > > ;; for (auto x: ...) > (for_range_loop > declarator: (identifier) @font-lock-variable-name-face) > ;; auto& x > (reference_declarator > (identifier) @font-lock-variable-name-face) > ;; auto[&] [x, y] > (structured_binding_declarator > _ [(identifier)] @font-lock-variable-name-face) > > I suppose most people keep the default font-locking for variable-name > and variable-use, so these missing rules go unnoticed. > > On Fri, May 31, 2024 at 6:09=E2=80=AFPM Randy Taylor wrote: > >> On Thursday, May 30th, 2024 at 09:25, Noah Peart >> wrote: >> > > it seems we already highlight this when at treesit-font-lock-level 4= ? >> > They get highlighted with `font-lock-variable-use-face` at level 4, bu= t >> shouldn't >> > they be getting `font-lock-variable-name-face` in the 'definition >> feature? >> > >> >> Indeed, thanks. Could someone please install the patch? Thanks in advanc= e. >> >> Seems like c++-ts-mode will need to get updated too, as with: >> for (const auto& i : things) {} >> i gets font-lock-variable-use-face. I wonder if any other ts modes >> have similar issues. >> > --0000000000003ec34f0619ca5513 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
There is a similar=C2=A0issue with font-lock-property-name= -face=C2=A0
and font-lock-property-use-face.=C2=A0 I've noticed dif= ferent modes
treat things differently.=C2=A0 I think object field= s in literals should get=C2=A0
property-name-face, but json-ts-mo= de, for example,
doesn't use font-lock-property-name-face at = all.

On Fri, May 31, 2024 at 6:42=E2=80=AFPM Noah Peart <noah.v.peart@gmail.com> wrote:=
> c++-ts-mode will need to get updated too

I've= been using these for c++, I think they are still missing

=C2=A0 =C2=A0 ;; for (auto x: ...)
=C2=A0 =C2=A0 (for= _range_loop
=C2=A0 =C2=A0 =C2=A0declarator: (identifier) @font-lock-vari= able-name-face)
=C2=A0 =C2=A0 ;; auto& x
=C2=A0 =C2=A0 (reference= _declarator
=C2=A0 =C2=A0 =C2=A0(identifier) @font-lock-variable-name-fa= ce)
=C2=A0 =C2=A0 ;; auto[&] [x, y]
=C2=A0 =C2=A0 (structured_bin= ding_declarator
=C2=A0 =C2=A0 =C2=A0_ [(identifier)] @font-lock-variable= -name-face)

I suppose most people keep the def= ault font-locking for variable-name
and variable-use, so these mi= ssing rules go unnoticed.

On Fri, May 31, 2024 at 6:09=E2=80=AFPM Rand= y Taylor <dev@rjt.dev> wrote:
On= Thursday, May 30th, 2024 at 09:25, Noah Peart <noah.v.peart@gmail.com> wrote: > > it seems we already highlight this when at treesit-font-lock-leve= l 4?
> They get highlighted with `font-lock-variable-use-face` at level 4, bu= t shouldn't
> they be getting `font-lock-variable-name-face` in the 'definition = feature?
>

Indeed, thanks. Could someone please install the patch? Thanks in advance.<= br>
Seems like c++-ts-mode will need to get updated too, as with:
for (const auto& i : things) {}
i gets font-lock-variable-use-face. I wonder if any other ts modes
have similar issues.
--0000000000003ec34f0619ca5513--