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.bugs Subject: bug#62333: 30.0.50; Issue with tree-sitter syntax tree during certain changes Date: Sat, 25 Mar 2023 15:34:26 +0300 Message-ID: <83jzz5c8ml.fsf@gnu.org> References: <87fs9yur7r.fsf@gmail.com> <2fd8f2b8-d9c4-c825-a789-f2d42324859f@yandex.ru> <09539C5E-23DA-4B00-A3F6-873A41D6A2CE@gmail.com> <83h6uc549z.fsf@gnu.org> <665745A2-FDC8-45DE-BFF5-2F688FC85431@gmail.com> <491b788f-c3c3-4877-daa0-f515be9f3a17@yandex.ru> <83sfduelab.fsf@gnu.org> <8FC25A01-6934-43BB-899C-CA5926BEA3CF@gmail.com> 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="25522"; mail-complaints-to="usenet@ciao.gmane.io" Cc: wkirschbaum@gmail.com, casouri@gmail.com, 62333@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 25 13:35:26 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pg37E-0006Jr-RP for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Mar 2023 13:35:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pg375-0002Vo-Ro; Sat, 25 Mar 2023 08:35:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pg36w-0002Fo-Sl for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 08:35:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pg36s-0006r9-R8 for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 08:35:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pg36s-00059L-Fk for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 08:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Mar 2023 12:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62333 X-GNU-PR-Package: emacs Original-Received: via spool by 62333-submit@debbugs.gnu.org id=B62333.167974767819749 (code B ref 62333); Sat, 25 Mar 2023 12:35:02 +0000 Original-Received: (at 62333) by debbugs.gnu.org; 25 Mar 2023 12:34:38 +0000 Original-Received: from localhost ([127.0.0.1]:42058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg36T-00058T-JA for submit@debbugs.gnu.org; Sat, 25 Mar 2023 08:34:37 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48116) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg36R-00058D-OC for 62333@debbugs.gnu.org; Sat, 25 Mar 2023 08:34:36 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pg36L-0006pE-Vu; Sat, 25 Mar 2023 08:34:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=0K46ZDrRBkXdqLGdPkcu0MUuH098aMmfEnsR2wCbR5w=; b=KhnFJdxVkJqH+L20dLNl Z8zqII+ZxHkG6LYuMg7lAAcXgIwLpHK05c6O4IloYh+8A02ClM5jAIalrkGpCyKxZDnYNqaoRuwNc 1euEeFrikLc2+bBPJONf4NsGIah7ffactXCXoCp1cZp5WoWad4+JYjHiKOTr+4U8al8ueUd1okWfB nWypKSXE4n5CUq9hEp0HLKmolog+47NpDm4dcpQyZzW0ZbQmSfkiF2jETJuZx8p5CChvhvaxCIMgL KkgewzGRIo5a1pulaDK7BJHpQnmhDPMHJdBGQ4IBBXv89o6dh8JXviS7KgF+n0dW6k0odAbcBU5W7 c9+W3sHMrYrObw==; Original-Received: from [87.69.77.57] (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 1pg36L-00078H-3N; Sat, 25 Mar 2023 08:34:29 -0400 In-Reply-To: (message from Dmitry Gutov on Sat, 25 Mar 2023 03:51:48 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258554 Archived-At: > Date: Sat, 25 Mar 2023 03:51:48 +0200 > Cc: Wilhelm Kirschbaum , 62333@debbugs.gnu.org > From: Dmitry Gutov > > On 24/03/2023 09:34, Yuan Fu wrote: > > Well, this is a bit embarrassing, there is even a comment warning > this mistake, but anyway, I pushed a fix, once it gets merged into > master, the problem should go away. > > Excellent, thanks. > > > As things stands right now, every time blink-match-open blinks the matching parenthesis, tree-sitter would reparse the buffer twice, that’s not exactly ideal. Blink-match-open’s use of narrowing is legit, and we can’t just automatically widen in tree-sitter functions. > > Not ideal indeed. > > Aside from the performance impact, we could also see cases where the > "narrowed" parse tree contains errors (due to incomplete code) which > make the tree itself less useful. Especially when the narrowing's end is > closer to the current position than in blink-matching-open's usage. > > Not sure how to solve that, but suppose we had a way to convey to > treesit.c that it shouldn't change the visibility bounds for the parser > in this particular instance? Though that would raise the issue of code > trying to use node positions beyond the current accessible range. Exactly. Which is why I don't think this is the right way. Is there any real reason blink-matching-open narrows the buffer? If we could remove that narrowing, the problem with the parser's taking notice of it would be gone.