Rob1

Rob1

Edit: I solved this.

This post is how I solved this problem. It requires installing the extension “run on save” and setting it to run mix format.

I still have ElixirLS installed, the above solution doesn’t interfere with it.

My original post is below.


I’d like to format my code on save (using mix format) in VSCode, I saw that ElixirLS should have this functionality so I set it to do so by putting this in my settings.json:

"[elixir]": {
    "editor.defaultFormatter": "JakeBecker.elixir-ls"
    "editor.formatOnSave": true,
...

However, when I open another file in a project, it says the file “is not included in .formatter.exs” (it’s ElixirLS that shows that message) despite the fact that it has an exs file extension. For some other files format on save works, such as if I open the project_test.exs file change the formating and save it, it gets autoformated correctly.

The .formatter.exs reads:

# Used by "mix format"
[
  inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]

Which should catch this file. So I’m at a loss why the file is not being caught. For me it’s important to autoformat my files on save, for consistent formating.

Any ideas? I am on Windows 10.

Steps to reproduce:

1. Install ElixirLS and set it to the default formater for Elixir files as per above.
2. mix new project
3. In the project directory, add an exs file
4. Open it in vscode.
5. When saved it shows this error.

Any ideas?

Showing Posts 1 to 1

lud

lud

Elixir LS is supposed to respect the .formatter.exs rules by now. But it does not always work for me either.

Since I run my tests all the time I just added mix format in front of my test command :smiley:

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews