all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dmitry@gutov.dev>
To: Denis Zubarev <dvzubarev@yandex.ru>, Yuan Fu <casouri@gmail.com>,
	Eli Zaretskii <eliz@gnu.org>
Cc: "67061@debbugs.gnu.org" <67061@debbugs.gnu.org>
Subject: bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode
Date: Mon, 18 Dec 2023 01:38:46 +0200	[thread overview]
Message-ID: <ca639b45-0cce-5e0a-fb39-c7a77cc383a2@gutov.dev> (raw)
In-Reply-To: <41601702778144@mail.yandex.ru>

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.





  reply	other threads:[~2023-12-17 23:38 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-11  2:21 bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode Denis Zubarev
2023-11-11  7:32 ` Eli Zaretskii
2023-11-11 10:52   ` Denis Zubarev
2023-11-11 11:00     ` Eli Zaretskii
2023-11-11 12:09       ` Denis Zubarev
2023-11-26  2:12       ` Dmitry Gutov
2023-11-15 13:28   ` Eli Zaretskii
2023-11-25  9:35     ` Eli Zaretskii
2023-11-26  2:17       ` Dmitry Gutov
2023-11-29 14:05         ` Eli Zaretskii
2023-12-09  0:39           ` Denis Zubarev
2023-12-09  7:32             ` Eli Zaretskii
2023-12-10 10:16               ` Yuan Fu
2023-12-09 18:18             ` Dmitry Gutov
2023-12-10 12:04               ` Denis Zubarev
2023-12-11  0:00                 ` Dmitry Gutov
2023-12-11  7:10                   ` Yuan Fu
2023-12-11 12:02                     ` Dmitry Gutov
2023-12-12  1:18                     ` Denis Zubarev
2023-12-12  8:24                       ` Yuan Fu
2023-12-13  0:44                         ` Dmitry Gutov
2023-12-13  3:49                           ` Yuan Fu
2023-12-13 18:28                             ` Dmitry Gutov
2023-12-14  5:54                               ` Yuan Fu
2023-12-14 11:51                                 ` Dmitry Gutov
2023-12-17  1:07                                   ` Yuan Fu
2023-12-17 21:36                                     ` Dmitry Gutov
2023-12-23 21:46                                     ` Denis Zubarev
2023-12-16 13:03                                 ` Eli Zaretskii
2023-12-17  1:56                               ` Denis Zubarev
2023-12-17 23:38                                 ` Dmitry Gutov [this message]
2023-12-13 11:52                         ` Eli Zaretskii
2023-12-17  0:26                         ` Denis Zubarev
2023-12-17  1:10                           ` Yuan Fu
2023-12-17  2:07                             ` Denis Zubarev
2023-12-23  9:42                               ` Eli Zaretskii
2023-12-30 10:53                                 ` Denis Zubarev
2023-12-30 11:19                                   ` Eli Zaretskii
2023-12-18  0:25                           ` Dmitry Gutov
2023-12-19  0:14                             ` Denis Zubarev
2023-12-20 23:34                               ` Dmitry Gutov
2023-12-21  7:04                                 ` Yuan Fu
2023-12-23 21:45                                 ` Denis Zubarev
2024-01-01 17:42                                   ` Dmitry Gutov
2024-01-09 20:03                                     ` Eli Zaretskii
2024-01-20  9:08                                       ` Eli Zaretskii
2024-01-27  9:49                                         ` Eli Zaretskii
2024-01-27 10:47                                           ` Denis Zubarev
2024-01-27 11:30                                             ` Eli Zaretskii
2023-12-13 21:16         ` Stefan Kangas
2023-12-14  1:31           ` Dmitry Gutov
2023-12-14 22:49             ` Stefan Kangas
2023-12-15  7:14               ` Yuan Fu
2023-12-11  6:53 ` Yuan Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ca639b45-0cce-5e0a-fb39-c7a77cc383a2@gutov.dev \
    --to=dmitry@gutov.dev \
    --cc=67061@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=dvzubarev@yandex.ru \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.