Disable formatting on Erlang_LS

I recently started using Erlang_LS with Emacs and Eglot. Whenever I save, my file is auto formatted (I’ve got format-all-mode setup) by Erlang_LS through Eglot. However, I prefer to use erlfmt via rebar3 fmt and also the formatting with erlang_ls is destructive sometimes, and my code won’t compile post formatting. Is there some configuration in erlang_ls.config to disable formatting so that it won’t format on save or on M-x eglot-format?

Now the ideal solution is to disable it through Emacs, but I need to go through format-all-mode and eglot’s source code as there isn’t documentation on not formatting/blacklisting a certain language. So I’m look for a temporary fix here till I have the time to write some Elisp.

2 Likes

Yes, there is.
Add this to your erlang_ls.config:

providers:
  disabled:
    - document-formatting

Check out this example.
See also the Erlang LS configuration docs.

3 Likes