popo63301

popo63301

VSCode Elixir Format - Prevent auto parentheses

Hello !

I would like to prevent automatic parentheses while coding in Elixir in VSCode.

I can’t see where to configure that.

Any suggestions ?

Most Liked

cmo

cmo

The elixir formatter doesn’t have much in the way of options. The idea is that you accept how it is and move on with your life, free from worrying about formatting.

There are libraries, ecto, phoenix etc, that tell it not to add them to some macros, which you need to add to formatter.exs.

If you’re just talking about it creating the second bracket, look in the VS Code settings.

popo63301

popo63301

I have to precise. It’s annoying for 2 particular situations:

Macros like add and field (in Ecto Migrations and Schemas)

cmo

cmo

Have you got the inpit_deps set in .formatter.exs? The ecto setting should stop that. However, as someone pointed out, it will randomly screw it up every now and then. You have git to save you in those instances.

[
  import_deps: [:ecto, :phoenix, :surface, :nimble_parsec],
  inputs: ["*.{ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{ex,exs,sface}"],
  subdirectories: ["priv/*/migrations"],
...

Last Post!

rorscharg

rorscharg

Runing MIX_ENV=test mix compile --force and restarting VSCode seems to fix it for me.

Where Next?

Popular in Questions Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
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
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
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
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
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
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement