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

Improve missing .ocamlformat experience

Open ulugbekna opened this issue 2 years ago • 1 comments

Currently, if .ocamlformat is missing in the project, when user invokes "format document" or formatting is triggered on save, the formatting doesn't happen due to missing .ocamlformat, and the user doesn't get any feedback on why formatting didn't happen.

Ideally, OLS needs to send a window/showMessageRequest to the client saying that the formatting didn't happen due to missing .ocamlformat and propose two options "Create .ocamlformat at workspace root" and "Never show this again" (I assume this option to never show this notification for this project only)

Where would we persist "Never show this again" config? Create .ocamllsp directory in the workspace root perhaps?

ulugbekna avatar Aug 26 '22 12:08 ulugbekna

Currently, ocamlformat makes the decision not to format if it couldn't find a .ocamlformat file. But some users might want to format anyway using their global configuration, without adding a file to their project: https://github.com/ocaml-ppx/ocamlformat/pull/2487#pullrequestreview-1774724651

Related: https://github.com/ocaml-ppx/ocamlformat/issues/2092

Where would we persist "Never show this again" config?

In the form of a setting that can be set either in workspace settings (.vscode) or globally ?

Julow avatar Dec 11 '23 15:12 Julow