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: Status update of tree-sitter features Date: Wed, 28 Dec 2022 16:23:21 -0800 Message-ID: References: <5d53b299-14e1-6f8b-58b3-7e16842d87a9@yandex.ru> 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="11074"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 29 01:23:52 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 1pAgi8-0002gv-8w for ged-emacs-devel@m.gmane-mx.org; Thu, 29 Dec 2022 01:23:52 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAghk-0001Gj-Ms; Wed, 28 Dec 2022 19:23:28 -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 1pAghi-0001GT-I0 for emacs-devel@gnu.org; Wed, 28 Dec 2022 19:23:26 -0500 Original-Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAghg-0001ZX-Jt for emacs-devel@gnu.org; Wed, 28 Dec 2022 19:23:26 -0500 Original-Received: by mail-pj1-x102d.google.com with SMTP id o1-20020a17090a678100b00219cf69e5f0so21431992pjj.2 for ; Wed, 28 Dec 2022 16:23:24 -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=664sRHFHnBpXUGlYQPhCbfyN7Yru4HcqjTlkvky+KJk=; b=Lc0utx1Coaa4LlJgwRCm2FXO83eQgyO4pNQaw3GvltlGedeeNUuTNp81D/RrGb5b6j 3EXtJcpx3WaEqeLuxDx325PN4q6T2BoMNPMKtz86pFtTuZlZS/6CaKcjzvsluopBCaev i+dVSvxqMsGRwO7GtgHJaljh0Vp1osmL9z3HkaeBhMw4isHeT59h2YNGNK39dHtY6l1n h/5VRQyB4v4psACftvqr/MWh+A6+LmtwxZFffjlkYUYVr9NBLW9GHJQLf+8lMYC/Ad9N CNOI5sP75gPrGHUk6e+Oz4C33QERW+SY6thaPK2X8aN/P5Xua5CkliazUP+XR6J5sgqY VWvw== 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=664sRHFHnBpXUGlYQPhCbfyN7Yru4HcqjTlkvky+KJk=; b=Ts0SnPEj17T5E1WJPKIQckxIGTPIVDrAbuuGafe3iZFUaF2dDZxuAhZt5fWrbK7pOs w5NK62e1RaEYmI/sQmOzHoscNwZlHX0yWZASLAoHfKvFivSlgbIItDT2USGvebOsNQ6O TGzhgfaU0gDntWKkUBljNROYcUDRYf2WPoBa7s7FW1hnihyqTgRD8hcEuVvTYruwaaza LVezh5TtWQGiTvNERsM3NWxDniE5aTEs5nDBoVWoDdMpTNn0iX+GZhfzkSecOxFS/AQB nzzgUqFUcirKw0JcNQrhM1vj33l+tYlYPNKd8YkgDOFiu6KVZ+M3deVXi4BFnS48/kHY DgpQ== X-Gm-Message-State: AFqh2kq/EVlsayE5BkF7TQ9+GDHO4vCt1NHYqoKEGWLWmWs02PlffJFp 3cMAn6zdrRibMTwF8HD1NQM= X-Google-Smtp-Source: AMrXdXsQLeSA2W2ydtke/9gyPlPLNHonHcSedPnAXMFcD6Vuc+0fYyKYSHu4psTWVViW68j5casfBQ== X-Received: by 2002:a17:902:ab1b:b0:191:3f73:bf4e with SMTP id ik27-20020a170902ab1b00b001913f73bf4emr36970344plb.62.1672273402964; Wed, 28 Dec 2022 16:23:22 -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 g1-20020a1709026b4100b0018853dd8832sm11546669plt.4.2022.12.28.16.23.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Dec 2022 16:23:22 -0800 (PST) In-Reply-To: <5d53b299-14e1-6f8b-58b3-7e16842d87a9@yandex.ru> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=casouri@gmail.com; helo=mail-pj1-x102d.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:302018 Archived-At: > On Dec 28, 2022, at 3:27 PM, Dmitry Gutov wrote: >=20 > Hi Yuan, >=20 > I'm late to the party, so apologies if any of the following has been = discussed before. >=20 > On 28/12/2022 11:44, Yuan Fu wrote: >=20 >> Here is the list, for your reference. Among all the features, I think = assignment is =E2=80=9Cnice to have=E2=80=9D, it=E2=80=99s fine to leave = it out if there isn=E2=80=99t enough time. Same goes for key: it may or = may not apply to a language. >> Basic tokens: >> delimiter ,.; (delimit things) >> operator =3D=3D !=3D || (produces a value) >> bracket []{}() >> misc-punctuation >> constant true, false, null >> number >> keyword >> comment (includes doc-comments) >> string (includes chars and docstrings) >> string-interpolation f"text {variable}" >> escape-sequence "\n\t\\" >> function every function identifier >=20 > The description makes it easy to mistake for function definitions as = well. Whereas the place where this category is used is function/method = calls, right? And perhaps some other references to methods inside the = code where the language parser can distinguish those from property = access, etc. >=20 > If it's only about calls, maybe call this category funcall? Function, property and variable are for every occurrence of them (the = touted =E2=80=9Cconsistent highlighting=E2=80=9D). So there will be a = bit of overlap between function, variable, and definition.=20 >=20 >> type every type identifier >> property a.b <--- highlight b >=20 > Do we think it's a good idea to have 'property' in the default = highlighting? IIUC the default level is 3. >=20 > Code like foo.bar is easy to understand at a glance, so it seems like = it'll lead to a lot of repeated highlights. If 'function' (or 'funcall') = is a level 4, maybe 'property' should be there too? Ah yes property should be level 4, along with function and variable. >=20 > > variable every variable identifier >=20 > 'variable', so far, seems like the least useful. When enabled, it = lights up every bit of text that remained from other matchers -- because = identifier are everywhere. Yes, but apparently people want it ;-) > There is this more advanced prior art for highlighting variables, by = tracking the scopes using custom annotations, see locals.scm here: >=20 > = https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variab= les >=20 > What's displayed under "Result" would be really handy to have in Ruby. >=20 > It's nothing urgent, of course. Maybe for Emacs 30? Yeah, this requires some non-trivial addition to the current = fontification code. > For Emacs 29, though, I would discourage the use of 'variable=E2=80=99. It=E2=80=99s on level 4, meaning not enabled by default, so I think = it=E2=80=99s fine.