Error in MixProject with ElixirLS

Using VSCode with ElixirLS installed. I have a warning in MixProject. This doesn’t stop the code from running though. I uninstalled/reinstalled ElixirLS, and cleaned _build.

an exception was raised:
    ** (RuntimeError) build without intercepted logger []
(language_server 0.15.1) lib/language_server/build.ex:109: ElixirLS.LanguageServer.Build.reload_project/0
...



My file is completely standard:

use Mix.Project
def project do
    [...
      aliases: aliases(),
      deps: deps()
    ]
  end

 
  def application do
   [
      mod: {PhxSolid.Application, []},
      extra_applications: [:logger, :runtime_tools, :os_mon]
    ]
  end

  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_), do: ["lib"]

 
  defp deps do
    [...]
  end

  defp aliases do
    [...]
  end

Whenever I am facing any errors marked in mix.exs by the LSP, I delete .elixir_ls in the workspace root and restart the LS.

This procedure tends to solve those issues.

1 Like

Yes indeed, it worked.

I have this bound to a shortcut to force-restart in these circumstances:

I use it often.

I got this warning over and over. I removed this extension and am trying Mat McLoughlins’. How do you restart the language server? I don’t have this option

It’s a command available to me in the CMDShiftP command palette.

I hit CMDShiftP and start typing: elixir restart. This lets me preview the command and see a gear to set up a keyboard shortcut for it:

That takes me to the screenshot I shared above where I was able to enter in a keybinding.

1 Like

@ndrean Please post a repo that reproduces this problem. I tried your mixfile and was unable to reproduce. Does your app modify erlang logger handler?

If you are talking about this plugin: vscode-elixir - Visual Studio Marketplace

You can not restart the LSP here, as it doesn’t use an LSP.

It is implemented differently, and hasn’t received any new updates in the last 2 years.

Please use the Elixir-LSP, it is the only actively maintained elixir plugin that works beyond highlighting.

Also as the linked plugin hasn’t been updated in the last 2 years, it is very likely to not support any elixir version much newer than 1.11 or 1.12.

Most plugins that do not support a certain elixir version just mark the mix.exs as erroronous.

With the LSP plugin sadly some changes make the procedure of deleting its cache and restarting necessary.

This is true especially if you change the Elixir/OTP versions, but there are other reasons as well.

I actually rarely have the problem after dependencies have stabilized.

Sorry for my late reply. I erased everything, the .elixir_ls file, _build, and removed the plugin. Then I reinstalled the plugin and this stopped. I didn’t change anything else. I do not modify erlang logger. Everything is back to normal !?

If anyone faces this issue please report back in Logger interception can fail · Issue #947 · elixir-lsp/elixir-ls · GitHub

1 Like