emacs-tree-sitter / ts-fold

Code-folding using tree-sitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[feature request] ability to disable comment folding

pedro-nonfree opened this issue · comments

I really like the function folding it does this package; but I would like to avoid multiline comment folding?

main() {
  # example 1
  echo 'hi'
  # example 2
  echo 'hi'
  # example 3
  # example 4
  # example 5
  echo 'hi'
  # example 3
  # example 4
  # example 5
  echo 'hi'
  echo 'hi'
  echo 'hi'
  # example 3
  # example 5
  echo 'hi'
}

main "${@}"

given the following example I see a lot of mess in the indicator part (and also, makes it more complex to do the folding that you really want, in my case: function folding):

image

and I would like something more basic, like having comments that don't make additional foldings:

image

You can now disable it with ts-fold-line-comment-mode, default is disabled!

Happy New Year! 🥳

oh waw, what a sweet surprise @jcs090218 !! thank you!

To upgrade I did

cd ~/.emacs.d/straight/repos/ts-fold
git pull

and then, I evaluated the emacs lisp expression to rebuild it:

(use-package ts-fold
  :straight (ts-fold :type git :host github :repo "emacs-tree-sitter/ts-fold"))

and then I restarted emacs, and looks like now by default it does not suggest comment folding, a decision that I support

so this is a screen capture just configuring it this way

;; src https://github.com/emacs-tree-sitter/ts-fold
(use-package ts-fold
  :straight (ts-fold :type git :host github :repo "emacs-tree-sitter/ts-fold"))
;; Else, a hook can be added to tree-sitter directly.
(add-hook 'tree-sitter-after-on-hook #'ts-fold-indicators-mode)
(global-set-key (kbd "C-c f") 'ts-fold-toggle)

image