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.devel Subject: Standardizing tree-sitter fontification features Date: Thu, 24 Nov 2022 14:16:02 -0800 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) 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="5924"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 24 23:16:45 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 1oyKWT-0001Pe-Fz for ged-emacs-devel@m.gmane-mx.org; Thu, 24 Nov 2022 23:16:45 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oyKVu-0003uW-W2; Thu, 24 Nov 2022 17:16:11 -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 1oyKVs-0003u9-To for emacs-devel@gnu.org; Thu, 24 Nov 2022 17:16:09 -0500 Original-Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oyKVq-000287-2u for emacs-devel@gnu.org; Thu, 24 Nov 2022 17:16:08 -0500 Original-Received: by mail-pg1-x529.google.com with SMTP id f3so2480537pgc.2 for ; Thu, 24 Nov 2022 14:16:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=NnXPFlxV530R++wvs0Caj1HZk8g0nJcipm+fYFZyOqg=; b=QYk486Ym0M0rmhNmqmkNlDvbgocdR4VCofX9vb35WAPLu6yysd0C+q1urM8hJW8NAG xgeS6hUrHMLXBzIM7G2zeRI836Ato3WquVlA2hKi/c5Rdo+hD797flSz+B7boLg+OsM0 S81Uz+ndhqDwaeU5nHZQtHqDM5SgSO/yzi5cSfJqlIF4qmySw+QBxISVwEKXuAmiXGQ4 JFP+MA6XbCNgrcpsYrYe+rr+W4wfb2ohCWE3tG8G13mORdWLUnhOePSdb+w1Fv7Cjgh1 8c7ob7vqztxNGebrmMKgIueDu84ceKeZiX8jKeuZW0rE4O7codohimVa7qU5M62LpRyi m5QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NnXPFlxV530R++wvs0Caj1HZk8g0nJcipm+fYFZyOqg=; b=u4XKvRzq54sak9oGPp5srcODSip9luHARJK00NWVPbULLsFoujdjOGlIn8UepQr+rf BkNnsWlRxkrDU4T3LbdUKpWxXpnr+Mzs468qL2QdeaJOv5+Lv/L3NGSufSpwZA2Bn9NB fJ56VUJOOsWeqvVhhATtLgRHEjQM9c2zpEgB4PiHpat3Jv+2JUxKSC8dvUEmfiAKxZGj aEWsw9PXkJX1wDa94p6PJ4nHfutikL0RuyX/Mzj5S78hVwPLiuvb2QVkBsa8Nn1lN5Az qs1qRAhqUwZRcbYA65CKOPOoaq3EUarSb/fzE9mvAG0aXwIKDJOQMaJsYiXc7Zhgz79h W4bg== X-Gm-Message-State: ANoB5pnB+lfWnQ4TEdGZCHLcCFcS8kr+m+yjaurWLXXU6tnYmkKq+0iE BwaciR59ugXZsdGtQT3Yzwpb8pPOntgilw== X-Google-Smtp-Source: AA0mqf649+ID3+mUnUnJf8/V9p3vSsU0C3s5qvExV5BCgx+1G+K1tT2pDTDMtn/Z4rkwrdqgwK+WaQ== X-Received: by 2002:a63:461d:0:b0:456:d859:2143 with SMTP id t29-20020a63461d000000b00456d8592143mr12924544pga.396.1669328164135; Thu, 24 Nov 2022 14:16:04 -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 oa14-20020a17090b1bce00b0020d24ea4400sm3633683pjb.38.2022.11.24.14.16.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Nov 2022 14:16:03 -0800 (PST) X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=casouri@gmail.com; helo=mail-pg1-x529.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, 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: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300448 Archived-At: For tree-sitter-based major modes, fontification rules are categorized = into =E2=80=9Cfeatures=E2=80=9D, which can be individually turned = on/off. I think it would be good to have a standardized list of common = features and their precise meaning defined. We=E2=80=99ve been working = on these fontification rules for some time and arrived at a reasonable = baseline, and now it=E2=80=99s a good time to discuss and bless it, I = think. Right now we have: Basic tokens: delimiter ,.; operator =3D !=3D || bracket []{}() constant true, false, null number keyword comment string string-interpolation f"text {variable}" escape-sequence "\n\t\\" function every function identifier variable every variable identifier type every type identifier property a.b <--- highlight b key { a: b, c: d } <--- highlight a, c error highlight parse error More abstract ones: assignment: the LHS of an assignment (thing being assigned to), eg: a =3D b <--- highlight a a.b =3D c <--- highlight b a[1] =3D d <--- highlight a definition: the thing being defined, eg: int a(int b) { <--- highlight a return 0 } int a; <-- highlight a struct a { <--- highlight a int b; <--- highlight b } There are also language-specific features, but they are not the focus = here. Once we agree on a list of standard features and their definition, the = next step would be to figure out how should a major mode introduce its = supported features to a user (major mode docstring + link to manual for = standard features?). Also, some of the features are very busy, it would be good if we can = disable they by default. The default value of = font-lock-maximum-decoration is t, meaning use everything, which is not = very helpful... Yuan=