Open
Description
Assume I have the following line and my cursor is at the beginning of the line.
Calling ts-fold-open
does not open the fold, I have to move my cursor to the folding overlay to be able to open that. I am really accustomed to this flow from other folding modes, so it would be nice to have this kind of feature. I am currently using AndrewSwerlick's treesit.el fork1, let me know if this works on the original case but not in the fork. Currently I have no way of confirming this but assumed that the behavior is the same in upstream.
To fix this, I added the following function:
(defun ts-fold--first-foldable-node-at-line ()
"Find the first foldable node in current line, after the current point."
(catch 'return
(dolist (pt (number-sequence (point) (cdr (bounds-of-thing-at-point 'line))))
(when-let (fold (ts-fold--foldable-node-at-pos pt))
(throw 'return fold)))))
and replaced all ts-fold--foldable-node-at-pos
calls with this function. Probably a sub-optimal solution but it works for me.