Skip to content
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

Question about Support for Trailing Commas in ElixirLS Formatter #423

Closed
Putinspudding opened this issue Jun 26, 2024 · 1 comment
Closed
Labels
question Further information is requested

Comments

@Putinspudding
Copy link

Environment

  • Elixir & Erlang versions (elixir --version): Elixir 1.17.0 (compiled with Erlang/OTP 27)
  • VSCode ElixirLS version: v0.22.0

Troubleshooting

Hi there,I've noticed that the formatter in ElixirLS doesn’t support trailing commas in lists, maps, or function definitions. When using so,it will be auto trimed when saving.
Something like when I write this:

  def test do
    {
      :foo,
      :bar,
    }
  end

It will auto formatted as:

  def test do
    {
      :foo,
      :bar
    }
  end

Trailing commas can make diffs cleaner and code maintenance easier.
Is there any chance this feature or an settings option could be added in a future update?

@lukaszsamson
Copy link
Collaborator

I do like trailing commas but the upstream elixir formatter does not support it and there is currently no plan. See elixir-lang/elixir#13320 and elixir-lang/elixir#7689 (comment). You can try your luck with https://github.com/marcandre/freedom_formatter but I never tested it with elixir-ls

@lukaszsamson lukaszsamson closed this as not planned Won't fix, can't repro, duplicate, stale Jun 26, 2024
@lukaszsamson lukaszsamson added the question Further information is requested label Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants