bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59415: 29.0.50; [feature/tree-sitter] c-ts-mode fails to fontify a p


From: Theodor Thornhill
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

Theodor Thornhill <theo@thornhill.no> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Theodor Thornhill <theo@thornhill.no>
>>> Cc: Yuan Fu <casouri@gmail.com>
>>> 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?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]