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

fix(runtime): use correct path for bundled elixir #448

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/next_ls/runtime.ex
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ defmodule NextLS.Runtime do
bindir = System.get_env("BINDIR")
path = System.get_env("PATH")
new_path = String.replace(path, bindir <> ":", "")
new_path = elixir_bin_path <> ":" <> new_path

with dir when is_list(dir) <- :code.priv_dir(:next_ls) do
exe =
Expand Down
12 changes: 5 additions & 7 deletions priv/monkey/_next_ls_private_compiler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ if Version.match?(System.version(), ">= 1.17.0-dev") do
{{:^, meta, [arg]}, state, %{env | context: context}}
end

defp expand({:->, _, [params, block]} = ast, state, env) do
defp expand({:->, _, [params, block]}, state, env) do
{_, state, penv} =
for p <- params, reduce: {nil, state, env} do
{_, state, penv} ->
Expand Down Expand Up @@ -1328,12 +1328,12 @@ if Version.match?(System.version(), ">= 1.17.0-dev") do

# self calling anonymous function

defp expand({{:., dmeta, [func]}, callmeta, args}, state, env) when is_list(args) do
defp expand({{:., _dmeta, [func]}, _callmeta, args}, state, env) when is_list(args) do
{res, state, _env} = expand(func, state, env)
{res, state, env}
end

defp expand({:in, meta, [left, right]} = ast, state, %{context: :match} = env) do
defp expand({:in, meta, [left, right]}, state, %{context: :match} = env) do
{left, state, env} = expand_pattern(left, state, env)
{{:in, meta, [left, right]}, state, env}
end
Expand Down Expand Up @@ -1471,7 +1471,7 @@ if Version.match?(System.version(), ">= 1.17.0-dev") do
{Enum.reverse(blocks), put_in(state.functions, functions), env}
end

defp expand_macro(_meta, Kernel, type, [{name, _, params}, blocks], _callback, state, env)
defp expand_macro(_meta, Kernel, type, [{_name, _, params}, blocks], _callback, state, env)
when type in [:def, :defp] and is_list(params) and is_list(blocks) do
{_, state, penv} =
for p <- params, reduce: {nil, state, env} do
Expand All @@ -1486,8 +1486,6 @@ if Version.match?(System.version(), ">= 1.17.0-dev") do
{[{type, res} | acc], state}
end

arity = length(List.wrap(params))

{Enum.reverse(blocks), state, env}
end

Expand Down Expand Up @@ -1574,7 +1572,7 @@ if Version.match?(System.version(), ">= 1.17.0-dev") do
{Enum.reverse(acc), state, env}
end

defp expand_list([h | t] = list, state, env, acc) do
defp expand_list([h | t], state, env, acc) do
{h, state, env} = expand(h, state, env)
expand_list(t, state, env, [h | acc])
end
Expand Down