From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#61655: [Tree sitter] [Feature Request] font-lock function calls, definitions, separately Date: Tue, 21 Feb 2023 00:28:37 -0800 Message-ID: References: <8DA1B548-B8D2-4EC1-B9F8-F7654003AC89@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) 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="32203"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61655@debbugs.gnu.org To: jacob.fai@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 21 09:29: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 1pUO1c-0008Ff-HZ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Feb 2023 09:29:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUO1R-0007Ef-0G; Tue, 21 Feb 2023 03:29:13 -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 1pUO1G-0007Dn-Jg for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2023 03:29: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 1pUO1G-00083v-8S for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2023 03:29:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pUO1G-0008Ak-4Z for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2023 03:29:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <8DA1B548-B8D2-4EC1-B9F8-F7654003AC89@gmail.com> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Feb 2023 08:29: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.167696813731405 (code B ref 61655); Tue, 21 Feb 2023 08:29:02 +0000 Original-Received: (at 61655) by debbugs.gnu.org; 21 Feb 2023 08:28:57 +0000 Original-Received: from localhost ([127.0.0.1]:54468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUO1B-0008AS-Fv for submit@debbugs.gnu.org; Tue, 21 Feb 2023 03:28:57 -0500 Original-Received: from mail-pj1-f45.google.com ([209.85.216.45]:53792) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUO18-0008AB-TC for 61655@debbugs.gnu.org; Tue, 21 Feb 2023 03:28:56 -0500 Original-Received: by mail-pj1-f45.google.com with SMTP id o16so4006093pjp.3 for <61655@debbugs.gnu.org>; Tue, 21 Feb 2023 00:28:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=1Vlqc6JlF3lnCJ/PFm5jwXi16qTXzO1NH5fIZTZRefw=; b=G9ttertEPhFSqqnRV7RCCru1HjJBjH3KmKV/iS8Cj4rz+CznaCrPbnGff+1H3XMAie Z+c45IxqmI1L9y16qFWgA/ALddsh2bw9YmeqR2qTNJ9/dP1BAokPAqicwPV4tv4mEcaY 1RcXjDxCFXMQbYXgKf0bjrEFGPVwu0mcBhrjch/MwQUyRuXlXfbTc1GBmfWzNX/ENTWK sxiS11Pxtv+1qYDORlEm2KGEO8wpED8FdYzU5IbbajtwAe+qxbraNTGB/aFNgOblx+b3 myryoN1h5yYkznJJ8xuJEEeqAy9rm0BXn2Br32Q1J3avzK/QwdH2Cf9Z+k3eo7n75A+X jsVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1Vlqc6JlF3lnCJ/PFm5jwXi16qTXzO1NH5fIZTZRefw=; b=szFBdCDqlN9+ZboNmT/3H96Ejpn2Ip+mWd5vfJ4dKi8roaNckhshtaurXIVyjVcr09 qRS9RxTrBMSHSFQAoOX1JVKa9XaEtzANKEortI4ytFHFDEBpZUl4//6NehYq/3sr6cpD iJC6gAHvAfe4n/XT8uxeC/qQdqcdb2E61eOxqFEXWf/3Q3Q5EXuehcSz7+Favlp2Jfam haHpaxs93x5qdVJ2JWfeYKOHTKZmWhyLZYN5W425hkrAUSktsXoWnIoySrPxtblIPoHa nQV3KAFRhA2jxy8GX/GKMokcD97rGNayZdmlytKkNtKOUGkj2/zjITBfEdOjHvwmUxMs s+3A== X-Gm-Message-State: AO0yUKXhpYXGu0otYz3PALB3c7Uc05SqEgf/AkOzkiMQXDZvGc2PvrIp WGFGy1Y02rsB1son+/oie6U= X-Google-Smtp-Source: AK7set9gHl74xGFZqVDje3vkbSLDZsbESm6srt98fnQ0zO+0tRRbg/PT0Kpbv5+KBzLmNdO5kFyQkg== X-Received: by 2002:a05:6a21:998b:b0:c7:6571:2341 with SMTP id ve11-20020a056a21998b00b000c765712341mr4085659pzb.48.1676968128764; Tue, 21 Feb 2023 00:28:48 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id y26-20020a62b51a000000b00592417157f2sm9175590pfe.148.2023.02.21.00.28.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Feb 2023 00:28:48 -0800 (PST) X-Mailer: Apple Mail (2.3731.300.101.1.3) 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:256238 Archived-At: Jacob Faibussowitsch writes: > Hello, > > Is it possible to have the builtin tree sitter give differentiate = font-locking for function calls and function definitions? > > The 3rd party tree-sitter package = (https://github.com/emacs-tree-sitter/elisp-tree-sitter) has this = feature and it is quite > nice. In fact it goes further, allowing you to additionally = distinguish between builtin calls, macro calls, method calls, etc. > (see = https://github.com/emacs-tree-sitter/elisp-tree-sitter/blob/master/lisp/tr= ee-sitter-hl.el). > > As far as I could see, the builtin mode only provides = `font-lock-function-name-face`. I have set treesit-font-lock-level to > 4.=20 > > Examples below are for C/C++ mode, but this would apply to any number = of languages. > > Desired (i.e. what 3rd party package produces): > > * > > Current: > > * Hmmm, yeah. The builtin tree-sitter maps syntax queries directly into faces, where the third-party tree-sitter maps syntax queries to some syntax types, then maps types to faces. So it would be a bit harder to do fine-grained control like in the builtin tree-sitter, comparing to the third-party one. I=E2=80=99ve thought of this idea before but didn=E2=80=99t pursue it = further: Right now we allow capture names to be face names and functions, eg (commment) @font-lock-comment-face or (comment) @xxx-moode-fortify-comment Maybe we can add a third type, arbitrary symbols, like (comment) @comment and add a variables treesit-font-lock-mapping which maps symbols to faces or functions: ((comment . font-lock-comment-face)) or ((comment . xxx-mode-fontify-comment)) Then we can easily support differentiating between function call and function definition. Yuan