Closed ziyouchutuwenwu closed 6 months ago
it should be reported to https://github.com/elixir-lsp/elixir-ls
Something is wrong with your env or hex, not with elixirLS. There were similar reports already here and on elixir forums. Please use search
sorry for reopening this issue, i found need to run Code.append_path for debian, as i posted https://github.com/elixir-lsp/elixir-ls/issues/1092, i don't know how to add dir /home/mmc/.mix/archives/hex-2.0.6/hex-2.0.6/ebin/
to system beam path automaticlly.
here is my code for $HOME/.vscode/extensions/jakebecker.elixir-ls-0.21.1/elixir-ls-release/installer.exs
defp load_hex do
if !Code.ensure_loaded?(Hex) do
base_dir = System.user_home |> Path.join(".mix/archives")
if base_dir |> File.exists? do
sub_dirs = File.ls!(base_dir)
if sub_dirs |> Enum.count() > 0 do
hex_dirs = Enum.filter(sub_dirs, fn dir -> dir |> String.starts_with?("hex-") end)
hex_dir = Enum.reduce(hex_dirs, fn dir, saved_dir ->
start_pos = String.length("hex-")
ver1 = dir |> String.slice(start_pos..-1) |> Version.parse!()
ver2 = saved_dir |> String.slice(start_pos..-1) |> Version.parse!()
case Version.compare(ver1, ver2) do
:gt ->
dir
:lt ->
saved_dir
:eq ->
[dir, saved_dir] |> Enum.random()
end
end)
hex_beam_path = base_dir |> Path.join(hex_dir) |> Path.join(hex_dir) |> Path.join("ebin")
Code.append_path(hex_beam_path)
end
end
end
end
line 342
load_hex()
cond do xxx
sorry, it's due to https://github.com/elixir-lsp/elixir-ls, close it now
i am not sure if this issue should be posted here or https://github.com/elixir-lsp/elixir-ls, here is the steps.
due to gfw, i download hex manually, then
here is the snapshot of installed hex
when i create demo project
open with vscode, then check the elixirls output
Elixir & Erlang versions (elixir --version):
elixir was installed by apt, not asdf
vscode version
VSCode ElixirLS version:
os version: