Haogudu

Haogudu

Problem with formatting elixir in vs code

Hello, I just started to learn elixir by following Alchemist Camp’s tutorial. And I had problem with formatting my code in vs code editor. I tried multiple formatter extensions. None of them worked for me. And the editor ran into compatibility problem. So, I deleted all the elixir related extension except ElixirLS. The editor finally stop giving me error. But it did not format my code either. Then I checked the “settings.json” file and updated the Elixir part as following:

“[elixir]”: {
“editor.defaultFormatter”: “JakeBecker.elixir-ls”
}

I tried to format it again after I reload vs code. It is not working still. Can someone help me with the format setting?

First Post!

bdarla

bdarla

You may find some configurations in a related thread:
https://forum.elixirforum.com/t/how-can-i-start-using-the-new-heex-formatter-in-vs-code/51420/1

The one I posted there works fine for me.

Most Liked

KristerV

KristerV

i actually haven’t been able to get any formatters to work properly. so i made a “stupid” solution.

I use the Run on Save extension to run mix format as it would in Bash (CLI). then all you need to do is make sure mix format actually works by using it in Bash.

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe
lukaszsamson

lukaszsamson

ElixirLS Core Team

This is incorrect. The vscode extension is still using the original name. Unfortunately it’s not possible to rename a published extension. This is still a correct formatter config for ElixirLS config

"[elixir]": {
    "editor.defaultFormatter": "JakeBecker.elixir-ls"
  }

Where Next?

Popular in Questions Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44265 214
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement