From 675e5e732cc0fe5a0866a01c1afafa1445bbde0c Mon Sep 17 00:00:00 2001 From: JenChieh Date: Sun, 23 Jun 2024 00:01:53 -0700 Subject: [PATCH] fix: Allow error in continuous node --- treesit-fold.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/treesit-fold.el b/treesit-fold.el index 565eb28..fd3c40e 100644 --- a/treesit-fold.el +++ b/treesit-fold.el @@ -654,8 +654,10 @@ more information. Argument PREFIX is the comment prefix in string." (save-excursion (when-let* ((treesit-fold-line-comment-mode) ; XXX: Check enabled!? - (first-node (treesit-fold--continuous-node-prefix node prefix nil)) - (last-node (treesit-fold--continuous-node-prefix node prefix t)) + (first-node (ignore-errors + (treesit-fold--continuous-node-prefix node prefix nil))) + (last-node (ignore-errors + (treesit-fold--continuous-node-prefix node prefix t))) (prefix-len (length prefix)) (beg (+ (treesit-node-start first-node) prefix-len)) (end (treesit-node-end last-node)))