Closed dmarkow closed 6 years ago
Not sure why the version of VS Code would have any effect, but this might be a dupe of https://github.com/JakeBecker/elixir-ls/issues/67 . Try upgrading to the latest revision of Elixir and see if that fixes it. You can do this via kiex
by running kiex install master && kiex use master --default
and restarting VS Code.
Using master (1.7.0-dev) seems to work -- hopefully 1.7.0 will be released soon.
It's still odd that the only factor in formatting working or not for me is the VS Code version -- the issue you linked to never happened for me before today's update, even on Elixir 1.6.4, and when I reinstall VS Code 1.22.2, it works fine again.
Glad it's working for you. No idea why the VS Code version affects the behavior though. ¯_(ツ)_/¯
I'm in the same boat as @dmarkow , but sadly the proposed solution doesn't work for me
My versions:
➜ elixir -v
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Elixir 1.7.0-dev (98a73f5e7) (compiled with Erlang/OTP 20)
➜ code -v
1.23.1
d0182c3417d225529c6d5ad24b7572815d0de9ac
x64
Elixir-LS: 0.2.19
My .formatter.exs
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
import_deps: [:ecto]
]
When saving a schema file, it will replace field :name, :string
with field(:name, :string)
. This however does not happen when running mix format
Any advice? I would be happy to drop more infos if you need them :+1:
In VS Code 1.22.2 and earlier, the code formatting worked perfectly. My
.formatter.exs
file hasimport_deps: [:ecto]
in it, which as an example setsfield/2
to not have parens. So in 1.22.2, formatting this line doesn't change anything:field :name, :string
But in 1.23.0, formatting it changes it to:
field(:name, :string)
If I manually add
locals_without_parens: [field: 2]
to my.formatter.exs
it works fine, and runningmix format
in the integrated terminal works fine and respectsimport_deps
, but using the "Format Document" command in VS Code now ignores theimport_deps
line.When I revert back to 1.22.2, it works as expected. I disabled all other extensions just to make sure something else wasn't interfering.