From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: How to add pseudo vector types Date: Tue, 27 Jul 2021 18:50:40 +0200 Message-ID: <20210727165040.h265ih6bewvnvhop@Ergus> References: <8335s64v10.fsf@gnu.org> <5380C92B-6C15-4490-A1E0-1C3132DBB16A@gmail.com> <83k0li2shw.fsf@gnu.org> <86wnpg82v3.fsf@stephe-leake.org> <83lf5wyn0z.fsf@gnu.org> <86pmv66yqg.fsf@stephe-leake.org> <83a6maw705.fsf@gnu.org> <20210726234053.za5axe3m646ps7wr@Ergus> <4EA6F686-9408-4739-8552-110C24655966@gmail.com> 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="8196"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel , Stephen Leake , Stefan Monnier , emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 27 18:52:44 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 1m8QJw-00023R-Rb for ged-emacs-devel@m.gmane-mx.org; Tue, 27 Jul 2021 18:52:44 +0200 Original-Received: from localhost ([::1]:57542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m8QJv-0007rt-R6 for ged-emacs-devel@m.gmane-mx.org; Tue, 27 Jul 2021 12:52:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m8QIQ-0005qM-KJ for emacs-devel@gnu.org; Tue, 27 Jul 2021 12:51:12 -0400 Original-Received: from sonic302-2.consmr.mail.bf2.yahoo.com ([74.6.135.41]:38920) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m8QIK-0006Bd-US for emacs-devel@gnu.org; Tue, 27 Jul 2021 12:51:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1627404662; bh=v4GfUk1f7lP11vfcEyoStK2r8++vgbNVojkuPolfJ8Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=Ya6UMtUKqfQSGACEit9WxLO6pcisx4ziNxrwUvaJ3WjIJSsJZGqUuYoVXaQlNmllmB/c8PxUM7kzSvkd9jHLLh8Wiif/Q3h3Vn/8sr+f5U6MZpI/A4D4kuYcbHV4OBxQM0FtePyiv9SATupf9PxHBIRMgCwpGFMeBpWJ6iACD7ad4gvbBQUSJ8UGTplibqA8ayIVEqqjIEyPOlyF0eHwe7DzBsJni47OR7LPT+0zuJ+xGSj0vlyfFkYlMh/EhwoxlM+6P0EBCkZI7/vQGO42pri5iUDRi6JnFCcs/VR+chWZHqyKOAnXGH3AOamtaIo3SCHn0DJCjftAvS6qr70UJw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1627404662; bh=I9+YX0+yKZqMgv6DqoEbE40d6zavrd8pwToI2EnQPe0=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=QsMIvkKS7dLof1I4/4GkYIGdP0CSd74hlKMdjCnlEv5Hy7FhU4TogXElWjzQ2WvIAq91C9FhiMNcxnCpJ9gNvT1LjHUYPZcUSRvVRXPCnfbUc5Qf498PJtTr1j1A4T14EMaPQXs5lAk5V41XYQPGSOfFxRYy9M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Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.bf2.yahoo.com with HTTP; Tue, 27 Jul 2021 16:51:02 +0000 Original-Received: by kubenode521.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 3bd186355e05a3b3656af369ac00c94c; Tue, 27 Jul 2021 16:50:57 +0000 (UTC) Content-Disposition: inline In-Reply-To: <4EA6F686-9408-4739-8552-110C24655966@gmail.com> X-Mailer: WebService/1.1.18749 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.135.41; envelope-from=spacibba@aol.com; helo=sonic302-2.consmr.mail.bf2.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, RCVD_IN_MSPIKE_H2=-0.001, 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.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:271703 Archived-At: On Tue, Jul 27, 2021 at 10:49:44AM -0400, Yuan Fu wrote: > >We could use ts_parser_set_included_ranges to implement narrowing, but >that would limit the usefulness of ts_parser_set_included_ranges: >ts_parser_set_included_ranges allows us to set multiple discontinuous >ranges, and narrowing only allows us to narrow to a single continuous >range. I agree here. >Therefore I’d like to expose ts_parser_set_included_ranges in a >separate function. > Exposed in the lisp side could make sense then. > >Interesting, the official documentation doesn’t mention that trick. It >only tells me to re-parse with the old tree. If I limit the range to >the modified region before re-parse, re-parse, do I get the tree for >the entire buffer, or do I only get the tree of the limited range? > It worked for me; but it was a much simpler use case; maybe in the general case it breaks. I think the only way to know is to try it. Any way the official documentation suggests to use ts_tree_get_changed_ranges. > >The current code does the latter, if I understand you correctly. > > >You mean adding syntactic information to the text as text properties? >That’s an interesting idea, maybe that’s easier to use than using >tree-sitter’s api. > I think that was the initial Eli's idea when this topic came out. But maybe I understood it wrongly. Theoretically in a re-parse doing ts_tree_get_changed_ranges will give the list of changes needed in the whole text, so updating properties there may be simpler and cheap (even when they are not in the visible part of the buffer). Also, any action that doesn't modify the text (scrolling, moving the cursor, windows split/resize) won't call any tree-sitter and redisplay could handle almost everything easily on the beginning. The only concern here may be that adding properties to the entire text may be memory consuming. Or maybe that this could overlap part of the font-lock functionality. But probably Eli can make a more accurate critic of this idea.. >Yuan Very thanks for doing this! Ergus.