- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 30
 
Open
Labels
enhancementNew feature or requestNew feature or request
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.
jcs090218, mpereira, jp8t-wltr, talw, Nidish96 and 11 more
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
