Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't continue due to errors on dependencies error: tell the client #1025

Open
emmanueltouzery opened this issue Nov 10, 2023 · 5 comments
Open

Comments

@emmanueltouzery
Copy link

Environment

  • Elixir & Erlang versions (elixir --version): 1.15.7-otp-26 / 26.1.2
  • Elixir Language Server version: 0.17.8
  • Operating system: fedora linux 39
  • Editor or IDE name (e.g. Emacs/VSCode): neovim 0.9.1
  • Editor Plugin/LSP Client name and version: builtin neovim

Current behavior

When I change branch in my elixir project, elixirls fails to start and requires me to call mix deps.get. I consider this normal. The dependencies are quite different between the branches. I just run mix deps.get and that fixes the issue.

However, I do not get any warning in my editor that the LSP is disabled due to that issue.

If I ask my editor to show me the LSP log file, then I can see the message:

Process #PID<0.256.0> raised an exception
** (Mix.Error) Can't continue due to errors on dependencies
    (mix 1.15.7) lib/mix.ex:577: Mix.raise/2
    (mix 1.15.7) lib/mix/tasks/deps.loadpaths.ex:47: Mix.Tasks.Deps.Loadpaths.run/1
    (mix 1.15.7) lib/mix/task.ex:455: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.15.7) lib/mix/tasks/loadpaths.ex:36: Mix.Tasks.Loadpaths.run/1
    (mix 1.15.7) lib/mix/task.ex:455: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.15.7) lib/mix/tasks/compile.ex:135: Mix.Tasks.Compile.run/1
    (mix 1.15.7) lib/mix/task.ex:455: anonymous fn/3 in Mix.Task.run_task/5
    (language_server 0.17.8) lib/language_server/build.ex:337: ElixirLS.LanguageServer.Build.run_mix_compile/0

However this is not very handy, I would like to be proactively warned that I should take this step of refetching the dependencies.

Expected behavior

I believe a clean solution would be for elixirls to "catch this error", tell the client, and then "rethrow it" -- sorry about the terminology, I'm pretty sure that's not proper elixir talk... And my understanding is that this is possible through the LSP protocol, and elixirls already does that in one place:

 JsonRpc.show_message(:warning, "OTP compiled without EEP48 documentation chunks")

It would be great if such an "error" (instead of warning in the example I pasted) message was sent if the dependencies are not up-to-date and elixirls cannot operate.

@hez
Copy link

hez commented Apr 24, 2024

I am getting this error with

  • elixir 1.16.2
  • otp 26.2.4
  • elixirls 0.20.0

It be nice to know what is causing to fail?

@lukaszsamson
Copy link
Collaborator

Anything. The error comes from mix and it's not very descriptive. Do you have a repo that reproduces it reliably?

@hez
Copy link

hez commented Apr 24, 2024

Anything. The error comes from mix and it's not very descriptive. Do you have a repo that reproduces it reliably?

Yes, it is private sadly... I am beginning to wonder if it is Oban Pro+Web as they run in a separate repo and require auth.

@kybishop
Copy link

I'm seeing the same error. We also use Oban Pro... going to look into that as the source of the problem.

@kybishop
Copy link

Not sure the cause for us but deleting .elixir_ls seems to have fixed the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants