"There is no formatter for 'elixir' files installed"
Closed this issue · 16 comments
I cannot reproduce. Please fill up the template and post logs and your vscode settings.
Note you should have this in your vscode settings.json
"[elixir]": {
"editor.defaultFormatter": "JakeBecker.elixir-ls"
},
appsettings,json looks like this:
{
"terminal.integrated.enableMultiLinePasteWarning": false,
"files.autoSave": "afterDelay"
}
I still get the pop-up if I change it to this:
{
"terminal.integrated.enableMultiLinePasteWarning": false,
"files.autoSave": "afterDelay",
"[elixir]": {
"editor.defaultFormatter": "JakeBecker.elixir-ls"
},
}
This is the file:
lib\pento_web\live\wrong_live.ex
defmodule PentoWeb.WrongLive do
use PentoWeb, :live_view
def mount(_params, _session, socket) do
{:ok, assign(socket, score: 0, message: "Make a guess:")}
end
@spec render(any) :: Phoenix.LiveView.Rendered.t()
def render(assigns) do
~H"""
<h1 class="mb-4 text-4xl font-extrabold">Your score: <%= @score %></h1>
<h2>
<%= @message %>
</h2>
<br />
<h2>
<%= for n <- 1..10 do %>
<.link
class="bg-blue-500 hover:bg-blue-700
text-white font-bold py-2 px-4 border border-blue-700 rounded m-1"
phx-click="guess"
phx-value-number={n}
>
<%= n %>
</.link>
<% end %>
</h2>
"""
end
def handle_event("guess", %{"number" => guess}, socket) do
message = "Your guess: #{guess}. Wrong. Guess again. "
score = socket.assigns.score - 1
{
:noreply,
assign(
socket,
message: message,
score: score
)
}
end
end
I got formatting to work with "run on save" with the command "mix format" I saw here:
https://elixirforum.com/t/problem-with-formatting-elixir-in-vs-code/52398/3
I'm asking about your settings.json
. It usually is in
- Windows
%APPDATA%\Code\User\settings.json
- macOS
$HOME/Library/Application\ Support/Code/User/settings.json
- Linux
$HOME/.config/Code/User/settings.json
Look for editor.defaultFormatter
, most likely you have an override there. And if not there then in workspace .vscode/settings.json
.
Another possibility is you may have some conflicting extension installed.
Generally, this seems to be a configuration issue. Maybe this thread will help you https://elixirforum.com/t/how-can-i-start-using-the-new-heex-formatter-in-vs-code/51420/2
I'm in windows10.
%APPDATA%\Code\User\settings.json has:
{
"terminal.integrated.enableMultiLinePasteWarning": false,
"files.autoSave": "afterDelay",
"emeraldwalk.runonsave": {
"commands": [
{
"match": ".ex",
"cmd": "mix format"
}
]
}
}
I don't have any workspace settings.json
I did an uninstall + clean unstinstall:
Windows - Delete %APPDATA%\Code and %USERPROFILE%.vscode.
https://code.visualstudio.com/docs/setup/uninstall
Opened my project + downloaded only this plugin:
In VSCode:
File -> Preferences -> Settings + clicked the "settings.json" file in the top right corner which is empty:
{
}
I updated it to:
{
"[elixir]": {
"editor.defaultFormatter": "JakeBecker.elixir-ls"
},
}
I still get the same popup when I do ctrl + option + F
Please provide logs from VSCode Developer Tools logs and ElixirLS output tab logs @gunnars04
OTP 26.0 has critical bugs on windows. It's mentioned in the readme https://github.com/elixir-lsp/elixir-ls#support-matrix. Please update to 26.1+. If you filled the issue template and provided logs as asked we wouldn't have been wasting time.
@lukaszsamson sorry about that, will do next time!
@lukaszsamson how do I do that?
I installed the latest Elixir:
https://github.com/elixir-lang/elixir/releases
I'm using the latest Elixir and Phoenix:
Elixir 1.15.6
Phoenix 1.7.2
@lukaszsamson never mind, I found it:
https://www.erlang.org/downloads
@lukaszsamson works now (after dl'in Erlang/OTP 26.1.1 in the link above)!
Sorry for that and thanks a lot!