diff --git a/apps/language_server/lib/language_server/build.ex b/apps/language_server/lib/language_server/build.ex index df27e6d2d..4dec17f05 100644 --- a/apps/language_server/lib/language_server/build.ex +++ b/apps/language_server/lib/language_server/build.ex @@ -29,10 +29,6 @@ defmodule ElixirLS.LanguageServer.Build do purge_consolidated_protocols() {status, diagnostics} = compile() - if status in [:ok, :noop] and Keyword.get(opts, :load_all_mix_applications?) do - load_all_mix_applications() - end - diagnostics = Diagnostics.normalize(diagnostics, root_path) Server.build_finished(parent, {status, mixfile_diagnostics ++ diagnostics}) @@ -108,33 +104,6 @@ defmodule ElixirLS.LanguageServer.Build do end end - # TODO It looks like that function is no longer needed on elixir >= 1.11 - # it was added in https://github.com/elixir-lsp/elixir-ls/pull/227 - # removing it doesn't break tests and I'm not able to reproduce - # https://github.com/elixir-lsp/elixir-ls/issues/209 on recent elixir (1.13) - def load_all_mix_applications do - apps = - cond do - Mix.Project.umbrella?() -> - Mix.Project.apps_paths() |> Map.keys() - - app = Keyword.get(Mix.Project.config(), :app) -> - [app] - - true -> - [] - end - - Enum.each(apps, fn app -> - true = Code.prepend_path(Path.join(Mix.Project.build_path(), "lib/#{app}/ebin")) - - case Application.load(app) do - :ok -> :ok - {:error, {:already_loaded, _}} -> :ok - end - end) - end - defp compile do case Mix.Task.run("compile", ["--return-errors", "--ignore-module-conflict"]) do {status, diagnostics} when status in [:ok, :error, :noop] and is_list(diagnostics) -> diff --git a/apps/language_server/lib/language_server/server.ex b/apps/language_server/lib/language_server/server.ex index b66a2f4c7..37abaddac 100644 --- a/apps/language_server/lib/language_server/server.ex +++ b/apps/language_server/lib/language_server/server.ex @@ -49,7 +49,6 @@ defmodule ElixirLS.LanguageServer.Server do build_diagnostics: [], dialyzer_diagnostics: [], needs_build?: false, - load_all_mix_applications?: false, build_running?: false, analysis_ready?: false, received_shutdown?: false, @@ -923,19 +922,14 @@ defmodule ElixirLS.LanguageServer.Server do not state.build_running? -> fetch_deps? = Map.get(state.settings || %{}, "fetchDeps", false) - {_pid, build_ref} = - Build.build(self(), project_dir, - fetch_deps?: fetch_deps?, - load_all_mix_applications?: state.load_all_mix_applications? - ) + {_pid, build_ref} = Build.build(self(), project_dir, fetch_deps?: fetch_deps?) %__MODULE__{ state | build_ref: build_ref, needs_build?: false, build_running?: true, - analysis_ready?: false, - load_all_mix_applications?: false + analysis_ready?: false } true -> @@ -1217,7 +1211,7 @@ defmodule ElixirLS.LanguageServer.Server do is_nil(prev_project_dir) -> File.cd!(project_dir) - Map.merge(state, %{project_dir: File.cwd!(), load_all_mix_applications?: true}) + %{state | project_dir: File.cwd!()} prev_project_dir != project_dir -> JsonRpc.show_message( diff --git a/apps/language_server/test/providers/code_lens/test_test.exs b/apps/language_server/test/providers/code_lens/test_test.exs index c6e898fb1..ad7f56136 100644 --- a/apps/language_server/test/providers/code_lens/test_test.exs +++ b/apps/language_server/test/providers/code_lens/test_test.exs @@ -7,8 +7,6 @@ defmodule ElixirLS.LanguageServer.Providers.CodeLens.TestTest do @project_dir "/project" setup context do - ElixirLS.LanguageServer.Build.load_all_mix_applications() - unless context[:skip_server] do server = ElixirLS.LanguageServer.Test.ServerTestHelpers.start_server() diff --git a/apps/language_server/test/providers/completion_test.exs b/apps/language_server/test/providers/completion_test.exs index d4e1b01e2..b15069455 100644 --- a/apps/language_server/test/providers/completion_test.exs +++ b/apps/language_server/test/providers/completion_test.exs @@ -20,8 +20,6 @@ defmodule ElixirLS.LanguageServer.Providers.CompletionTest do } setup context do - ElixirLS.LanguageServer.Build.load_all_mix_applications() - unless context[:skip_server] do server = ElixirLS.LanguageServer.Test.ServerTestHelpers.start_server()