next-ls icon indicating copy to clipboard operation
next-ls copied to clipboard

feat: add folding range provider

Open NJichev opened this issue 1 year ago • 2 comments

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 -> end blocks - I think this should be added as well in the first version

NJichev avatar May 03 '24 14:05 NJichev

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.

mhanberg avatar May 03 '24 18:05 mhanberg

Thanks for the feedback, I'll go and implement them, will edit the original comment with a todo list for those.

NJichev avatar May 03 '24 18:05 NJichev