-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow alternate formatter #144
Comments
Hi @rlipscombe, the reason we opted for The default formatter is hard-coded here, but it should be trivial to read this from config. |
Thanks for the response. I was going to reply with this:
I've figured out the source of my confusion. It turns out you need a working rebar3 installation anyway.
Whereas ErlangLS just pushes that further back, so it's now the responsibility of But: either I'm not reading it right, or the documentation doesn't explicitly say how to choose an alternate formatter. Could it be made more prominent somehow? |
I think the other source of my confusion is that (a while ago) I looked at the source for erlang-ls and noticed that the formatter was hard-coded as It never occurred to me that |
I've been digging into this some more, and it looks like erlang-ls invokes rebar3_formatter:new, passing default_formatter. See https://github.com/erlang-ls/erlang_ls/blob/main/apps/els_lsp/src/els_formatting_provider.erl#L102 This bypasses the configuration setting in rebar3.config, as documented at https://github.com/AdRoll/rebar3_format#erlfmt (which you linked to). rebar3 format applies the configuration setting here: https://github.com/AdRoll/rebar3_format/blob/main/src/rebar3_format_prv.erl#L135 |
(Sheepish grin) I got confused and assumed that you were telling me that erlang-ls used rebar3_format, so that it would use its configuration. You're actually saying that erlang-ls uses it because it abstracts the differences away, but that erlang-ls isn't making use of that to allow a different formatter.
means: "hey, Roger, if you've got some time at the weekend, could you (a) make erlang-ls read it from configuration, and (b) add the relevant configuration drop-down to the VS Code plugin"...? :) I might have some time at the weekend... |
I prefer erlfmt to rebar3_fmt. It would be great if the extension allowed me to choose. Currently I'm using
szTheory.erlang-formatter
, but it would be nice if ErlangLS allowed me to choose instead.The text was updated successfully, but these errors were encountered: