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

Custom dot-formatter location isn't respected by extension #421

Open
2 tasks done
kieraneglin opened this issue Jun 17, 2024 · 1 comment
Open
2 tasks done

Custom dot-formatter location isn't respected by extension #421

kieraneglin opened this issue Jun 17, 2024 · 1 comment

Comments

@kieraneglin
Copy link

Is this the right repo?

This is specifically a request for this repo

Environment

  • Elixir & Erlang versions (elixir --version): Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] Elixir 1.17.0 (compiled with Erlang/OTP 25)
  • VSCode ElixirLS version: 0.22.0
  • Operating System Version: darwin 23.5.0

Troubleshooting

  • Restart your editor (which will restart ElixirLS) sometimes fixes issues
  • Stop your editor, remove the entire .elixir_ls directory, then restart your editor

Setup

  • Move .formatter.exs into a directory like tooling/.formatter.exs
  • Update your mix aliases to overwrite mix format like:
defp aliases do
  [
    format: "format --dot-formatter=tooling/.formatter.exs",
    # ...
  ]
end
  • Attempt to format a file via the extension

Expected behaviour

--dot-formatter argument is respected (or, if not respected, is configurable)

Actual behaviour

--dot-formatter argument is not respected or configurable

Spitballing

I'm not sure if this is possible, but it'd rule if you could specify the exact formatting command to run in your VS Code settings and the format task would use that command instead. The default value would be mix format

@lukaszsamson
Copy link
Collaborator

ElixirLS handler for LSP textDocument/formatting does not run the mix task. It calls formatter APIs directly. If you need changing path I suggest opening an issue in elixir so dot-formatter path setting can be read from mix project.

Alternatively stick to using a custom VSCode task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants