Elixir + VSCode +
mix format and the ugly indent highlighting error
I had a bit of a mystery that was bugging me for ages. After enabling automatic formatting for Elixir files in VSCode, I was getting ugly highlighting that looked like this:
It turns out this is a feature of the RainbowIndents extension to show you where you have inconsistent indenting (e.g. 3 spaces, when everything else is 2).
The problem with this is
mix format has unchangeable opinions about indenting, such as in a
with statement, where it cares more about alignment than even/odd indent boundaries.
The fix is to exclude indentation errors for Elixir. In your
settings.json add this:
With that in place, we now get plain ol' rainbow indenting: