From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Status update of tree-sitter features Date: Thu, 29 Dec 2022 01:27:23 +0200 Message-ID: <5d53b299-14e1-6f8b-58b3-7e16842d87a9@yandex.ru> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37377"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 To: Yuan Fu , emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 29 00:28:25 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 1pAfqS-0009Ws-BW for ged-emacs-devel@m.gmane-mx.org; Thu, 29 Dec 2022 00:28:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAfpc-0006Vw-5r; Wed, 28 Dec 2022 18:27:32 -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 1pAfpa-0006Vj-6O for emacs-devel@gnu.org; Wed, 28 Dec 2022 18:27:30 -0500 Original-Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAfpX-0000B8-Pp for emacs-devel@gnu.org; Wed, 28 Dec 2022 18:27:29 -0500 Original-Received: by mail-ej1-x62a.google.com with SMTP id u19so41474386ejm.8 for ; Wed, 28 Dec 2022 15:27:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=NvHt/CMB/+Kh066dQMWr3uv8pFZgTVjGOpPs4gL4nKw=; b=eEACSzbmCLl7UBM3f/oiQ23yd8Y4ZpSQ/4tUf5D7REdhBd8l7rOB8d5wB2U94ZUTO3 FmKqcIBoPyeSxWlSEL/I+k5cVpc+5LCESS2gsLTEQJuEEA64iZ1wqRrh9mXZuUKT4wb1 8azw5Mr7NaolwrwFJdbrVWamTVXBdPF9tD2n4AY9xkWHwSTAzER1W4meGvN4S2P0cT6F L1ujxf1h6OxYKE8FbCx4jdlfMzHIIlzEhfWTYaPjlF7nqDXHSB7Bc8//I2hZ9BpWofCe AhiIf0GpfTXuMh9zoheMytwhXfLb6CRpaC5c03nuB76M3KibNkcXmNcmcEDfX3/2L4oZ NlTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NvHt/CMB/+Kh066dQMWr3uv8pFZgTVjGOpPs4gL4nKw=; b=gvSg5JD7fpbPVRKNW4CLAG54XXzySS8MdGGj40FgyRKMBSxmTibANGvpFnng7kEZpc arXFv6+CdvobTmeYHA2g8VSC2adFGutGtpSPIS5ecHKchGl/yZAVH+/TLkqYlvqgqU0c MUDfjLlwgisBB9byNUz/GVkPiYLvvUwdHHLR6V3VB+adhWg6bQ7lJLhUC/x3KCM3vxek A3OfDmVFZPEbgEQNHUEGNyupDh8pCBJN2mh3IGqQJKgntedMsXGRfR1XsWQawi4/oF48 TTbJCigUZvcPNRP6SwV+YHmdw+b87nr7xAsKJF/fpZqjh0Jc+Fg3ROMS/N8Clkhuvu04 uWpw== X-Gm-Message-State: AFqh2ko7PwOWTTUWwOtHzGGkTovKn6vxPl4nOFrjhHbBLvRtjf0/115n BToailXZfqi5ily/gkct11s= X-Google-Smtp-Source: AMrXdXs9iBXaiXrmeNc+XOPZ+oaxJUIWICMljVtqESqX8q/XRoZJDE9NQllm+CDY/IXlnnuFkFuUIw== X-Received: by 2002:a17:907:a0d6:b0:7d3:c516:6ef4 with SMTP id hw22-20020a170907a0d600b007d3c5166ef4mr31724101ejc.20.1672270045937; Wed, 28 Dec 2022 15:27:25 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id f11-20020a17090631cb00b0084c465709b7sm5115070ejf.74.2022.12.28.15.27.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Dec 2022 15:27:25 -0800 (PST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=raaahh@gmail.com; helo=mail-ej1-x62a.google.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-1.147, 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:302016 Archived-At: Hi Yuan, I'm late to the party, so apologies if any of the following has been discussed before. On 28/12/2022 11:44, Yuan Fu wrote: > Here is the list, for your reference. Among all the features, I think assignment is “nice to have”, it’s fine to leave it out if there isn’t enough time. Same goes for key: it may or may not apply to a language. > > Basic tokens: > > delimiter ,.; (delimit things) > operator == != || (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 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. If it's only about calls, maybe call this category funcall? > type every type identifier > property a.b <--- highlight b Do we think it's a good idea to have 'property' in the default highlighting? IIUC the default level is 3. 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? > variable every variable identifier '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. There is this more advanced prior art for highlighting variables, by tracking the scopes using custom annotations, see locals.scm here: https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables What's displayed under "Result" would be really handy to have in Ruby. It's nothing urgent, of course. Maybe for Emacs 30? For Emacs 29, though, I would discourage the use of 'variable'. Thanks, Dmitry.