From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: emacs-tree-sitter and Emacs Date: Tue, 31 Mar 2020 16:27:35 -0800 Message-ID: <86369ojbig.fsf@stephe-leake.org> References: <83eeta3sa0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="107958"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Apr 01 02:28:38 2020 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 1jJRFF-000S0Z-Ap for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Apr 2020 02:28:37 +0200 Original-Received: from localhost ([::1]:45430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJRFE-00088q-Bp for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Mar 2020 20:28:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43062) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJREL-0007VB-OW for emacs-devel@gnu.org; Tue, 31 Mar 2020 20:27:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJREK-0007LN-6s for emacs-devel@gnu.org; Tue, 31 Mar 2020 20:27:41 -0400 Original-Received: from gateway34.websitewelcome.com ([192.185.148.204]:36987) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJREJ-0007I0-Tf for emacs-devel@gnu.org; Tue, 31 Mar 2020 20:27:40 -0400 Original-Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway34.websitewelcome.com (Postfix) with ESMTP id F1D70A6AE89 for ; Tue, 31 Mar 2020 19:27:38 -0500 (CDT) Original-Received: from host2007.hostmonster.com ([67.20.76.71]) by cmsmtp with SMTP id JREIj648WAGTXJREIjTsdJ; Tue, 31 Mar 2020 19:27:38 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stephe-leake.org; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:To:From:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=IDEpT4osFfBubz9osqLe7GjGQjRBG6esaSffPRoKnMA=; b=DxLAx7O32hz+SLEaZDvc3PkUk p++OLRqbJvCjcXuWcl48folq8nzkmWof9pqjPMsend7UeFbnCbDsfZ9Pqu41wFzgus++wL6FMwQWd i2Ml5mgYkBxQSwUypIFcbFqCJkFaB3iOwcPY71kHwVlBzxnhVh0jr9QC68tJC9qWQMkQFBMIj9GZ0 gqaUzqrp3IOYFZhE4bUTMMC45mKOBIh7lPGQUU6wV65H3mQY+Ft2BQK/B9FDAwRPj8Fgb0zKEv+S8 rfL4972ecXBPogKtdi/bPR50hvGtunG5j2McX9cpxKa7OvhEsd+h/KH0gLRtvxT+R3tWnZtcT8gyt gZwKs6Z9g==; Original-Received: from [76.77.182.20] (port=61852 helo=Takver4) by host2007.hostmonster.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jJREI-0031pP-9a for emacs-devel@gnu.org; Tue, 31 Mar 2020 18:27:38 -0600 In-Reply-To: <83eeta3sa0.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 30 Mar 2020 16:07:35 +0300") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2007.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stephe-leake.org X-BWhitelist: no X-Source-IP: 76.77.182.20 X-Source-L: No X-Exim-ID: 1jJREI-0031pP-9a X-Source-Sender: (Takver4) [76.77.182.20]:61852 X-Source-Auth: stephen_leake@stephe-leake.org X-Email-Count: 5 X-Source-Cap: c3RlcGhlbGU7c3RlcGhlbGU7aG9zdDIwMDcuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 192.185.148.204 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:246164 Archived-At: Eli Zaretskii writes: >> From: Jorge Javier Araya Navarro >> Date: Sun, 29 Mar 2020 21:23:49 -0600 >> >> I have gone through th0rex's pull request[2] and nothing suggests >> that hooks are being used in order to do >> the fontification of buffers, the only hook we have is >> `tree-sitter--after-change', it does re-parsing and keeps >> the tree updated > > Can you explain why an after-change hook is at all needed? Why not > pass to tree-sitter the chunk that jit-lock is going to fontify? > AFAIU, tree-sitter is well suited for parsing incomplete source > chunks. It depends on what you mean by "incomplete". If the full buffer is syntactically correct, and the "incomplete" source is a region chosen by font-lock, then yes; tree-sitter can efficiently update the parse tree to match that region. On the other hand, if the buffer is not syntactically correct, there is no guarrantee that tree-sitter can handle it; it's supposed to be "robust" to syntax errors. One of the links to an error recovery algorithm is broken; the other link describes an algorithm that is not as sophisticated as the one wisi uses (I'm working on writing a paper about that). > OTOH, using an after-change hook has its downsides, even if disregard > slow-down (which I wouldn't). In wisi (used by ada-mode), the after-change hooks just record what regions have been changed; font-lock then triggers a parse if the region being fontified contains or is after a change region. Navigation and indent also trigger parses. By default font-lock runs after every character typed, which is often too slow in an ada-mode buffer; I always set jit-lock-defer-time to 1.0 seconds. -- -- Stephe