Ash + ElixirLSP ** (Mix.Error) Formatter plugin Spark.Formatter cannot be found

I have been enjoying Ash+ElixirLS auto-completion and all the productivity goodies that comes with them, but today, after installing updates in ubuntu, I am getting the following message.

How do I solve it?

Elixir version: 1.17.2
OTP: 27
Ash: latest version

Unable to find formatter for /home/kamaro/elixir/hr/mix.exs: "** (Mix.Error) Formatter plugin Spark.Formatter cannot be found\n    (mix 1.17.2) lib/mix.ex:588: Mix.raise/2\n    (language_server 0.20.0) lib/language_server/mix_tasks/format.ex:302: anonymous fn/2 in Mix.Tasks.ElixirLSFormat.load_plugins/1\n    (elixir 1.17.2) lib/enum.ex:2531: Enum.\"-reduce/3-lists^foldl/2-0-\"/3\n    (language_server 0.20.0) lib/language_server/mix_tasks/format.ex:299: Mix.Tasks.ElixirLSFormat.load_plugins/1\n    (language_server 0.20.0) lib/language_server/mix_tasks/format.ex:362: Mix.Tasks.ElixirLSFormat.formatter_for_file/2\n    (language_server 0.20.0) lib/language_server/source_file.ex:265: ElixirLS.LanguageServer.SourceFile.formatter_for/3\n    (language_server 0.20.0) lib/language_server/providers/formatting.ex:13: ElixirLS.LanguageServer.Providers.Formatting.format/4\n    (language_server 0.20.0) lib/language_server/server.ex:1272: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2\n"

Have you tried rm -rf .elixir_ls that’s the first thing I do when ai have problems with ElixirLS

Thanks! this did it. Here is are steps I took.

  1. Uninstalled ls
  2. rm -rf .elixir_ls in the root folder
  3. Restarted the computer
  4. Re-installed ElixirLS extension and waited for sometime
  5. Then it started working again.

Uninstalling and restarting shouldn’t be necessary. However, it can take a bit of time until Elixir LS has recompiled everything and responds to requests like “go to definition.”

Unfortunately, this can happen occasionally with ElixirLS, and this probably won’t be the last time you have to do this.

Looking forward to the work of the new LSP team :rocket:

3 Likes