[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#58711: Treesit hangs when calling treesit-search-forward
From: |
Yuan Fu |
Subject: |
bug#58711: Treesit hangs when calling treesit-search-forward |
Date: |
Mon, 14 Nov 2022 00:44:59 -0800 |
> On Nov 13, 2022, at 10:32 PM, Wilhelm Kirschbaum <wilhelm@floatpays.co.za>
> wrote:
>
> This works for me for all cases I managed to test:
>
> ( I have to keep track of the EOL and BOL to ensure that we don't jump to
> parents or children. )
>
> (defun heex--treesit-largest-node-at-point (&optional node)
> "Find the largest node at point or from specified NODE."
> (save-excursion
> (forward-comment (point-max))
> (let ((node-list
> (cl-loop for node = (or node (treesit-node-at (point)))
> then (treesit-node-parent node)
> while (and node (not (equal (treesit-node-type node)
> "fragment")))
> if (eq (treesit-node-start node)
> (point))
> collect node)))
> (car (last node-list)))))
For largest node at point, you can probably use something like
(treesit-parent-while (or node (treesit-node-at (point)))
(lambda (n) (eq (treesit-node-start n) (point))))
Yuan
- bug#58711: Treesit hangs when calling treesit-search-forward, Wilhelm Kirschbaum, 2022/11/10
- bug#58711: Treesit hangs when calling treesit-search-forward, Yuan Fu, 2022/11/10
- bug#58711: Treesit hangs when calling treesit-search-forward, Wilhelm Kirschbaum, 2022/11/10
- bug#58711: Treesit hangs when calling treesit-search-forward, Wilhelm Kirschbaum, 2022/11/10
- bug#58711: Treesit hangs when calling treesit-search-forward, Wilhelm Kirschbaum, 2022/11/10
- bug#58711: Treesit hangs when calling treesit-search-forward, Wilhelm Kirschbaum, 2022/11/10
- bug#58711: Treesit hangs when calling treesit-search-forward, Yuan Fu, 2022/11/10
- bug#58711: Treesit hangs when calling treesit-search-forward, Wilhelm Kirschbaum, 2022/11/11
- bug#58711: Treesit hangs when calling treesit-search-forward, Wilhelm Kirschbaum, 2022/11/14
- bug#58711: Treesit hangs when calling treesit-search-forward,
Yuan Fu <=
- bug#58711: Treesit hangs when calling treesit-search-forward, Wilhelm Kirschbaum, 2022/11/14