From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: How to add pseudo vector types Date: Tue, 03 Aug 2021 15:24:54 +0300 Message-ID: <83bl6en2ax.fsf@gnu.org> References: <83eeban40n.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3698"; mail-complaints-to="usenet@ciao.gmane.io" Cc: cpitclaudel@gmail.com, stephen_leake@stephe-leake.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Fu Yuan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Aug 03 14:25:51 2021 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 1mAtUU-0000nP-QZ for ged-emacs-devel@m.gmane-mx.org; Tue, 03 Aug 2021 14:25:50 +0200 Original-Received: from localhost ([::1]:58206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mAtUT-0003Gp-1T for ged-emacs-devel@m.gmane-mx.org; Tue, 03 Aug 2021 08:25:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAtTg-00028w-OJ for emacs-devel@gnu.org; Tue, 03 Aug 2021 08:25:00 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48074) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mAtTg-0000OS-2u; Tue, 03 Aug 2021 08:25:00 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1428 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAtTf-0004Hu-Lz; Tue, 03 Aug 2021 08:25:00 -0400 In-Reply-To: (message from Fu Yuan on Tue, 3 Aug 2021 08:00:46 -0400) 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:271966 Archived-At: > From: Fu Yuan > Date: Tue, 3 Aug 2021 08:00:46 -0400 > Cc: stephen_leake@stephe-leake.org, cpitclaudel@gmail.com, > monnier@iro.umontreal.ca, emacs-devel@gnu.org > > > Hmm... so a change that begins before the restriction and ends inside > > the restriction will be sent as if it began at BEGV? And the rest of > > the change will be discarded? Shouldn't you split such changes in > > tow, send to TS the part inside the restriction, and store the rest > > for the future, when/if the buffer is widened? > > Tree-sitter doesn’t care about the content in a change, it will re-scan the buffer content when it re-parses. We only need to inform it the range of the change, so it knows where to re-scan when it re-parses. When the buffer is widened, we will tell tree-sitter that range [BUF_BEG, BUF_BEGV] has changed, and it will re-scan that part when re-parsing. But that's sub-optimal, no? Imagine a very large buffer which was narrowed to a small portion near EOB, then a modification made very close to EOB but partially before BEGV, then the buffer widened. With your method, TS will now have to re-parse almost the entire buffer, whereas we know it needs to re-parse a very small portion of it.