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#61205: 'function' in 3rd element of treesit-font-lock-feature-list Date: Thu, 2 Feb 2023 13:03:01 +0200 Message-ID: References: <775e21ae-6513-8dca-a669-bedae86bf02d@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="33376"; 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: 61205@debbugs.gnu.org, Yuan Fu To: Randy Taylor Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 02 12:04:34 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 1pNXOL-0008OB-Ez for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Feb 2023 12:04:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNXNs-0005rf-Rj; Thu, 02 Feb 2023 06:04:04 -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 1pNXNq-0005oE-RV for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 06:04: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 1pNXNq-0008Q3-HB for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 06:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pNXNp-0001l9-SZ for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 06:04: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: Thu, 02 Feb 2023 11:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61205 X-GNU-PR-Package: emacs Original-Received: via spool by 61205-submit@debbugs.gnu.org id=B61205.16753357936702 (code B ref 61205); Thu, 02 Feb 2023 11:04:01 +0000 Original-Received: (at 61205) by debbugs.gnu.org; 2 Feb 2023 11:03:13 +0000 Original-Received: from localhost ([127.0.0.1]:60914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNXN2-0001k1-RP for submit@debbugs.gnu.org; Thu, 02 Feb 2023 06:03:13 -0500 Original-Received: from mail-ej1-f47.google.com ([209.85.218.47]:37757) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNXMz-0001jj-QG for 61205@debbugs.gnu.org; Thu, 02 Feb 2023 06:03:11 -0500 Original-Received: by mail-ej1-f47.google.com with SMTP id ud5so4871035ejc.4 for <61205@debbugs.gnu.org>; Thu, 02 Feb 2023 03:03:09 -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=bMRFxhFRaSR6ZvFXMQnbfCJiV+gThI/Ffa/PakL47u8=; b=jpcCPvaqGsgv9+s8k8Oebvy4y4RXVX+1VmHtwZovcc4r+tKu5N3cYqrIItGA/dlldW 3brojmaN+OtLZ7Q//0AQXjdQG/SA2cbZIqtKgJF0lEN6J820bnZCF9U37PM99RnK7hKF bqIr2W1B2GjpSArM/L4ddXZ2jw5XB54ykZSzKwHCGxCCFExLz98VHMRHfZvHkdc5xTpV J5ElGOPpwi4PRb2kAPrNkReHSRpXvbR/Y1Pltq969SQG1HtDz98qpEv7ayPbh34Q/mzf 8WnhbTOOU9OE3TTTo1J+WYJ454mC9pqMKCkAyhIicoRxJiDm9xkwMd05V3tCU8v6Ptsq kKig== 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=bMRFxhFRaSR6ZvFXMQnbfCJiV+gThI/Ffa/PakL47u8=; b=fIkyC+H8EJGjCVwWiD2nwilmEul3Ht6Ia7imrtLRxJWCG6ZazB/J1u0uN0mdKxHoGa vIwrK02lzXIYo5TDH+Ef6AZGQoiTSpKRZkQX16XPnjHG+J59HYyWXGKaTF4CooCqdDL6 n5wTWpBavemiiFkz/faeeqcFDkSLtUSWzagwwH+Zos7wsMpfeiouytlJXdwPLIAqILqc X4I3Dn3EqbZHTj0OkMqmHQUJBt++bENQ74JJWM5dg9JJeJtQrvBo3O1WeBEimRiAZcaR plxpu0r1dFzwIP7+cBIMasHVQC6M/9sdkjWuSjom0C91gFQ21KuXMDp0sZL3Hmen7pja RHbQ== X-Gm-Message-State: AO0yUKU+R3PDr7V5ke7q/vdm9uNF4fu+NIqlSSfXCTbnXTY4j316x2ru b7K5x6DOdsvPXg5IBGlhR24= X-Google-Smtp-Source: AK7set/nR1cxshhgm1ZS9t9DqCKYIaGHEJBF9smJmyyt5MZU0tBmUdQnlVZiZSPqDNX+X5H8VJM1LA== X-Received: by 2002:a17:907:a501:b0:877:612e:516e with SMTP id vr1-20020a170907a50100b00877612e516emr1486302ejc.61.1675335783670; Thu, 02 Feb 2023 03:03:03 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id ab13-20020a170907340d00b0088e9bbae7ecsm1415253ejc.165.2023.02.02.03.03.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Feb 2023 03:03:03 -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:254645 Archived-At: On 02/02/2023 05:18, Randy Taylor wrote: > On Wednesday, February 1st, 2023 at 21:34, Dmitry Gutov wrote: >> On 01/02/2023 07:18, Yuan Fu wrote: >> >>>> On Jan 31, 2023, at 6:08 PM, Dmitry Gutov dgutov@yandex.ru wrote: >>>> >>>> X-Debbugs-Cc: Yuan Fu casouri@gmail.com, Randy Taylor dev@rjt.dev >>>> >>>> Some new built-in modes has 'function' feature highlighting thus enabled by default. >>>> >>>> rust-ts-mode, go-ts-mode, cmake-mode >>>> >>>> Should we move it to 4 for consistency with the rest? >>>> >>>> Previously, we talked about that and concluded that function calls are usually everywhere and are easy to notice without additional highlighting. >>> >>> Right, I think they should be level 4. >> >> >> OK, I tried simply changing that, and it turned out none of these modes >> have a 'definition' feature, so highlightings get stripped from all >> definitions as well. >> >> And in a couple of cases function calls got highlighted either as a >> type, or as a property. I fixed the latter by deleting one selector, and >> the latter didn't touch per se. >> >> But since the same modes had 'variable' and 'property' features in the >> 3rd level as well, I moved them to the 4th (that resolved the incorrect >> highlighting as property mentioned above, but it's probably need to be >> improved later, in case someone will want to enable 'property' but not >> 'function' highlighting). >> >> And I added the 'definition' features and moved some highlighting rules >> there. And added some. >> >> So the patch looks a bit more complex than expected, see attached. >> >> cmake-ts-mode, in the end, I ended up keeping as-is. The 'variable' >> selector is more functional there than everywhere else (the grammar uses >> those nodes for template expansion), and if 'function' is removed, the >> buffer looks almost devoid of highlighting. >> >> Also none of these modes have highlighting for function parameters or >> assignments. That can be improved later. > > I just took a quick look (will have more time tomorrow hopefully), but: > > Why are there 2 separate definition features for both go and rust? > There should just be one each. It was an arbitrary choice on my part: the queries highlight different things (with different faces), so I put them separately. I don't mind if we combine them. >> - (scoped_identifier name: (identifier) @font-lock-type-face) > > Why was this removed? I think this will lead to some imports not being highlighted at the very least. It led to code like 'test1' in test::test1(); being highlighted with the font-lock-property-face. I didn't have a lot of time to spend on this, so just removed the rule. Some imports indeed are missing highlighting as a result. Perhaps the queries need to be scoped to 'use_declaration' nodes? > And please keep treesit-font-lock-feature-list alphabetized :). Sure. And in case you wanted to propose the next revision of this patch, I certainly wouldn't mind ;-)