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: Sat, 31 Dec 2022 14:15:39 -0800 Message-ID: References: <5d53b299-14e1-6f8b-58b3-7e16842d87a9@yandex.ru> <0f099d93-64c3-59be-9d5d-9b23ca1ecd2e@yandex.ru> <599B2C6F-C05F-4BB5-9509-2E07D848D573@gmail.com> <3ea7bb36-b524-1a39-598f-18d344826b0d@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="11302"; 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 Sat Dec 31 23:16:09 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 1pBk9A-0002lO-Ad for ged-emacs-devel@m.gmane-mx.org; Sat, 31 Dec 2022 23:16:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pBk8q-0000Xc-1i; Sat, 31 Dec 2022 17:15:48 -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 1pBk8m-0000Vm-1a for emacs-devel@gnu.org; Sat, 31 Dec 2022 17:15:44 -0500 Original-Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pBk8k-0002Hx-HC for emacs-devel@gnu.org; Sat, 31 Dec 2022 17:15:43 -0500 Original-Received: by mail-pl1-x62d.google.com with SMTP id b2so25435214pld.7 for ; Sat, 31 Dec 2022 14:15:41 -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=fJ2Ux42xiiqwO+9Y9ylt7suP/flBidbh1sAuPMlys50=; b=OK/0crnLh/fJ3sve6YqpfZPxVQbtkDQ0wM1j0yVZcfNXSIR6j4aMPeHraSZ9Fxwsm4 VxtCxDs+uDcRq26wEGIHB01xAhkXv7Bfr7X/1XJ2oMeouLsnU3lHZo6OLdeF5iCwpZSX Bup0/mNNsce1BVe58ZSn8u09jhxnH6cSPjWrqWb6A6BkKs0z5D4tV748PIlvvy2RFm9E wPy9MR3CDG1Kjm5MwBjYZp2fmGavo9S052gn9lw22UG0rJTE3LzkIP9aFrVO2kXaYhKK DqhABeiApsIT7Pbs4GxidRFXmhbENX+ht3+jDLUR1FKRGJL5EVlzAOhxtX420folOtO7 IXbA== 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=fJ2Ux42xiiqwO+9Y9ylt7suP/flBidbh1sAuPMlys50=; b=Pz81WoJeaEjYUzSzF/Wff21Tx0/sZrjaIMno5K1kRW8f8hJ+iTx5b/ZL8cJDW0WJS5 kDdoKGWVUcmgNjh4rMaV6G7KljZRv9qsW6leDH+bYsr46HibmmRfzwPvKrHWfU3Du5xB DsfxtBV+o6zMuWvTdfASrm2k4kKtjFkAPaNZIdpyx+1pHugkChOpGInzyJkgnTpxY55X +o/sHu/ViJo+3D95HsqQRNSz0AT9dbQIf5YkKkscDsLt+Uq3P7anLxZAgSG1WonYVDho ZngMnOI1QAjC71/yYGSgOszhKn9RCyGlxy3J7VobPPHfu3cF/YGeNFHfciGBIfaFG/+D 2MOQ== X-Gm-Message-State: AFqh2kqb/xVj9EGstdpTwlAfUiCkcYl1KTArcGnWGjEAP8yov3kCuFoQ X6nTVLz1vxMNrAZY7BCcK8oiValNlO8= X-Google-Smtp-Source: AMrXdXv/X4nL+wSKbW/inlkOmh2NQE0Wly1KF1JtZ4j6PZGaPlTw1PzFSOK1bFaH+0P7NvL6L1XN/Q== X-Received: by 2002:a17:903:260f:b0:192:4b1b:6cdb with SMTP id jd15-20020a170903260f00b001924b1b6cdbmr38412861plb.7.1672524940784; Sat, 31 Dec 2022 14:15:40 -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 j9-20020a170902758900b00189c9f7fac1sm17344624pll.62.2022.12.31.14.15.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Dec 2022 14:15:40 -0800 (PST) In-Reply-To: <3ea7bb36-b524-1a39-598f-18d344826b0d@yandex.ru> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=casouri@gmail.com; helo=mail-pl1-x62d.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:302161 Archived-At: > On Dec 30, 2022, at 3:41 PM, Dmitry Gutov wrote: >=20 > On 30/12/2022 13:16, Yuan Fu wrote: >=20 >>> Yes, but is that classification useful enough to justify the = duplication in the font-lock rules' definitions? >>>=20 >>> FWIW, I "broke" python-ts-mode in 8503b370be1, according to this = definition. Sorry? >>>=20 >>> But what do we get by this particular classification? >>>=20 >>> The user will be able to disable 'definitions' and still have all = function definitions highlighted? But not, say, variable definitions? >>>=20 >>> That doesn't strike me as particularly more useful than e.g. = disabling 'definitions' and having all function references highlighted = (but not definitions). Which we would make possible by limiting = 'function' to non-definitions. >> Right now you can choose to highlight: >> 1. Only definition identifiers, be it function, variable, class, etc >> 2. All function identifiers >> 3. All variable identifiers >> There could be better features, but the existing ones still have = their merits. If you want a feature that highlights only funcalls, maybe = we can add them, if there are enough time & interest. >=20 > I'm mostly worried about having to duplicate font-lock rules between = categories at this point. It just looks impractical to me. I=E2=80=99d say we judge it case-by-case. In this case it seems fine to = me. >=20 >>> Okay, I also have a different, somewhat related question. >>>=20 >>> Certain languages have a special syntax for "variables". >>>=20 >>> Ruby has @instance_variable and $global_variable -- the @ and $ are = used both during assignment and for later reference. >>>=20 >>> Perl has $var and @array_var. >>>=20 >>> PHP has $local_var. >>>=20 >>> Up until now we've highlighted those with = font-lock-variable-name-face. Except for @array_var in Perl, which has = separate derived face. Either way, we did highlight them. >>>=20 >>> What category should we use for them in ts-based modes? If it's = 'variable', then won't be highlighted by default. >>>=20 >>> If 'variable' matchers in other existing ts modes didn't include all = identifiers everywhere, we could put 'variable' into level 3. >>>=20 >>> Or we could add a separate category for all those, I guess. >> If a major mode thinks highlighting all variables is the best default = behavior, it can support the variable feature and put it at level 3. The = standard list is just a guideline. >=20 > So you're suggesting ruby-ts-mode changes = treesit-font-lock-feature-list locally, and either moves 'variable' to a = lower level, or adds a new category for said vars. >=20 > We can do that, thank you. Yeah, ultimately it=E2=80=99s your judgement. Yuan=