ocaml-lsp icon indicating copy to clipboard operation
ocaml-lsp copied to clipboard

Support topiary as a formatter

Open toastal opened this issue 8 months ago • 5 comments

I have been using topiary to for formatting instead of ocamlformat because topiary can support tabs like OCaml the language can support tabs. I’m getting an error on startup

LSP[ocamllsp][Info] Unable to find 'ocamlformat-rpc' binary. Types on hover may not be well-formatted. You need to install either 'ocamlformat' of version > 0.21.0 or, otherwise, 'ocamlformat-rpc' package.

But I’m not planning to use ocamlformat since it doesn’t meet my accessibility needs.

toastal avatar Oct 27 '23 12:10 toastal

From what I understand, topiary supports many programming language. Would it make sense for topiary to have its own lsp server just for formatting? It seems rather inefficient to support topiary in every single LSP server out there.

rgrinberg avatar Oct 29 '23 08:10 rgrinberg

Isn’t ocamlformat an independent formatter being supported here tho?

toastal avatar Oct 30 '23 16:10 toastal

It is, but it's OCaml only so we might as well support it in the only LSP server for OCaml. Topiary is much more flexible on the other hand.

rgrinberg avatar Nov 27 '23 01:11 rgrinberg

I have been using topiary to for formatting instead of ocamlformat because topiary can support tabs like OCaml the language can support tabs. I’m getting an error on startup

LSP[ocamllsp][Info] Unable to find 'ocamlformat-rpc' binary. Types on hover may not be well-formatted. You need to install either 'ocamlformat' of version > 0.21.0 or, otherwise, 'ocamlformat-rpc' package.

But I’m not planning to use ocamlformat since it doesn’t meet my accessibility needs.

Note that the message is not about using ocamlformat to actually format your code. It is about using ocamlformat-rpc to format the types when you perform an hover.

You can install this package to get rid of the message, without starting using ocamlformat. Or is the formatting of the displayed types the thing that is non-accessible to you ?

In any case, users who choose not to use it should have a way to dismiss the popup permanently.

voodoos avatar May 23 '24 15:05 voodoos

Ah. That makes sense.

toastal avatar May 23 '24 19:05 toastal