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: Thu, 29 Dec 2022 01:21:47 -0800 Message-ID: References: <5d53b299-14e1-6f8b-58b3-7e16842d87a9@yandex.ru> <0f099d93-64c3-59be-9d5d-9b23ca1ecd2e@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="38809"; 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 10:33:05 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 1pApHc-0009wQ-GJ for ged-emacs-devel@m.gmane-mx.org; Thu, 29 Dec 2022 10:33:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAp6o-0001zf-0a; Thu, 29 Dec 2022 04:21:54 -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 1pAp6m-0001yi-Qm for emacs-devel@gnu.org; Thu, 29 Dec 2022 04:21:52 -0500 Original-Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAp6k-0001wD-Vu for emacs-devel@gnu.org; Thu, 29 Dec 2022 04:21:52 -0500 Original-Received: by mail-pj1-x102c.google.com with SMTP id n12so5756067pjp.1 for ; Thu, 29 Dec 2022 01:21:50 -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=fYAg4mCHy4shatPF8mpn4/GDCtajyE/+OIA0mHKG0uQ=; b=FBcXxatq0Ir1rxvOZx/uLTaTX6hY95I9ip5ZVOjppAh2fce3zTWk3qeLEfOjxI7OfT mb73ewdsCYgTHumNPuuoa4mYMp5Egz2rBl6Sg2SZvunAlEObqAsjYfzXR+mgiF0MwjuG FlrR3z0KqVCR+SpLeR84moM9wpTx3bUWwRmEwc631Xfuw3gXPeufXt3+09tYz9V1JE/q jnQ+PM4mU9nHknLyG5T/RLnZ+cjQk2xBJDTeLs4aAf3SKs/GLC4RVqtZdj4uuWDATase 0HhdXLC1QDv6EGDZxG3WKhR0y82/ra5rSVdQyUDlmmxunREqI6MF9T+/0jNfc2C0KYAH fDdA== 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=fYAg4mCHy4shatPF8mpn4/GDCtajyE/+OIA0mHKG0uQ=; b=ctHreg3Y6RYkRSpxvPua8Vg5bfR4H83TPLiZmqX2sSE9iIJrildHmpbdtkjBA2ahj/ vBCy67Zb2VXfz0dGKW7GqeXda0y6eRTgr0eEMfExko/dzaQpuLxAQHRI3A7x2g8/xDuM eP0wS3WILib8IdSDaURjGuG2rKWIZOhmNOIykY4CMWzifc6xU02YX8XSKvYyqBgAXVsF vjEaxuv1Gn5EzZPJcNpLY9bCht7N6jeT34SyYC0zjIWGt3FhpT2453jBay0FJ4+zZ0hs 7pYIemC9aiGAA4JiBvvrbTaNIDkNZo9t7eyC2qnLM9JigxUOZeR1U3+Uzfc+nSR5Tsut +UHg== X-Gm-Message-State: AFqh2kp/DjEcigfzNwZGmcOmMKHDQBLkOm8jiHR3g070upSc6hO/GQOj Hf0RdjI5MQ7UOaANBV9jS+T00FWPgKlalQ== X-Google-Smtp-Source: AMrXdXuq/zi7pyXVl4iSNH7e7+hAYGIKGr+ZxzRDJTB3cAQnV3kSEcLlhRn8R/pO37Rf0YODKkVO5Q== X-Received: by 2002:a17:903:2341:b0:192:5e53:15f3 with SMTP id c1-20020a170903234100b001925e5315f3mr32778880plh.48.1672305709192; Thu, 29 Dec 2022 01:21:49 -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 d18-20020a170903231200b001928c9d772bsm4971031plh.206.2022.12.29.01.21.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Dec 2022 01:21:48 -0800 (PST) In-Reply-To: <0f099d93-64c3-59be-9d5d-9b23ca1ecd2e@yandex.ru> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=casouri@gmail.com; helo=mail-pj1-x102c.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:302024 Archived-At: > On Dec 28, 2022, at 4:34 PM, Dmitry Gutov wrote: >=20 > On 29/12/2022 02:23, Yuan Fu wrote: >=20 >>>> 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 > By "overlap", do you mean that font-lock rules should also have = entries for variable/function definitions with category = 'variable'/'function'? >=20 > In case somebody removes 'definition' from their list of enabled = features but keeps 'variable' and 'function' there? Basically, if you enable definition alone, you get highlight for = function/variable/class definition. If you enable function/variable = alone, you get highlight for all occurrence of function/variable = identifiers, which would includ what definition highlights. Definition = can be seen as the union of subsets of function & variable feature. >=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 ;-) >=20 > Well, if they really do. >=20 > I figured that people who added this maybe haven't tested this = thoroughly. And that maybe they expected the effect of that "local = variables highlights" feature that some editors showcase already. The purpose of the standard list is to regulate features, so if a major = mode wants to support a feature in the list, it uses the definition and = name from that list (rather than creating a feature with same definition = but different name, or same name but different definition). If a major = mode really want variable feature, they can add it, if not, they don=E2=80= =99t have to. >=20 >>> 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. >=20 > Thank you. >=20 >>> 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. >=20 > Fair enough. If someone wants function/property but not variable, they = could fine-tune the list. Right. All the features in level 4 are pretty over-the-top IMO, so = simply bumping to level 4 and enable everything is probably not the way = to go. Yuan