From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Randy Taylor Newsgroups: gmane.emacs.bugs Subject: bug#61655: [Tree sitter] [Feature Request] font-lock function calls, definitions, separately Date: Sat, 25 Feb 2023 03:59:46 +0000 Message-ID: References: <8DA1B548-B8D2-4EC1-B9F8-F7654003AC89@gmail.com> <56C0998E-3053-49F3-BAE3-46D6432B16F5@gmail.com> <87abbcaf-e60b-f975-b589-5e61f2d7866e@yandex.ru> <83bklkp7tj.fsf@gnu.org> <97710356-24c1-d79c-4796-3e51fd4809e3@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24995"; mail-complaints-to="usenet@ciao.gmane.io" Cc: casouri@gmail.com, 61655@debbugs.gnu.org, Theodor Thornhill , Eli Zaretskii , jacob.fai@gmail.com To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 25 05:00:33 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 1pVljd-0006LJ-3l for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Feb 2023 05:00:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVljE-0001VT-8o; Fri, 24 Feb 2023 23:00:08 -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 1pVlj9-0001V1-W7 for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2023 23:00:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVlj9-0000by-IU for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2023 23:00:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pVlj8-0003K1-Tg for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2023 23:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Randy Taylor Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Feb 2023 04:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61655 X-GNU-PR-Package: emacs Original-Received: via spool by 61655-submit@debbugs.gnu.org id=B61655.167729760112738 (code B ref 61655); Sat, 25 Feb 2023 04:00:02 +0000 Original-Received: (at 61655) by debbugs.gnu.org; 25 Feb 2023 04:00:01 +0000 Original-Received: from localhost ([127.0.0.1]:38745 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVlj6-0003JN-EJ for submit@debbugs.gnu.org; Fri, 24 Feb 2023 23:00:00 -0500 Original-Received: from mail-4018.proton.ch ([185.70.40.18]:22185) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVlj4-0003J8-8B for 61655@debbugs.gnu.org; Fri, 24 Feb 2023 22:59:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rjt.dev; s=protonmail2; t=1677297591; x=1677556791; bh=D6t876CtuLWqC03YaKF2hOa1rUq4CDLyzAgGLWHzncI=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=s6jl2KezVV0ho5rnJcIEAVAsHA//bWgODLV7lt0ab3+vTnI648t39cW9k9ktHbfzJ 4MtwyIrR8IbOuSHQ0kdNGZoKrsjR3CTdWhQxN3+wCvmNwX0NQiRiV/MC4Oyl1fjzh8 kIVt2ykq419QXvjVRiX6FhB/OF2QrDpDah/gHqgOnm22dMfP5v/eG4eqB6o2s/oFxH PrVIAwvB1ERaCwbdJ5ZtCBXVARZwG/O07eBAIhH0FbINE/gl0ya78sghdyLMD8+mEJ MXivUmTs9tewUknMWJN6E99k7BqvVtZFuK1gdnkFgKJfJDry8MXvgcNlFHQYIZ+BkW yu2sWxhHHWk1w== In-Reply-To: Feedback-ID: 44397038:user:proton 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:256675 Archived-At: On Friday, February 24th, 2023 at 21:28, Dmitry Gutov wr= ote: > Hi Randy, >=20 > Thanks for the reply. >=20 > On 25/02/2023 03:06, Randy Taylor wrote: >=20 > > > Here's the patch which adds the faces and their uses in all ts modes. > > >=20 > > > Comments welcome from all the interested parties. The patch is mostly > > > straightforward, but there are some changes added as well, where it w= as > > > needed to differentiate between declarations and references. > > >=20 > > > The important question here, I think, is whether we want to split > > > font-lock-property-faces in two, like I did here. > > >=20 > > > By analogy with the other faces, I think it's going to be useful to > > > differentiate between property definitions and property references. N= ot > > > many of the languages modes used font-lock-property-face for > > > property/attribute definitions, but some did. > >=20 > > I'm not sure about the naming of font-lock-variable-ref-face. It's conf= using for languages that support actual references like C++ and Rust. >=20 >=20 > But even there "variable reference" is probably a suitable term for any > occurrence of a variable other than its definition. While the references > you're talking about are "value references". It is a suitable term, but there is a confusing overlap, at least to me. In= C++ parlance, for example, they are referred to as reference variables. I = wasn't really getting down to the semantics of it, just when I see somethin= g like: void quack(int& thing) ^^^^^ obj_t& thing2 =3D otherthing; ^^^^^^ Those are the things I would expect font-lock-variable-ref-face to highligh= t if I was just going off of the name, and I would expect many others to th= ink the same. >=20 > > Maybe the opposite direction is better: font-lock-variable-def-face (or= something similar) for definitions (or whatnot), and font-lock-variable-na= me-face to refer to uses (same goes for property). Or font-lock-variable-us= e-face. I don't know, naming is hard :). >=20 >=20 > I, uh, pushed the change before I noticed your email. ^^; >=20 > But perhaps we could refine, if there is enough support. >=20 > Indeed, I was slightly uneasy about the -ref- names, if only because > they might seem a little cryptic. Using the name -def-face is something > I thought about too, but it sounded a bit like the name of a macro. >=20 > A bigger problem, though, is that existing themes customize > font-lock-variable-name-face. So we'd have to create inheritance the > other way around (for the themes to continue working unchanged). Or we'd > have to create face alias and use a yet different name for "variable > references" (or "uses", or whatever we'd call them). >=20 > Inheritance "the other way around" would break the usage scenario 1 > below for users of existing themes. Or at least make it more difficult. I don't have any better ideas than font-lock-{property,variable}-use-face, = so I guess we can see if anyone else has any opinions on the matter. >=20 > > Personally, I don't really see the value in differentiating these for v= ariables. I can understand it a little more for properties. But I guess it = doesn't hurt to add if folks want it. >=20 >=20 > I see two potential uses: >=20 > 1. Customize treesit-font-lock-level to 4 but > font-lock-variable-ref-face to copy 'default' (or close to it), to skip > variable reference highlighting or make it less noticeable. Wouldn't they just remove the variable feature if they want that? >=20 > 2. Pattern matching or comparably complex syntax which at a first glance > may look like variable reference, but actually creates new bindings (or > vice versa, creates new binding when one wanted to refer to an existing > value). >=20 > Emphasizing the difference can help people, beginners especially [in a > particular language]. > No doubt there are uses, I just don't really see them actually getting much= use in practice. But maybe I'm wrong :).