From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_Paulo_Labegalini_de_Carvalho?= Newsgroups: gmane.emacs.devel Subject: Re: Initial fontification in sh-mode with tree-sittter Date: Fri, 28 Oct 2022 10:34:56 -0600 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000004660f605ec1ad7b2" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39512"; mail-complaints-to="usenet@ciao.gmane.io" To: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 28 18:36:20 2022 Return-path: Envelope-to: ged-emacs-devel@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 1ooSLE-000A3b-1H for ged-emacs-devel@m.gmane-mx.org; Fri, 28 Oct 2022 18:36:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooSKA-0005Xc-Gs; Fri, 28 Oct 2022 12:35:14 -0400 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 1ooSK9-0005Qq-0v for emacs-devel@gnu.org; Fri, 28 Oct 2022 12:35:13 -0400 Original-Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ooSK6-00063Z-40 for emacs-devel@gnu.org; Fri, 28 Oct 2022 12:35:11 -0400 Original-Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-1322d768ba7so6872418fac.5 for ; Fri, 28 Oct 2022 09:35:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=/Ovtz1TPFDp18OjDwXnwZi/jIgVvVIR7VKH8Z92mL6s=; b=KXqn7138+BoAdsb1jFlcduC8S15xDGmLaqDFxqraSkOtCrr4rlhN5VTjc9asZU3sz4 lEhevjcT7Epioiucgwy03cAZ1DkRL0/1jF2o9b5BW0xTMpOdBERkoqnfBbZiMuL0yKXx WcU9jkX9ARxiM5ue7UDRYOtZPIZPogAiZB0x56Wj+u5C8+T9k1RzNatzBc4oO9libSEO fCidWM+JB70x4gSpTWeDjrSgQM/oKijhImAlGGckyKRsbIGGTeiRF02z3klWYr1cT5Bb 8MPVxyWmi1ZK26Ll1Rzg8EB95YUnyR26yi/2nzZnQ2Ezh6lxTDdLUMGfVPrdFqPVCkHG OLfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/Ovtz1TPFDp18OjDwXnwZi/jIgVvVIR7VKH8Z92mL6s=; b=7ffzEdkGy0kEcaidq5ZwoxK9b7SEqDdCgMBtMFC7gNP9SZQHdTND/KNTx0rx6pZkGs CT2KCsQV1OvFvIQ2uVnFmI0RWW6TE/X3eq2+LW0WTH4Et4FM6Kurq/CxlCPQJnZrPz4N s6yy+SlI7iWPXauWvBibHLtLWcUcW4tlgffU53hEs6xNm860gIukiu6yX4f9zxUnnhW/ 5sEocR8xpX7f1ydc1yAEBdX5UW3g5GoWCBG/J3ZRBkwa++afbGDCQPxF8hY3/e6jQvR8 SrllqkApdlZuAoQk9fgLgVjuHwed9knrHFwbi8HgCp8FTMWtlu3M2u3KLK5wWtN4oMvB U8mQ== X-Gm-Message-State: ACrzQf3bHSnfNYp57mS4Xxi3D5zlaVXwIyYS0C+rmneZngnH/8oal/5e LQDOVo289QmPOL4k6iF89PXbnTjLkUt5NDJ/zuk= X-Google-Smtp-Source: AMsMyM7Gz/sMT7HSMei4rNfbwoICBeoXdVYCEtKBTLphDSlY2thpBi+w4DrzEkQJufU5qUQSRzeZ2opbI2jv7q3Z7cY= X-Received: by 2002:a05:6870:d1d0:b0:12c:cfd2:8285 with SMTP id b16-20020a056870d1d000b0012ccfd28285mr52257oac.105.1666974908570; Fri, 28 Oct 2022 09:35:08 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2001:4860:4864:20::2d; envelope-from=jaopaulolc@gmail.com; helo=mail-oa1-x2d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:298684 Archived-At: --0000000000004660f605ec1ad7b2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Oct 28, 2022 at 10:15 AM Stefan Monnier wrote: > Indeed, it's sad. It's goes against the idea being > `treesit-font-lock-feature-list` which is to map features to levels. > > It doesn't make much sense to call a highlight feature "moderate". > Highlight feature names should be things like "function names", "nested > functions", "multiline docstrings", "punctuation". > I agree with that. It seems that the initial effort on using tree-sitter was following font-lock notions too closely. For instance, if we are creating features such as "function names", "nested functions", and "punctuation" does it still make sense to have something like `font-lock-maximum-decoration'? Because, it is not clear to me how we can say that fontifying "multiline docstrings" is a *higher* decoration than fontifying "function names". Maybe the items in the list should not have a priority of particular order, their presence just serves to enable, while their absence disables, the fontification of a particular feature. I will isolate the queries to mirror the idea of each feature map to program constructs as suggested. --=20 Jo=C3=A3o Paulo L. de Carvalho Ph.D Computer Science | IC-UNICAMP | Campinas , SP - Brazil Postdoctoral Research Fellow | University of Alberta | Edmonton, AB - Canad= a joao.carvalho@ic.unicamp.br joao.carvalho@ualberta.ca --0000000000004660f605ec1ad7b2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Fri, Oct 28, 2022 at 10:15 AM Stef= an Monnier <monnier@iro.umontreal.ca> wrote:
Indeed, it's sad.=C2=A0 It's goes against= the idea being
`treesit-font-lock-feature-list` which is to map features to levels.

It doesn't make much sense to call a highlight feature "moderate&q= uot;.
Highlight feature names should be things like "function names", &= quot;nested
functions", "multiline docstrings", "punctuation".=

I agree with that. It seems that the i= nitial effort on using tree-sitter was following font-lock notions too clos= ely.

For instance, if we are creating features such as "functio= n names", "nested functions", and "punctuation" do= es it still make sense to have something like `font-lock-maximum-decoration= '? Because, it is not clear to me how we can say that fontifying "= multiline docstrings" is a *higher* decoration than fontifying "f= unction names".

Maybe the items in the list should not have a p= riority of particular order, their presence just serves to enable, while th= eir absence disables, the fontification of a particular feature.

I w= ill isolate the queries to mirror the idea of each feature map to program c= onstructs as suggested.


--
=
Jo=C3=A3o Pa= ulo L. de Carvalho
Ph.D Computer Science | =C2=A0IC-UNICAMP | Campinas ,= SP - Brazil
Postdoctoral Research Fellow | University of Alberta | Edmo= nton, AB - Canada
--0000000000004660f605ec1ad7b2--