nvim-treesitter-pyfold
nvim-treesitter-pyfold copied to clipboard
More fine-grained folding: function call, if else, for loop.
Hi, thanks for the nice plugin.
Currently the the fold only goes down to the function/method doc or body. However I sometime misses the fold the inside the body of a method provided by treesitter, e.g folding long function call, internal if/else or for loop logic.
I suppose the current behavior is a design choice to avoid over-folding, but could you consider support finer folding as wellj possibly as an configurable option?
Sure, this is possible but that's just very much the default behaviour of tree-sitter folding, I'm not sure how this would differ from that?
P.s. how did you get syntax highlighting on folded lines?
You can see what I've commented out here in the fold.scm
to get an idea of what's in the normal tree-sitter folds. All this plugin does it just make some custom ones and comment those out.
Thanks, I will take a look. What I like about this pluging is the proper grouping of the multiline function definition with the summary sentence, plus separate folding of doc. That would be great addition on top of base treesitter.
P.s. how did you get syntax highlighting on folded lines?
I use this recent plugin https://github.com/kevinhwang91/nvim-ufo
Hmm, I could probably extend this at somepoint but I'm not sure how to make it into a nice API, feel free to make a PR if you have the time.
And thanks for the link, I should check it out :)