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#61655: [Tree sitter] [Feature Request] font-lock function calls, definitions, separately Date: Tue, 21 Feb 2023 11:55:19 +0200 Message-ID: References: <8DA1B548-B8D2-4EC1-B9F8-F7654003AC89@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24348"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: 61655@debbugs.gnu.org To: Yuan Fu , jacob.fai@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 21 10:56:16 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 1pUPNf-00067W-Ur for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Feb 2023 10:56:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUPNa-00047a-No; Tue, 21 Feb 2023 04:56:10 -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 1pUPNT-00047G-Km for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2023 04:56: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 1pUPNS-000811-1L for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2023 04:56:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pUPNR-0002BH-Tl for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2023 04:56:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Feb 2023 09:56: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.16769733298333 (code B ref 61655); Tue, 21 Feb 2023 09:56:01 +0000 Original-Received: (at 61655) by debbugs.gnu.org; 21 Feb 2023 09:55:29 +0000 Original-Received: from localhost ([127.0.0.1]:54563 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUPMv-0002AK-94 for submit@debbugs.gnu.org; Tue, 21 Feb 2023 04:55:29 -0500 Original-Received: from mail-wr1-f53.google.com ([209.85.221.53]:33405) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUPMt-0002A0-8k for 61655@debbugs.gnu.org; Tue, 21 Feb 2023 04:55:28 -0500 Original-Received: by mail-wr1-f53.google.com with SMTP id bo30so3182524wrb.0 for <61655@debbugs.gnu.org>; Tue, 21 Feb 2023 01:55:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=PXivJX+u/xIwGbEsiRZ+ek67sScMklSdCvoCFipiWog=; b=WvLsjnqGu3xYxsMwiG25ftxE6I6W1HVXdzTKN2Dx5pi9gdievXUBn6OeaxEtKHbSXm e8dbyT1j7WvPEWqfDZTDZroKLRILTJQvxYHLD+IVorHYRXa6oRnMchquwWU9G6ET1ErC hyWCFT8nIp+ph1VubiyWoNxn++TGjQrhAHj3ExKl4eY3x8UMWZUNiLV2kQEM2hP9ghdZ QeEBlikL+9KFXgMMuFRBUxoBolSDnsbvu06I8fYro3ZXTybGqeShu/u7KvmeLvQtLxH7 lALdnPtgu6KDQfdjBc8/mC34anElBWz+KStDzSQ7Ya+cmb76zS50qgaxIUcmtZkTTEpe ujuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PXivJX+u/xIwGbEsiRZ+ek67sScMklSdCvoCFipiWog=; b=g+cZp4qOsaSFL4c96ARNo65CDq8Ev5NCkCQl77oOTqT2dRqlYrbAsTNBZuYyxDIfgy WAwFDzmBgRD6zf+qjcWGBsGWXmO0KyzgvPL4uD1au+Y988QL+1VXPuSO26GhIytSXsmd BQf8mIYC5p1DtWL6nJB9jgV3Y1KNie8vVrLA+z9x9Zza2F1Zbhs46Ib5edvPzZA+3xWy clTxT0gJ3b6azp8ABRJmrxH7xrpZJP0rxHSCHhx+QXNVVhkbgDz5lGapf6rudn2WV5iI lakkru0ancH+DV3GaU+Ziolt5J/xr5b2Kmc/wtv02TaL30YTHCrwjDQ+Gu7y8EiDLT8v gu7w== X-Gm-Message-State: AO0yUKVWpQL6L5lppwII5QwuLyEUbAKTw7nogLhV5oSt6MMVrVbJckhF UsIF9tNTo4e8q3i4xhHfo4Y= X-Google-Smtp-Source: AK7set+OZH0ELmMUQ5hOzThu/MJ3mr3YBa/x81QTat3UaeAR4fTlqvxWySLxfsXXQLTGFQ6gMaykww== X-Received: by 2002:a05:6000:2ce:b0:2c5:519f:307a with SMTP id o14-20020a05600002ce00b002c5519f307amr4683426wry.30.1676973321512; Tue, 21 Feb 2023 01:55:21 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id h7-20020a5d6887000000b002c5501a5803sm2123325wru.65.2023.02.21.01.55.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Feb 2023 01:55:21 -0800 (PST) Content-Language: en-US In-Reply-To: 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:256244 Archived-At: On 21/02/2023 10:28, Yuan Fu wrote: > 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’ve thought of this idea before but didn’t 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. Before we do any of that, don't we need actual different faces to use for e.g. function definitions and function calls? Same for variables. And if we have those, we might not need the indirection, at least not right away. I figured we'd add them in Emacs 30, but it's a relatively small change, if people are interested.