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: Update on tree-sitter structure navigation Date: Sat, 9 Sep 2023 00:05:22 +0300 Message-ID: <74692a85-175d-1f5f-1291-7cf317d3d2a9@yandex.ru> References: <5E7F2A94-4377-45C0-8541-7F59F3B54BA1@gmail.com> <8a5b3b3e-f091-3f38-09d4-c4e26bec97f9@yandex.ru> 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="10150"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: emacs-devel , Danny Freeman , Theodor Thornhill , =?UTF-8?Q?Jostein_Kj=c3=b8nigsen?= , Randy Taylor , Wilhelm Kirschbaum , Perry Smith To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 08 23:06:47 2023 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 1qeigh-0002Q1-N9 for ged-emacs-devel@m.gmane-mx.org; Fri, 08 Sep 2023 23:06:47 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qeifl-00070J-Kp; Fri, 08 Sep 2023 17:05:49 -0400 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 1qeifg-0006zH-AN for emacs-devel@gnu.org; Fri, 08 Sep 2023 17:05:44 -0400 Original-Received: from forward501a.mail.yandex.net ([178.154.239.81]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qeifc-0000Pv-98 for emacs-devel@gnu.org; Fri, 08 Sep 2023 17:05:44 -0400 Original-Received: from mail-nwsmtp-smtp-production-main-55.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-55.vla.yp-c.yandex.net [IPv6:2a02:6b8:c2a:210:0:640:45a:0]) by forward501a.mail.yandex.net (Yandex) with ESMTP id EA7355E94B; Sat, 9 Sep 2023 00:05:34 +0300 (MSK) Original-Received: by mail-nwsmtp-smtp-production-main-55.vla.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id R5iwpbEDV0U0-bhVWSt3w; Sat, 09 Sep 2023 00:05:33 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1694207134; bh=8qJKi85teGnAVpmRM4AxRKIwgQgEJ+C+djzrCUkulLc=; h=In-Reply-To:From:Subject:Message-ID:Cc:References:Date:To; b=jG+/0BVeCJV0C4UDXVoDOwtnCb2cgV+XJ1SG6XxT0iDYnTStGuYOPgdSOi/ScOL6D Em7s3Is54jySTUQgZpevG7uqaDasYsQOcmeSojpGT8VLJGR3gDtRktSLBWdTickE1/ zg2RbUvm2z9chGQQsrXWPiUIZBkJJKRPTUyJHL+8= Authentication-Results: mail-nwsmtp-smtp-production-main-55.vla.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id 58B0827C0077; Fri, 8 Sep 2023 17:05:26 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 08 Sep 2023 17:05:26 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudehjedgudehhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enogfuuhhsphgvtghtffhomhgrihhnucdlgeelmdenucfjughrpefkffggfgfuvfevfhfh jggtgfesthekredttdefjeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughguh htohhvseihrghnuggvgidrrhhuqeenucggtffrrghtthgvrhhnpeegjeeuieevudeuffdu geelvdehtdelfeejuedukeduheeggefhudfguddtfeevieenucffohhmrghinhepghhith hhuhgsrdhiohdpghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfr rghrrghmpehmrghilhhfrhhomhepughguhhtohhvodhmvghsmhhtphgruhhthhhpvghrsh honhgrlhhithihqddufeeffeelleehhedvqddvleegjeejjeejiedqughguhhtohhvpeep higrnhguvgigrdhruhesfhgrshhtmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: ib1d9465d:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Sep 2023 17:05:23 -0400 (EDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=178.154.239.81; envelope-from=dgutov@yandex.ru; helo=forward501a.mail.yandex.net X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 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, NICE_REPLY_A=-1.473, 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:310369 Archived-At: On 08/09/2023 04:04, Yuan Fu wrote: >> Something I mentioned previously, there is notion of scopes in tree-sitter docs, see the Local Variables section here:https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables >> >> Basically to know which symbols are defined and for how long, the parser needs additional help from the major mode author. >> >> Neovim's definition here:https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/ruby/locals.scm > Good call. I’ll add it to my TODO list, but it’ll have a lower priority, since I personally aren’t really interested in coloring variables different colors. If someone is interested, do please give it a try. Sure, it's probably more valuable in some languages than others. In case you have some ideas for the implementation strategy, though, perhaps mention them inside treesit.el's Commentary (it could also have a TODO block). Offhand, it doesn't quite fit to what we do with font-lock. OTOH, I suppose I could go take a look at NVim's implementation.