VSCode formatter

I was happily using VSCode for the last 1 1/2 years and wrote tons of elixir in it, but somehow in the last couple of weeks something broke the code formater plugin that i was using. I tried two others, but they all do not work anymore. I have not enough knowledge to understand what is happening, and because of that I am asking here first: is this just my computer? Or have others seen this problem, too? What formater plugin do you use? If this is just me I will have to start to learn how to debug it…or switch back to vim :lol:.

What plugins have you tried exactly?

Most plugins will probably clash with the Elixir LS, just in case you are using it.

@bitboxer I use VSCode and switched a few months ago from using https://github.com/JakeBecker/vscode-elixir-ls to using https://github.com/elixir-lsp/vscode-elixir-ls

Both of them though enable mix.format on save, if you set this config in your settings.json:

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

I do have persistent odd breakage in formatting though, where at irregular intervals I notice it’s no longer formatting on save, but if I quit VSCode and restart it works again. If anyone has a fix/diagnosis on that I’d love it, mostly because I don’t always notice for a while and occasionally commit unformatted code as a result. It also seems to take a minute or so after restarting to respect the rules for .formatter.exs re: locals_without_parens which often leads to a bunch of changes that I don’t want.

1 Like