GNU bug report logs - #67061
[PATCH] Improve syntax highlighting for python-ts-mode

Previous Next

Package: emacs;

Reported by: Denis Zubarev <dvzubarev <at> yandex.ru>

Date: Sat, 11 Nov 2023 02:23:02 UTC

Severity: normal

Tags: patch

Fixed in version 29.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Denis Zubarev <dvzubarev <at> yandex.ru>, Yuan Fu <casouri <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: "67061 <at> debbugs.gnu.org" <67061 <at> debbugs.gnu.org>
Subject: bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode
Date: Mon, 18 Dec 2023 01:38:46 +0200
On 17/12/2023 03:56, Denis Zubarev wrote:
>  > Do we want to have a common face which would inherit from
>  > font-lock-variable-name-face and would be used solely for
>  > function/methods parameters and nothing else? I don't object, but I
>  > don't quite see the point either.
> The point is to make it easy for users to customize faces of features
> independently from each other.
> It is not only about variables/parameters.

Granularity of faces can be increased, but one should also consider 
which nodes go together better with which others.

E.g. even if variable-assignment is a separate face, we would need to 
make it inherit from one of the more basic faces.

> For example, if I want to change a face for decorators, I have to change
> font-lock-type-face, which will change also all type faces.
> I like approach from the helix editor. They introduce many captures with
> different levels of specificity, for example @variable for (identifier),
> @variable.parameter for function parameters, @variable.builtin for
> self|cls etc. I guess by default the default face defined for a @variable
> is used. But one can customize variable.parameter to their liking 
> without touching any
> other variables.
>  > Then I suppose we should clarify whether Denis wants a face that only
>  > matches function parameters, or implicit variable declarations as well.
>  > Or maybe instead a face that is only used for assignments (only first
>  > assignments?) -- which would separate them from the two semantic units
>  > above.
> I think ideally, there should be a face for a feature (or even multiple
> faces).
> For example, faces for variables in helix notation:
> - @variable
> - @variable.definition
> - @variable.definition.parameter
> - @variable.assignment
> - @variable.use

I think this is fairly similar to our faces hierarchy, where children 
inherit attributes from the parent. Just using a shorter notation.

Going back to what is a good thing for highlighting assignments, I would 
separate "first assignments" from the rest, and either inherit their 
face from "variable definition", or simply used the same face. Only in 
languages like Python or Ruby, or course, where any first assignment is 
an implicit variable declaration.




This bug report was last modified 1 year and 176 days ago.

Previous Next


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