Skip to content

More fine-grained folding: function call, if else, for loop. #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lkhphuc opened this issue Jul 10, 2022 · 4 comments
Open

More fine-grained folding: function call, if else, for loop. #5

lkhphuc opened this issue Jul 10, 2022 · 4 comments

Comments

@lkhphuc
Copy link

lkhphuc commented Jul 10, 2022

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?

Screenshot 2022-07-10 at 13 13 27

@eddiebergman
Copy link
Owner

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?

@eddiebergman
Copy link
Owner

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.

@lkhphuc
Copy link
Author

lkhphuc commented Jul 11, 2022

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

@eddiebergman
Copy link
Owner

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants