Skip to content

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

@emmanueltouzery

Description

@emmanueltouzery

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions