From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Call for volunteers: add tree-sitter support to major modes Date: Tue, 11 Oct 2022 18:46:43 +0800 Message-ID: <87tu4ahc30.fsf@yahoo.com> References: <83czb1jrm3.fsf@gnu.org> <878rlo7on0.fsf@thornhill.no> <83o7uki5ol.fsf@gnu.org> <87tu4c5g9j.fsf@thornhill.no> <87k057j7gn.fsf@yahoo.com> <8D3026E9-D8A4-46EC-816B-1F7A3458DC02@gmail.com> <83h70ag7dh.fsf@gnu.org> <87zge2iziw.fsf@yahoo.com> <87bkqier8o.fsf@thornhill.no> <87ilkqixkh.fsf@yahoo.com> <87mta2hhwp.fsf@thornhill.no> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18395"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) Cc: Eli Zaretskii , Yuan Fu , acm@muc.de, emacs-devel@gnu.org, jostein@kjonigsen.net To: Theodor Thornhill Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 11 14:14: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 1oiE96-0004YY-Ba for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Oct 2022 14:14:04 +0200 Original-Received: from localhost ([::1]:47822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiE95-0004FM-6R for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Oct 2022 08:14:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiCmo-0008LN-Ub for emacs-devel@gnu.org; Tue, 11 Oct 2022 06:46:59 -0400 Original-Received: from sonic304-20.consmr.mail.ne1.yahoo.com ([66.163.191.146]:36255) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiCmm-0000K3-KO for emacs-devel@gnu.org; Tue, 11 Oct 2022 06:46:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1665485214; bh=3dPlrANqd58bYD47rMFr0RmF+WvqteIygvLtrbfg5wI=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=AI+i26/ukuAPA7clQMG+CwHjlWhrv4j4jiD81rYHhKmjKqOH5f6ZwgeQGrJIkZwZLcknZ8dOROvpGvD49GG8ckRuDKKB0D/CZfw7wf//xre9giv3suwxvj3J4bu10zomdFU0q5WcA9Ukhpt1ID040IQH/iKyhjHoIWz9hc68nW8LsjpoucoJTD2537YuhShSFUw4QYbgUtr9C6N+m5wMeDjYj0M70hBEdfRTE9mCWARQLMXq1799qJUZYqmVAVElwm50mx4TiXAs/42ngkYNqp7i0R06puPXNe4eBHOj4z5axB4WayfxrjMBzZS8gY100b4acXus32lxSnImQLnMYg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1665485214; bh=aIV/QWUnUnwn77iVE3a9qTrj7cFcIxEbbxKnpHQU+0W=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=CjK2jdly+hlaRYgRtqfoa1uO9GuW/n0dK2oiG6O6BDd9yBcSchizqg7wtdx3tCe9TGxTHGa4ePCgs/Ms0IoV47OmE4lksZv8tdpyR0BdT9Bcs4g+gfA9yw8ALAeH8vm1vdKak/o+ZE9geCPOL51x3Z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ic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.ne1.yahoo.com with HTTP; Tue, 11 Oct 2022 10:46:54 +0000 Original-Received: by hermes--production-sg3-785466d859-7l8f2 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 698a298ca9031ad92a4d2c84c6738cc6; Tue, 11 Oct 2022 10:46:49 +0000 (UTC) In-Reply-To: <87mta2hhwp.fsf@thornhill.no> (Theodor Thornhill's message of "Tue, 11 Oct 2022 10:40:54 +0200") X-Mailer: WebService/1.1.20740 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.191.146; envelope-from=luangruo@yahoo.com; helo=sonic304-20.consmr.mail.ne1.yahoo.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=unavailable 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:297472 Archived-At: Theodor Thornhill writes: > Sure! > > (The following example is from the other tree-sitter implementation, but > it would be as simple, if not simpler in the new one) > > Consider this code: > > ``` > (defun csharp-delete-method-at-point () > "Deletes the method at point." > (interactive) > (when-let ((method (tree-sitter-node-at-point 'method_declaration))) > (delete-region (tsc-node-start-position method) > (tsc-node-end-position method)))) > ``` > > If point is _anywhere_ inside a method, this function will delete the > whole thing. It knows the beginning and end, and doesn't have to do > anything else than returning the relevant points. The same could be > done with i.e. string, where if: > > ``` > "some string here where this | denotes where point is" > ``` > > You could create paredit-like functionality to delete _until_ the last > quote, etc. Compare them to Vims 'cip', 'dap' etc. These are only > trivial examples, but you could also imagine creating refactoring > functions where you extract variables and insert them in the scope of > other functions and so forth. The huge thing here is that you have the > _actual_ parse tree. Indentation is also now simpler, more correct. > There are all sorts of things we could evolve from here. Font-lock is > just because that is the clearest, easiest and fastest benefit. Thank you for the detailed explanation.