mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
feat(tree-sitter): add ts to open/close all
also refactor +fold-open-all, +fold-close-all to use cond instead of the when case for vimish fold.
This commit is contained in:
@ -109,18 +109,20 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
|
||||
"Open folds at LEVEL (or all folds if LEVEL is nil)."
|
||||
(interactive
|
||||
(list (if current-prefix-arg (prefix-numeric-value current-prefix-arg))))
|
||||
(when (featurep 'vimish-fold)
|
||||
(vimish-fold-unfold-all))
|
||||
(save-excursion
|
||||
(+fold--ensure-hideshow-mode)
|
||||
(if (integerp level)
|
||||
(progn
|
||||
(outline-hide-sublevels (max 1 (1- level)))
|
||||
(hs-life-goes-on
|
||||
(hs-hide-level-recursive (1- level) (point-min) (point-max))))
|
||||
(hs-show-all)
|
||||
(when (fboundp 'outline-show-all)
|
||||
(outline-show-all)))))
|
||||
(cond ((+fold--ts-fold-p)
|
||||
(ts-fold-open-all))
|
||||
((featurep 'vimish-fold)
|
||||
(vimish-fold-unfold-all))
|
||||
(t (save-excursion
|
||||
(+fold--ensure-hideshow-mode)
|
||||
(if (integerp level)
|
||||
(progn
|
||||
(outline-hide-sublevels (max 1 (1- level)))
|
||||
(hs-life-goes-on
|
||||
(hs-hide-level-recursive (1- level) (point-min) (point-max))))
|
||||
(hs-show-all)
|
||||
(when (fboundp 'outline-show-all)
|
||||
(outline-show-all)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold/close-all (&optional level)
|
||||
@ -128,13 +130,15 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
|
||||
(interactive
|
||||
(list (if current-prefix-arg (prefix-numeric-value current-prefix-arg))))
|
||||
(save-excursion
|
||||
(when (featurep 'vimish-fold)
|
||||
(vimish-fold-refold-all))
|
||||
(+fold--ensure-hideshow-mode)
|
||||
(hs-life-goes-on
|
||||
(if (integerp level)
|
||||
(hs-hide-level-recursive (1- level) (point-min) (point-max))
|
||||
(hs-hide-all)))))
|
||||
(cond ((+fold--ts-fold-p)
|
||||
(ts-fold-close-all))
|
||||
(t (when (featurep 'vimish-fold)
|
||||
(vimish-fold-refold-all))
|
||||
(+fold--ensure-hideshow-mode)
|
||||
(hs-life-goes-on
|
||||
(if (integerp level)
|
||||
(hs-hide-level-recursive (1- level) (point-min) (point-max))
|
||||
(hs-hide-all)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold/next (count)
|
||||
|
Reference in New Issue
Block a user