next-ls
next-ls copied to clipboard
feat: add folding range provider
Closes #56 Adds a folding range provider. For now it only works on do end blocks. Things to consider:
- typespecs and docs and whether to fold them together with their respsective function - makes this PR a bit harder and maybe it's not necessary for starters?
- folding on
fn -> endblocks - I think this should be added as well in the first version
The folds I added to nvim-treesitter currently consist of
[
(anonymous_function)
(stab_clause)
(arguments)
(block)
(do_block)
(list)
(map)
(tuple)
] @fold
So should at least do those.
Eventually it would be nice to fold consecutive alias Foo.Bar, as we have a lot of them in the Next LS code base, would be cool to fold them up.
Thanks for the feedback, I'll go and implement them, will edit the original comment with a todo list for those.