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: Re: Standardizing tree-sitter fontification features Date: Thu, 24 Nov 2022 22:34:12 -0800 Message-ID: References: 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="7478"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 25 07:35:49 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 1oySJR-0001js-0V for ged-emacs-devel@m.gmane-mx.org; Fri, 25 Nov 2022 07:35:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oySI7-0001IV-Ce; Fri, 25 Nov 2022 01:34:27 -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 1oySI2-0001FY-RC for emacs-devel@gnu.org; Fri, 25 Nov 2022 01:34:23 -0500 Original-Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oySHy-0003dk-5R for emacs-devel@gnu.org; Fri, 25 Nov 2022 01:34:22 -0500 Original-Received: by mail-pl1-x636.google.com with SMTP id io19so3159214plb.8 for ; Thu, 24 Nov 2022 22:34:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UKirlWIYuZr9I0LdyUknN/5y4enCUWW7mBc1tt7/v5E=; b=Ci9Pkw1OJePcUoch0pR2d7Zl2NBIwRFAGp0SvsQl+tdkmBe+i0whsHeCiwPZq/j3oZ yTpmqPBwL9YWyP2v7Ew4EIMyEGG93rg2Oj1zhl9hKj443Jy4YI9g2Zsukfuo9cQq3uo+ LkWjqFxCIASvUCRSVPBOevlVebpwu1c7cMBFGD4YT8LDPHcH3efVh57RcGDLTlXk2i61 NS+6+jlKnpbSN3o6ulgNWwZtCJD39abiYlp02mt9/8cmeDLJGVYqm66kjrYX+Ybg63B7 rwq57mIY5tgkFN24RXYtwMLjWNf1OPuKePbJoJtDl7+KVEV1J8h7UvEdmOiMC55sodE6 JajA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UKirlWIYuZr9I0LdyUknN/5y4enCUWW7mBc1tt7/v5E=; b=Q0ONYAZ+hj+La1bQG/MOtOobEfG1RSXH7LHTO8mPbbJPtfq2JYLUTHgmWxgiZHUZ+m kG6c8L+hc6VCwp79UWFbve+8n+O8ryriAHjhqgNdgRWBhYcez0DGEKSLk0NdujB+IbsR TDQbevluZUQo5YwhQkjua6hjc3XUG+WyuYxGrIuugv26r2lZsytPeFiNk7OEUFzWwOgu o/IXK7xG0V6lAa+OE3CO7iOhRr9zHjlMHUMwCnnvzncrKZk6z8iZYTIkNKiUX4HqhKiB IZG2EJ9vEtREedf6fDDueFxfaHCIwZ14yASbnxH/Mxk/5RTak5rTVJNMtw696qINAgi0 qhYg== X-Gm-Message-State: ANoB5plaSxdiHWT/0ky8tIHX5xo2sTB+KHF4P644XQ5bPrkxrXdhos6q +T/+PTJHgrcIRyCH7SsOkZs= X-Google-Smtp-Source: AA0mqf49bO1jOE1j+GI81KLYXplZqWGNl1TunQAeeXyYOXhGUtRrIl6Bz+2eJrgMSqR7jJdRle9gDw== X-Received: by 2002:a17:903:92:b0:186:72bd:371f with SMTP id o18-20020a170903009200b0018672bd371fmr23611583pld.131.1669358053819; Thu, 24 Nov 2022 22:34:13 -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 t123-20020a625f81000000b005747b59fc54sm2329914pfb.172.2022.11.24.22.34.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Nov 2022 22:34:13 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=casouri@gmail.com; helo=mail-pl1-x636.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:300461 Archived-At: > On Nov 24, 2022, at 6:56 PM, Stefan Monnier = wrote: >=20 >> Basic tokens: >>=20 >> delimiter ,.; >> operator =3D !=3D || >=20 > =46rom the grammar point of view, both of these are simply infix = thingies. > Defining precisely the difference between them can be a bit more > delicate, tho. I guess intuitively the idea is that "operator" > corresponds to some kind of run-time operation whereas "delimiter" > serves only to figure out where things start and end but doesn't do > anything in itself. Maybe think in semantics? If it produces some value, it=E2=80=99s an = operator, otherwise it=E2=80=99s a delimiter/punctuation. And I should = have used =3D=3D instead of =3D in the example. I was thinking of =3D=3D. >=20 > Not clear where the `=3D` used for definitions (as in "let x =3D foo = in > bar") should fall. Same for the "," used to construct pairs > or the conjunction/disjunction in Prolog written `,` and `;` > respectively :-) I think stuff like `:` in Haskell (I only know Haskell) can be = considered operator, but `::` would be punctuation. With that said, I = didn=E2=80=99t put much thought into delimiters, and it seems to be a = slippery slope (as shown in your `=3D` example). Maybe we should limit = it to the narrowest scope for now, just things like , ; that truly are = delimiting things. >=20 >> string-interpolation f"text {variable}" >> escape-sequence "\n\t\\" >> function every function identifier >=20 > I think we definitely need to distinguish a reference/use of a = function > from a definition of a function. I do want my function identifiers > highlighted in my function definitions but *not* in my function calls. That=E2=80=99s when assignment/definition come in. See my reply to = Randy. >=20 >> variable every variable identifier >=20 > Same here. > [ Note that in many languages (e.g. Scheme and C), functions and > "variables" are the same (i.e. Lisp-1 in the world of Lisp). ] We can say that if the symbol is used as a function, highlight in = function face, and if it is used as a value, highlight in variables = face. >=20 >> type every type identifier >=20 > And same here as well. > [ I will spare you the discussion of what should happen for = dependently > typed languages where types are "normal" values. ] =E2=80=9CAnything capitalized in type face=E2=80=9D, I guess ;-) >=20 >> 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... >=20 > If you compare the "style" of font-lock rules used until now to those > provide in the new tree-sitter modes, I think it makes sense for > tree-sitter modes to default to "medium" decorations. Like setting font-lock-maximum-decoration to a number in major mode = body, it its default value is t? That changes the meaning of t in = font-lock-maximum-decoration. Can we change its default value to 3, and = put the busy features at level 4? I need to survey existing major modes = and see how many levels do they have right now.=20 Yuan=