From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode Date: Mon, 18 Dec 2023 01:38:46 +0200 Message-ID: References: <8734xdni6y.fsf@yandex.ru> <831qcwycbj.fsf@gnu.org> <83v8a3qh6m.fsf@gnu.org> <834jhadvkt.fsf@gnu.org> <7aee7e42-c07d-9131-18a9-4806f07d4267@gutov.dev> <83a5qw7izt.fsf@gnu.org> <172531702081590@mail.yandex.ru> <212931702208489@mail.yandex.ru> <0c6e2e14-b494-a8cb-3893-ffb39577baf9@gutov.dev> <7b17c99d-6e4b-43b3-af93-993901a3a4ea@gmail.com> <95071702343720@mail.yandex.ru> <78ffdcf3-e322-49ea-a0d5-d0485ade9e73@gmail.com> <41601702778144@mail.yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14904"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: "67061@debbugs.gnu.org" <67061@debbugs.gnu.org> To: Denis Zubarev , Yuan Fu , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 18 00:40:24 2023 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 1rF0kB-0003eE-I6 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 18 Dec 2023 00:40:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rF0jr-0002sI-Jk; Sun, 17 Dec 2023 18:40:03 -0500 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 1rF0jp-0002s1-SB for bug-gnu-emacs@gnu.org; Sun, 17 Dec 2023 18:40:01 -0500 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 1rF0jp-0003vz-JR for bug-gnu-emacs@gnu.org; Sun, 17 Dec 2023 18:40:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rF0jq-0006kO-Nd for bug-gnu-emacs@gnu.org; Sun, 17 Dec 2023 18:40:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Dec 2023 23:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67061 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 67061-submit@debbugs.gnu.org id=B67061.170285634325856 (code B ref 67061); Sun, 17 Dec 2023 23:40:02 +0000 Original-Received: (at 67061) by debbugs.gnu.org; 17 Dec 2023 23:39:03 +0000 Original-Received: from localhost ([127.0.0.1]:59174 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rF0is-0006iy-Hx for submit@debbugs.gnu.org; Sun, 17 Dec 2023 18:39:02 -0500 Original-Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:42627) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rF0iq-0006iR-42 for 67061@debbugs.gnu.org; Sun, 17 Dec 2023 18:39:00 -0500 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 57CCD32000D9; Sun, 17 Dec 2023 18:38:51 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 17 Dec 2023 18:38:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1702856330; x=1702942730; bh=xvk7VfpK8m6H4/yzK6Tb1g0rJdkJ+ToLyahqzkPJKvo=; b= GV06d5RWrD35WvCjxyuCFxpHzEPY95ERblFpGmnpH+oJBa9tgNx+Dec1HFw90VZa 5eAvntv6XVuTwHs/oKQ6D9yruaH0zq+sr51pbY5prVB4kR7WBtkzX6YBMSx8I08I c/a6AUGtz6xzEcpjUTO9DkKd4dWYospNT2e0AFRV15frQgzMFXRL+uEzeuHwFkM0 7Pf7VdtuJBWsQhHY6HsSygLTQmBqgF+koCnos5O+96gVQbTpLLGmjd4RDkhRMPRu xFqKOo9kozDGUWvDYGp+2QwAY5LNdlEeLr6rdiC2EiZOIjrPdaoLTbbUQ97u+r9Z UPTJPryPr6b/iNuoBcTalQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1702856330; x= 1702942730; bh=xvk7VfpK8m6H4/yzK6Tb1g0rJdkJ+ToLyahqzkPJKvo=; b=H sDCzq8ROJZD7KYUzTR36UPGinSxWkH0lWy8diUUE58lZHixwbW+PQKjDy0byUkgH iUecHvZPn6ay1cdz0/oMJW3Vnmivi0N/XpL8423IBYEtLAcAoPrSESZosDSCV+uU GA+0YQzSeCFhEdltxt/CHGNqFDPQNHPnfvhok43YtxTx/UPm6eadF6zMEyAMSTs4 FnnT+bSXV+tuaJ1SEDQhnsiDMcCqbcOJ4qE2Rf0Bt7TKYqifKgV/vZ1qEON7nRhC WAlvhsH4FcKvtRGuZwdp7ZyJEXFVYST/9f34kqCtSTIQNzRJ87Jo/4NfZIHn2qK1 +X/SaWZEtwAlG02ZMvixw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvddtjedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 17 Dec 2023 18:38:48 -0500 (EST) Content-Language: en-US In-Reply-To: <41601702778144@mail.yandex.ru> 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:276448 Archived-At: 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.