From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" 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: Sun, 20 Nov 2022 21:51:51 +0100 Message-ID: <87sfidqrh4.fsf@thornhill.no> References: <83v8n94ij9.fsf@gnu.org> <87k03pwgf6.fsf@thornhill.no> <83h6yt4c12.fsf@gnu.org> <87v8n9qscd.fsf@thornhill.no> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32040"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59415@debbugs.gnu.org, casouri@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 20 21:53:33 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 1owrJk-0008AQ-NY for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 20 Nov 2022 21:53:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1owrJH-00053l-RG; Sun, 20 Nov 2022 15:53:03 -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 1owrJG-00053d-LJ for bug-gnu-emacs@gnu.org; Sun, 20 Nov 2022 15:53: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 1owrJG-0003mD-Ct for bug-gnu-emacs@gnu.org; Sun, 20 Nov 2022 15:53:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1owrJG-0001eo-5H for bug-gnu-emacs@gnu.org; Sun, 20 Nov 2022 15:53:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Nov 2022 20:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59415 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, casouri@gmail.com Original-Received: via spool by submit@debbugs.gnu.org id=B.16689775296306 (code B ref -1); Sun, 20 Nov 2022 20:53:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Nov 2022 20:52:09 +0000 Original-Received: from localhost ([127.0.0.1]:44755 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1owrIP-0001dd-9d for submit@debbugs.gnu.org; Sun, 20 Nov 2022 15:52:09 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:35730) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1owrIK-0001dR-07 for submit@debbugs.gnu.org; Sun, 20 Nov 2022 15:52:07 -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 1owrIJ-0004vk-QW for bug-gnu-emacs@gnu.org; Sun, 20 Nov 2022 15:52:03 -0500 Original-Received: from out0.migadu.com ([94.23.1.103]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1owrIH-0003df-R3; Sun, 20 Nov 2022 15:52:03 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1668977519; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1woLPWJraeyMiji+09c25Wu4LwPuz/tm63g39P4lYZE=; b=wyG0Hz2CW9OuXa4/sHaAdgbeMWB5lSxi8oblpz/fukebNSYJ85eRBoDmdywZby2iXN4r5n xCgUHOSIRg1AIqYuHdy9frNJSmtO/EUMnwFaW544rvPUaUO/o2Rgwj2LFzqS6FFs1dqcX8 CPSAPpZ8qOeGNmrxC386TaBtdODmhr1HDzIs8epMF7z5d601zpVRBNZdOd5XgzsvIwCi0L lSA9dTay0xKao0FN2xEH47htqrqW49JLaKr4plc+dPmpeifchaFKUdRlZfsRMNYqQ0nfsE 2QffNeusjwz9Tp1vFvIV/Bx+ixnaJkgDGFWJ9wkmwRPj2jNIBzBZTof0J65cDA== In-Reply-To: <87v8n9qscd.fsf@thornhill.no> X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=94.23.1.103; envelope-from=theo@thornhill.no; helo=out0.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:248475 Archived-At: Theodor Thornhill writes: > Eli Zaretskii writes: > >>> From: Theodor Thornhill >>> Cc: Yuan Fu >>> Date: Sun, 20 Nov 2022 20:54:05 +0100 >>> >>> > Observe that fontifications stop at this line for some reason. >>> > Fontification reappears on line 209271. Maybe it's because of the many >>> > braces that appear in warning face? Why does TS think there are syntax >>> > errors here? The C++ TS parser doesn't have that problem, btw. >>> >>> It seems the c parser definitely can't handle what it's seeing. >> >> Yes, but do you have any clue why it gives up at that line? >> > > No, not yet. > > This diff fixes the font-lock issues: diff --git a/lisp/treesit.el b/lisp/treesit.el index 674c984dfe..0f84d8b83e 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -774,12 +774,12 @@ treesit-font-lock-fontify-region ;; will give you that quote node. We want to capture the string ;; and apply string face to it, but querying on the quote node ;; will not give us the string node. - (when-let ((root (treesit-buffer-root-node language)) + (when-let ( ;; Only activate if ENABLE flag is t. (activate (eq t enable))) (ignore activate) (let ((captures (treesit-query-capture - root query start end)) + (treesit-node-on start end) query start end)) (inhibit-point-motion-hooks t)) (with-silent-modifications (dolist (capture captures) However, the comment right above makes a case for why we should have this. BUT, is this still relevant, Yuan, after the changes in treesit reporting what has changed etc? What exact case is that an issue? And is it more severe than the behavior this bug is exhibiting?