From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jacob Faibussowitsch Newsgroups: gmane.emacs.bugs Subject: bug#61655: [Tree sitter] [Feature Request] font-lock function calls, definitions, separately Date: Mon, 20 Feb 2023 15:45:37 -0500 Message-ID: <50A8431B-EAD8-442B-9412-0C3649D8852F@gmail.com> References: <8DA1B548-B8D2-4EC1-B9F8-F7654003AC89@gmail.com> <831qmkuv4o.fsf@gnu.org> <871qmk9jaz.fsf@thornhill.no> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.2\)) 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="23120"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61655@debbugs.gnu.org, Eli Zaretskii , Yuan Fu To: Theodor Thornhill Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 20 21:46:20 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 1pUD3E-0005jx-LF for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 Feb 2023 21:46:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUD30-00076E-7A; Mon, 20 Feb 2023 15:46:06 -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 1pUD2w-00075r-Ql for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 15:46:03 -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 1pUD2w-0003GU-8q for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 15:46:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pUD2v-0005Qr-N1 for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 15:46:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jacob Faibussowitsch Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Feb 2023 20:46:01 +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.167692595120862 (code B ref 61655); Mon, 20 Feb 2023 20:46:01 +0000 Original-Received: (at 61655) by debbugs.gnu.org; 20 Feb 2023 20:45:51 +0000 Original-Received: from localhost ([127.0.0.1]:53743 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUD2l-0005QO-2f for submit@debbugs.gnu.org; Mon, 20 Feb 2023 15:45:51 -0500 Original-Received: from mail-qv1-f54.google.com ([209.85.219.54]:47018) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUD2f-0005Q7-4n for 61655@debbugs.gnu.org; Mon, 20 Feb 2023 15:45:49 -0500 Original-Received: by mail-qv1-f54.google.com with SMTP id f1so3309141qvx.13 for <61655@debbugs.gnu.org>; Mon, 20 Feb 2023 12:45:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=OsNVpG5TS6mw7m+t0mnSGSz4v9BU/fVN9TtcX8XGrGY=; b=FBiU3WRCes4r90j97wHBbinBnsXUHBBJuiYlZQT4b3Gw6R9ou9y4Ri9Veckz1+uFOk JKb2X6d458+3o535cy0Dz/BGeJXDf+QLYkJhqbVhXxxngeFDBUJQI0XrXUCHqiYQKzx0 jLMYSL1tzOhaqBqV4+1eD+/X6qAgR80LdveDt44m6L5GgzCbwNzeN8R2iOP51+q1lf7r NbipI4Z8bRluaoXqadX5Ckk3iFqdUPinrWCbVYMAPtAZAOQbQqZ6ablZlmGeGhO5ZmZc YnBomDmMxjQYwCV05fE7A+trcRoFk02TvWnpN+5dQudJ5bTtNGKXZJb3d/lHT6Ajxsev FK1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OsNVpG5TS6mw7m+t0mnSGSz4v9BU/fVN9TtcX8XGrGY=; b=7Ccj7KeItfTKVMyi4itYfhxi9aNLvTCtSTKY2yg0EaT7+y1rsld1z88wbmp1Gjm1qS uI3TAPo6zYE+fe7FiHzHsHfBMYr7AVimAdBvXkNP4yx/WRegh0UFgmg/iKU+DTKWY+3j LbC93f3IE5S0s+2hpkudkJSHOPiAi7ZioADlA2cGyCkBIhf0WmTuaAl/hNe1NrGxLRrt /ob3t3yJ+aTKzTAMAiFuq6CIxptnB2Iht/l6Aqy9Wf3wkvlDBnga1Q/KT936d50zvSKQ GvaA4yn/HFBNpVDTxuVseBf5xtoy5uNq8x5MdMATJ5C/6bhU1v4DffzuZgIIHpkYs70X JGJg== X-Gm-Message-State: AO0yUKVGdWeXDy3nA9oqKcTagNOGDq1eBGZ/ov8Sq/7g8guw70eFwE5r q1/ZqUo9+FH2bYxs3fuOQ2Q= X-Google-Smtp-Source: AK7set/LwHLiK2Bg1F0JYOFxE27qaucCHo+avmiHuKpaeolQf5T9CHp3xeBIOL+uuRpqoFacKwUbvQ== X-Received: by 2002:a05:6214:da4:b0:56e:fb48:cb18 with SMTP id h4-20020a0562140da400b0056efb48cb18mr3541701qvh.29.1676925939309; Mon, 20 Feb 2023 12:45:39 -0800 (PST) Original-Received: from smtpclient.apple (pool-108-21-63-133.nycmny.fios.verizon.net. [108.21.63.133]) by smtp.gmail.com with ESMTPSA id 13-20020a05620a040d00b0073b575f3603sm1427125qkp.101.2023.02.20.12.45.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Feb 2023 12:45:38 -0800 (PST) In-Reply-To: <871qmk9jaz.fsf@thornhill.no> X-Mailer: Apple Mail (2.3696.120.41.1.2) 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:256220 Archived-At: Hello All, > Jacob, do you have any examples where it is wrong and what you expect = instead? I had attached some screen grabs in my initial email, if they don=E2=80=99= t show up on your end they do show up on the web archives: = https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-02/msg01638.html. The key differences are: 1. `foo()` (i.e. a function definition) is light-blue. 2. `bar()`, and `baz()` (function calls) are dark blue. 3. The member function call `b.mem_func()` highlights the `mem_func()` = part in red. On the other hand, the builtin tree sitter mode font-locks them all = using the same light-blue color. Indeed performing M-x describe-face = over each separate part yields only `font-lock-function-name-face` for = builtin, while 3rd party returns separate faces (which are available to = customize) for each case. I looked through `c-ts-mode.el` as an example and found = `c-ts-mode--font-lock-settings`. Treesitter already identifies all of = the above cases as different nodes in the AST (as evidenced in = treesit-explor-mode) so it seems that adding another set of matchers = (and appropriate faces, e.g. font-lock-function-call-face) :language mode :feature 'label '((call_expression function: (identifier) @font-lock-function-call-face)) Should do the trick no? Best regards, Jacob Faibussowitsch (Jacob Fai - booss - oh - vitch) > On Feb 20, 2023, at 15:24, Theodor Thornhill = wrote: >=20 > Eli Zaretskii writes: >=20 >>> From: Jacob Faibussowitsch >>> Date: Mon, 20 Feb 2023 10:54:42 -0500 >>>=20 >>> Is it possible to have the builtin tree sitter give differentiate = font-locking for function calls and function definitions? >>=20 >> AFAIU, it already does. Yuan and Theo, am I wrong? >=20 > You're not wrong, but it depends on each implementation whether or not > the definition gets a different color or not. Jacob, do you have any > examples where it is wrong and what you expect instead? >=20 > Theo