diff --git a/apps/debugger/lib/debugger/server.ex b/apps/debugger/lib/debugger/server.ex index b492be88..3b59efd5 100644 --- a/apps/debugger/lib/debugger/server.ex +++ b/apps/debugger/lib/debugger/server.ex @@ -443,7 +443,7 @@ defmodule ElixirLS.Debugger.Server do # FIXME: Private API unless match?(%{file: ^mixfile}, Mix.ProjectStack.peek()) do - Code.require_file(System.get_env("MIX_EXS") || "mix.exs") + Code.compile_file(System.get_env("MIX_EXS") || "mix.exs") end task = task || Mix.Project.config()[:default_task] @@ -555,7 +555,10 @@ defmodule ElixirLS.Debugger.Server do %{name: name, file: file} = project :code.purge(name) :code.delete(name) - Code.require_file(file) + # It's important to use `compile_file` here instead of `require_file` + # because we are recompiling this file to reload the mix project back onto + # the project stack. + Code.compile_file(file) end end diff --git a/apps/elixir_ls_utils/test/support/mix_test.case.ex b/apps/elixir_ls_utils/test/support/mix_test.case.ex index 9f7905bb..2d23c6e7 100644 --- a/apps/elixir_ls_utils/test/support/mix_test.case.ex +++ b/apps/elixir_ls_utils/test/support/mix_test.case.ex @@ -129,7 +129,10 @@ defmodule ElixirLS.Utils.MixTest.Case do for %{name: module, file: file} <- stack do :code.purge(module) :code.delete(module) - Code.require_file(file) + # It's important to use `compile_file` here instead of `require_file` + # because we are recompiling this file to reload the mix project back onto + # the project stack. + Code.compile_file(file) end end