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#59415: 29.0.50; [feature/tree-sitter] c-ts-mode fails to fontify a portion of a large C file Date: Mon, 21 Nov 2022 17:15:13 +0200 Message-ID: <83k03o2vb2.fsf@gnu.org> References: <83v8n94ij9.fsf@gnu.org> <87k03pwgf6.fsf@thornhill.no> <83h6yt4c12.fsf@gnu.org> <87v8n9qscd.fsf@thornhill.no> <87pmdhqqni.fsf@thornhill.no> <87tu2tthmr.fsf@thornhill.no> 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="4341"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59415@debbugs.gnu.org, theo@thornhill.no To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 21 16:16:11 2022 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 1ox8Wp-0000v3-Cj for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Nov 2022 16:16:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox8Wi-0006MB-HB; Mon, 21 Nov 2022 10:16:04 -0500 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 1ox8Wg-0006Lx-Kb for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 10:16:02 -0500 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 1ox8Wg-0004N0-C3 for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 10:16:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ox8Wf-0002PT-VL for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 10:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Nov 2022 15:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59415 X-GNU-PR-Package: emacs Original-Received: via spool by 59415-submit@debbugs.gnu.org id=B59415.16690437132906 (code B ref 59415); Mon, 21 Nov 2022 15:16:01 +0000 Original-Received: (at 59415) by debbugs.gnu.org; 21 Nov 2022 15:15:13 +0000 Original-Received: from localhost ([127.0.0.1]:48495 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ox8Vs-0000jb-QM for submit@debbugs.gnu.org; Mon, 21 Nov 2022 10:15:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ox8Vo-0000HH-Mx for 59415@debbugs.gnu.org; Mon, 21 Nov 2022 10:15:12 -0500 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 1ox8Vi-00041D-CA; Mon, 21 Nov 2022 10:15:02 -0500 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=syghu6QVHimobXY6WWvMNVGE3wIlp5Lq1aReAlxvLSI=; b=GI2VR4JkSuv7tFY+/dsy 4fA6GQtW2DY9dceRmGFYWIw2k176//VauyWFhGpklgbn1YASkz1iiDaCe6npKG1OJnD0Q3mTgy+sS fOoOBsbjSjG9yLYjSpQ5i1sGSrQN8hlCIMiaEsVZFDMgn07QAidx6EtKyAeJzZACUog4QGXF/z8AS WJgfXwPdkSlzaolApMQniI76r6ImKfnXf8N3jeyX2oFtwSp77IFDwFq2ORt8ZulnelEno5HkYBMfK F9wHKcFHlGXDgqNW9Ele2UOEqkhYSZ6b0LQgvEQJTykc1flvZfho31wRvcwmhH2uo2TClpREsRQYu M8oKTm7lUdzotA==; 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 1ox8Vh-0005GE-NS; Mon, 21 Nov 2022 10:15:02 -0500 In-Reply-To: (message from Yuan Fu on Sun, 20 Nov 2022 17:27:16 -0800) 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:248545 Archived-At: > From: Yuan Fu > Date: Sun, 20 Nov 2022 17:27:16 -0800 > Cc: Eli Zaretskii , > 59415@debbugs.gnu.org > > I pushed a change that uses treesit-node-on. Now scrolling in most parts of the buffer is pretty fast. Scrolling around 194770 is still laggy, because the node we get from treesit-node-on is still too large. I tried some heuristics but they didn’t work very well, IMO because tree-sitter couldn’t parse that part of the code very well. The code should observe a structure like {{}, {}, {}, {}, {}, …} where there are tens thousands of inner brackets, so ideally we only need to grab the {}’s in the region we want to fontify. But tree-sitter seems to understand it in some weird structure and we still end up with very large nodes, which is far larger than the region we want to fontify and is slow to query. > > I’ll try to improve it further in the future, but for now I think it’s good enough (because in most cases fontification is pretty fast). Agreed. Thanks, I think we can close the bug now. What do you think about enlarging treesit-max-buffer-size as I proposed up-thread?