* bug#60301: 29.0.60; Tree sitter fontify region over a range with no children issue
@ 2022-12-24 16:50 Wilhelm H Kirschbaum
2022-12-25 2:46 ` Yuan Fu
0 siblings, 1 reply; 2+ messages in thread
From: Wilhelm H Kirschbaum @ 2022-12-24 16:50 UTC (permalink / raw)
To: 60301
Currently when there are no children in a range when calling
treesit--children-covering-range-recurse it will return a node,
but
treesit-font-lock-fontify-region expects a list. This happens when
there
is a chunk of an embedded language within the range.
Something like this fixes the issue for me:
@@ -859,7 +871,10 @@ treesit--children-covering-range-recurse
(push child result))
(setq child (treesit-node-next-sibling child)))
;; If NODE has no child, keep NODE.
- (or result node)))
+
+ ;; Either we have to force a list here or handle
+ ;; the result as either a list or NODE.
+ (or result (list node))))
Wilhelm
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#60301: 29.0.60; Tree sitter fontify region over a range with no children issue
2022-12-24 16:50 bug#60301: 29.0.60; Tree sitter fontify region over a range with no children issue Wilhelm H Kirschbaum
@ 2022-12-25 2:46 ` Yuan Fu
0 siblings, 0 replies; 2+ messages in thread
From: Yuan Fu @ 2022-12-25 2:46 UTC (permalink / raw)
To: Wilhelm Hugo Kirschbaum; +Cc: 60301-done
Wilhelm H Kirschbaum <wilhelm@floatpays.co.za> writes:
> Currently when there are no children in a range when calling
> treesit--children-covering-range-recurse it will return a node, but
> treesit-font-lock-fontify-region expects a list. This happens when
> there
> is a chunk of an embedded language within the range.
>
> Something like this fixes the issue for me:
>
> @@ -859,7 +871,10 @@ treesit--children-covering-range-recurse
> (push child result))
> (setq child (treesit-node-next-sibling child)))
> ;; If NODE has no child, keep NODE.
> - (or result node)))
> +
> + ;; Either we have to force a list here or handle
> + ;; the result as either a list or NODE.
> + (or result (list node))))
>
>
> Wilhelm
Ah, right, thanks for the fix! I applied this change.
Yuan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-25 2:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-24 16:50 bug#60301: 29.0.60; Tree sitter fontify region over a range with no children issue Wilhelm H Kirschbaum
2022-12-25 2:46 ` Yuan Fu
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.