Skip to content

Commit

Permalink
fix(runtime): use correct path for bundled elixir (#448)
Browse files Browse the repository at this point in the history
fix(runtime): remove unused variable warnings
  • Loading branch information
mhanberg authored May 8, 2024
1 parent fb8b005 commit 904a3d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
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

0 comments on commit 904a3d1

Please sign in to comment.