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:42:07 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000012af00619ca3646" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11097"; 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:44:21 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 1sDDnB-0002hh-C5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Jun 2024 03:44:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sDDmk-0006zt-MZ; Fri, 31 May 2024 21:43:54 -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 1sDDmj-0006zb-6d for bug-gnu-emacs@gnu.org; Fri, 31 May 2024 21:43:53 -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 1sDDmh-0006X8-8P for bug-gnu-emacs@gnu.org; Fri, 31 May 2024 21:43:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sDDms-0007nE-9E for bug-gnu-emacs@gnu.org; Fri, 31 May 2024 21:44:02 -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:44:02 +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.171720622429924 (code B ref 71209); Sat, 01 Jun 2024 01:44:02 +0000 Original-Received: (at 71209) by debbugs.gnu.org; 1 Jun 2024 01:43:44 +0000 Original-Received: from localhost ([127.0.0.1]:55511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDDmZ-0007ma-Ix for submit@debbugs.gnu.org; Fri, 31 May 2024 21:43:43 -0400 Original-Received: from mail-oa1-f46.google.com ([209.85.160.46]:59844) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDDmU-0007mJ-99 for 71209@debbugs.gnu.org; Fri, 31 May 2024 21:43:42 -0400 Original-Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-25074a27485so1124388fac.3 for <71209@debbugs.gnu.org>; Fri, 31 May 2024 18:43:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717206140; x=1717810940; 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=zYc+/0SvjoNf+tisL82mEpR/0n8JhTSW95AIr2x26yI=; b=Hw1LLQ8GluQzAFE4qATiSgmI8Euobg3YNHEQsiVtjQ6tHIuVPZL3p1eHqbDIfrfWcE HdqBW16aRFyn00zi+18RWQVtaXRfGujyvWMiJ+jMl1/hCN9kOdgPApWK3EIO0BL8btcL eSIcjFqUY1kLUTimEhwqunAY7O19Cs2Um/dDVUm3h19E3ZsiQjRxfIVgFo5RcFy0OYTK R/TLMfFmGipq/9RsAUhTRW8qqz64/vvm/QlFJioElhXZjQjK9v5lqRvdE6EvYITY0A8/ bvprqnIWkjqiKDt9ep4WsETbIufh9BkNKdrcUxPeX6v2KRHrJGS5Bvx4KnMyFhrDNRhq tXhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717206140; x=1717810940; 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=zYc+/0SvjoNf+tisL82mEpR/0n8JhTSW95AIr2x26yI=; b=kGtTevFWjY+DR2u2mdGW3zm3d3PZ0ljvUj1uocRtTgtJIvnzrJ+/6CNBzO69Swta8O dqN3JHQ6bSKNXP6kpdstgScWbANTqePewl7YRvM5PRbGLortjs0UFjPVi6ku0G9WRe3H w2Dfv28LHw+SUDx42t263zI0e58NOMwJ4LVefwTwn3AhY/pBaQWpC/7s5FxbRAZo+PRU Liznfglq7x89/NztGZ4FR1YZYy9tlnYKKbEC+HAwMObvUWr0yogmWRa7tln9R/p1KlAG NFwHONegsLt4/009josZhYOhnesOyV5mIQQgLOuP6HcmqzaArJ3PEsgKX+wCDYXY01zB lgPg== X-Gm-Message-State: AOJu0Yy9Et+faTJaNS5MRNrk0xIPNTnPk/sNJfdrifDFrW0QYzczqfRh 2hgEhWlLattGi0MmPPA6DlPjSWq+RRaTulhkhB1/rKgmkWsZrDv17Pz4Mvsu4nQWhqjXKwVyWZv LKnUxli3ztDbVfYyuI1B7joIf588= X-Google-Smtp-Source: AGHT+IFGdTAerRyH8rJVJrcIA0coaRxV7IfxHSaUYV0qN7KZ4qVkAUKPx5m2+8p1gvXPGPUKQR/8nULAHoVsUvvh7wI= X-Received: by 2002:a05:6870:858d:b0:24f:d207:2e00 with SMTP id 586e51a60fabf-2508bb742afmr4651045fac.51.1717206140396; Fri, 31 May 2024 18:42:20 -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:286306 Archived-At: --000000000000012af00619ca3646 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > 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, but > 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= . > > 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. > --000000000000012af00619ca3646 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> 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-variable-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-face)
=C2=A0 =C2=A0 ;; auto[&] [x, y]
=C2=A0 =C2= =A0 (structured_binding_declarator
=C2=A0 =C2=A0 =C2=A0_ [(identifier)] = @font-lock-variable-name-face)

I suppose most = people keep the default font-locking for variable-name
and variab= le-use, so these missing rules go unnoticed.

On Fri, May 31, 2024 at 6= :09=E2=80=AFPM Randy Taylor <dev@rjt.dev<= /a>> wrote:
O= n Thursday, May 30th, 2024 at 09:25, Noah Peart <noah.v.peart@gmail.com> wrote:<= br> > > 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.
--000000000000012af00619ca3646--