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: Tree-sitter integration on feature/tree-sitter Date: Thu, 16 Jun 2022 12:09:10 -0700 Message-ID: <2E68780C-9923-411E-A5DF-B1A54E2EC38B@gmail.com> References: <5bada349-2f43-4325-b696-70918584cd3d@email.android.com> <83mtfsuluo.fsf@gnu.org> <87sfpjhm33.fsf@thornhill.no> <83a6brufe5.fsf@gnu.org> <87pmkmhp8i.fsf@thornhill.no> <83v8ueuc7i.fsf@gnu.org> <73DE25BA-5EEF-4497-8F98-8C5F20853A61@gmail.com> <87v8uewfuq.fsf@thornhill.no> <87mtfkbt9n.fsf@thornhill.no> <1179E1EC-90EF-4989-BE1D-115498F77F60@gmail.com> <87k0ajygry.fsf@thornhill.no> <6EF70929-5759-4F1A-B878-0C1660FB6831@gmail.com> <87leuy5z46.fsf@thornhill.no> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) 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="34431"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Stefan Monnier , Emacs Devel , Daniel Colascione To: Theodor Thornhill Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 16 21:10:20 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 1o1usm-0008mh-OZ for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Jun 2022 21:10:20 +0200 Original-Received: from localhost ([::1]:43598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1usl-0003dv-8k for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Jun 2022 15:10:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1urp-0002pm-9V for emacs-devel@gnu.org; Thu, 16 Jun 2022 15:09:21 -0400 Original-Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:38418) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1urk-0007jN-29; Thu, 16 Jun 2022 15:09:20 -0400 Original-Received: by mail-pf1-x42c.google.com with SMTP id e11so2283288pfj.5; Thu, 16 Jun 2022 12:09:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=V10DoY/u2dKYQoQzpjI4Op/CrFW3VWgdgbWIUj5o9Ek=; b=MejzBQRqKYCx7md6+RMh6t8qsYdeCQjDgnwvxiGusHeaCXJTXEwVCe5rfqMFuAU1J6 rE6uiFRNaQfWHAtQVAuUgVBC3VIGMOPNajflJeMi37XGyLrPiXK4cnGJo1Os4rgFV+Ix Et8g0HoGIKiEw/4BzPjkisoe7VXfUdUA2Aa65Tusqwu6dkxy4ObdgmkMJj/Ij3FkP3LY 39UYoVb1FD/mzWNEt7ixfYxrJbTmd9EBr+7X0cjKs+/KOehfH4sAeRRBjY/1qnw6q/st f7y0vJds5nB/8wpUx7Kugx/MXeFMYgUY23eaYn/KX4fU2hgm2tuijNCQQ4O3lqQPvfDV aU/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=V10DoY/u2dKYQoQzpjI4Op/CrFW3VWgdgbWIUj5o9Ek=; b=Fs77CDuzq9SbANStaA4mNfV6rk/I37IsoyDUiZFHwnng0AOiW9/UJMWdDD5O0K7OWz UrGis9ovql0yYFDFkoZx+W6XGtr+07piFlokGutzoE4P7AcJINQOx9+Vf67X6AXYJfTB c90uUE8PZ8E0jngArX7c6hudiTtEwJKOvShhmVWv1BEcV+mD0GU8jydKtEEs9fDg3sDr rlkL++rMlmNZiNDke2hDLp6vWuqLrYZ0CK0TiUMMjLr+OIBYPFb5pPdoRSZGDdV3Pa3X bezomiZteUyAr+h63aIlxNhgKD88qUe3I9ILtg9+XRH5vBcHUSW7jh4oFF9qQMjG7OK+ L3rA== X-Gm-Message-State: AJIora/UCOBVbCk+O0W457m6q+nsF+HfxF23H9mafcdcnj3NUvyJ6nMk JNAuDBnYUA/0/xW+W7SYYR0= X-Google-Smtp-Source: AGRyM1suPYx44d+IAC6prV4JJtBOjyq9XLAwg9lmYBeoiKHwTpwDGQsjQsXyqcm5BxHzmit4iacNNw== X-Received: by 2002:a63:e903:0:b0:3fd:ac2a:5123 with SMTP id i3-20020a63e903000000b003fdac2a5123mr5730009pgh.297.1655406551775; Thu, 16 Jun 2022 12:09:11 -0700 (PDT) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c90:c15:33ec:172b:f758]) by smtp.gmail.com with ESMTPSA id a204-20020a621ad5000000b0050dc76281dcsm2106327pfa.182.2022.06.16.12.09.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jun 2022 12:09:11 -0700 (PDT) In-Reply-To: <87leuy5z46.fsf@thornhill.no> X-Mailer: Apple Mail (2.3696.100.31) Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=casouri@gmail.com; helo=mail-pf1-x42c.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, T_SCC_BODY_TEXT_LINE=-0.01 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" Xref: news.gmane.io gmane.emacs.devel:291252 Archived-At: > On May 18, 2022, at 2:07 PM, Theodor Thornhill = wrote: >=20 >>=20 >> Thanks, I think it could be very useful. I can add an option for the >> user of treesit-traverse-depth-first to control the depth it goes. = And >> same for treesit-traverse-forward-depth-first. A relative depth of 0 >> could mean only traverse siblings and parent, nil means traverse all >> the way, a positive number n means traverse n steps down. >>=20 >=20 > Nice, thanks! I added a new parameter DEPTH to treesit-traverse-depth-first and = treesit-traverse-forward-depth-first (renamed to = treesit-traverse-forward). I also realized that the slowness is due to treesit-query-capture, not = the number of nodes we traversed. So utilizing the DEPTH parameter only = has semantic advantage. You should compile the query (a new feature I = added) and use the compiled query for treesit-defun-query. With that, no = matter the value of DEPTH, jumping to defun begin/end is always fast. I also added manual entries for traverse functions, please have a look = ;-) I haven=E2=80=99t add manual for treesit-search and = treesit-defun-query, etc yet. >=20 > Also, discovered a typo, and shielded the defuns with a fallback = value, > see provided patch: Also merged, thanks. Yuan=