GNU bug report logs - #71209
[PATCH] Add font-locking for variables in go-ts-mode range clauses

Previous Next

Package: emacs;

Reported by: Noah Peart <noah.v.peart <at> gmail.com>

Date: Sun, 26 May 2024 12:43:01 UTC

Severity: wishlist

Tags: patch

Full log


View this message in rfc822 format

From: Noah Peart <noah.v.peart <at> gmail.com>
To: Randy Taylor <dev <at> rjt.dev>
Cc: 71209 <at> debbugs.gnu.org, Dmitry Gutov <dmitry <at> gutov.dev>
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 part 1 (text/plain, inline)]
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 PM Noah Peart <noah.v.peart <at> 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
>
>     ;; 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 PM Randy Taylor <dev <at> rjt.dev> wrote:
>
>> On Thursday, May 30th, 2024 at 09:25, Noah Peart <noah.v.peart <at> gmail.com>
>> 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.
>>
>
[Message part 2 (text/html, inline)]

This bug report was last modified 114 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.