-
-
Notifications
You must be signed in to change notification settings - Fork 87
Description
Hiya! This is my third time giving Expert a time; each time I've had a different show-stopper.
Today we get further than ever before, but bring-up fails at:
...
23:16:37.752 [info] Child :net_kernel of Supervisor :net_sup started
Pid: #PID<0.186.0>
Start Call: :net_kernel.start_link(%{name: :"expert-manager-kv-20199@127.0.0.1", supervisor: :net_sup_
dynamic, net_tickintensity: 4, net_ticktime: 60, name_domain: :longnames, clean_halt: false})
Restart: :permanent
Shutdown: 2000
Type: :worker
23:16:37.753 [debug] Child :net_sup_dynamic of Supervisor :kernel_sup started
Pid: #PID<0.183.0>
Start Call: :erl_distribution.start_link(%{name: :"expert-manager-kv-20199@127.0.0.1", supervisor: :ne
t_sup_dynamic, net_tickintensity: 4, net_ticktime: 60, name_domain: :longnames, clean_halt: false})
Restart: :permanent
Shutdown: 1000
Type: :supervisor
23:16:37.779 [debug] sent notification server -> client window/logMessage
23:16:37.780 [error] Failed to find an elixir executable, shutting down
23:16:37.780 [debug] sent notification server -> client $/progress
23:16:37.784 [error] Process #PID<0.182.0> terminating
** (exit) :ok
(stdlib 6.2.2.2) gen_server.erl:2210: :gen_server.init_it/6
(stdlib 6.2.2.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Reading the source, it turns out Expert tries to launch a new shell without a PATH variable set, navigate to the project directory, and then look for elixir in PATH:
expert/apps/expert/lib/expert/port.ex
Lines 85 to 97 in 8e1bb3d
| defp path_env_at_directory(directory, shell) do | |
| # We run a shell in interactive mode to populate the PATH with the right value | |
| # at the project root. Otherwise, we either can't find an elixir executable, | |
| # we use the wrong version if the user uses a version manager like asdf/mise, | |
| # or we get an incomplete PATH not including erl or any other version manager | |
| # managed programs. | |
| env = [ | |
| # Disable shell session history to reduce noise | |
| {"SHELL_SESSIONS_DISABLE", "1"}, | |
| # Start with a clean PATH to get the correct new value | |
| {"PATH", nil} | |
| ] |
I use Nix and dev shells (nix develop) to manage my toolchains. This will never find an elixir executable, since I don't (and won't ever) have one setup outside a dev shell. Indeed, the correct elixir executable is the one that was already on PATH, because I'm in a dev shell when I start my editor! This is how my other LSPs manage to find their tools.
Can we perhaps fall back to an elixir found on the PATH in Expert's environment itself if this method doesn't produce anything?