emacs-lsp / lsp-origami

lsp-mode :heart: origami.el
GNU General Public License v3.0
43 stars 6 forks source link

Folding is slightly off with ocamllsp #14

Open thibautbenjamin opened 3 years ago

thibautbenjamin commented 3 years ago

I am using emacs to code in OCaml, using lsp-mode and the ocamllsp server. I have just tried adding lsp-origami to my setup, and I really like its capabilities, however, I find that the decisions it takes when it comes to folding are a little questionable. The folding looks almost right, except is also folds the header of every block, and as a result I can't see the blocks at all, except for the indicator that there is something to unfold at this place.

I don't know wether this is the fault of the LSP itself, or of lsp-origami making assumptions about the language. I believe that this bevavior possible to fix (maybe with a customizable variable controlling some adjustments of the LSP answer), but I do not know enough elisp to do this myself.

Here is a picture of the behavior I am describing, where you can see that after folding, only the comments are still active folded unfolded Here is what I would expect the folding to look like in this example

(* This is a demo *)

(* First say hello *)
let hello = ...

(* This function is more complicated *)
let complicated_function x y = ...