erlang-language-platform icon indicating copy to clipboard operation
erlang-language-platform copied to clipboard

Feature request: support code formatting using erlfmt

Open eproxus opened this issue 6 months ago • 5 comments

One noticeable thing missing from ELP, when switching from erlang-ls, is code formatting. It would be nice if ELP could format code using erlfmt (reading any relevant configuration from rebar.config etc.).

eproxus avatar Jul 09 '25 08:07 eproxus

@eproxus It's an option. Currently we have this feature internally via a direct VS Code integration. I wonder if, for the time being, we could at least port it to the OSS version of the extension + Emacs. And, medium-term, have formatting going through LSP.

@michalmuskala is there any special reason why erlfmt is not integrated via the protocol?

robertoaloi avatar Jul 10 '25 09:07 robertoaloi

Just FYI I'm using Zed, so anything built-in into the LSP would be the easiest.

eproxus avatar Jul 10 '25 09:07 eproxus

@robertoaloi What do you mean by the protocol?

michalmuskala avatar Jul 10 '25 09:07 michalmuskala

@michalmuskala see https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_formatting

alanz avatar Jul 10 '25 09:07 alanz

Ah, I think this was primarily to avoid direct dependency from ELP on erlfmt, but this might be less of a concern now that erlfmt isn't evolving that much

michalmuskala avatar Jul 10 '25 10:07 michalmuskala