diff --git a/.formatter.exs b/.formatter.exs index 38ca258ef..f6f166bfd 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,12 +1,12 @@ [ inputs: [ "*.exs", - "config/**/*.exs" + "config/**/*.exs", + "scripts/**/*.exs" ], subdirectories: [ "apps/elixir_ls_utils", "apps/elixir_ls_debugger", - "apps/language_server", - "scripts" + "apps/language_server" ] ] diff --git a/scripts/installer.exs b/scripts/installer.exs index 962a3bae3..076934455 100644 --- a/scripts/installer.exs +++ b/scripts/installer.exs @@ -65,7 +65,7 @@ defmodule ElixirLS.Mix do # with added option to disable stopping apps after install # we don't want hex app stopped # The original code is licensed under - + # Apache License # Version 2.0, January 2004 # http://www.apache.org/licenses/ @@ -243,7 +243,6 @@ defmodule ElixirLS.Mix do # END OF TERMS AND CONDITIONS - def install(deps, opts \\ []) def install(deps, opts) when is_list(deps) and is_list(opts) do @@ -476,7 +475,7 @@ defmodule ElixirLS.Installer do defp run_mix_install({:local, dir}, force?) do Mix.install( [ - {:elixir_ls, path: dir}, + {:elixir_ls, path: dir} ], force: force?, start_applications: false, @@ -488,7 +487,8 @@ defmodule ElixirLS.Installer do end defp run_mix_install({:tag, tag}, force?) do - Mix.install([ + Mix.install( + [ {:elixir_ls, github: "elixir-lsp/elixir-ls", tag: tag} ], force: force?, @@ -503,9 +503,11 @@ defmodule ElixirLS.Installer do end defp get_release do - version = Path.expand("#{__DIR__}/VERSION") - |> File.read!() - |> String.trim() + version = + Path.expand("#{__DIR__}/VERSION") + |> File.read!() + |> String.trim() + {:tag, "v#{version}"} end @@ -513,16 +515,17 @@ defmodule ElixirLS.Installer do if local?() do dir = local_dir() IO.puts(:stderr, "Installing local ElixirLS from #{dir}") - IO.puts(:stderr, "Running in #{File.cwd!}") - + IO.puts(:stderr, "Running in #{File.cwd!()}") + run_mix_install({:local, dir}, force?) else {:tag, tag} = get_release() IO.puts(:stderr, "Installing ElixirLS release #{tag}") - IO.puts(:stderr, "Running in #{File.cwd!}") - + IO.puts(:stderr, "Running in #{File.cwd!()}") + run_mix_install({:tag, tag}, force?) end + IO.puts(:stderr, "Install complete") end @@ -540,7 +543,11 @@ defmodule ElixirLS.Installer do install(false) catch kind, error -> - IO.puts(:stderr, "Mix.install failed with #{Exception.format(kind, error, __STACKTRACE__)}") + IO.puts( + :stderr, + "Mix.install failed with #{Exception.format(kind, error, __STACKTRACE__)}" + ) + IO.puts(:stderr, "Retrying Mix.install with force: true") install(true) end diff --git a/scripts/launch.exs b/scripts/launch.exs index f935ba1b7..bc1de9831 100644 --- a/scripts/launch.exs +++ b/scripts/launch.exs @@ -1,7 +1,7 @@ Application.put_env(:elixir, :ansi_enabled, false) Code.eval_file("#{__DIR__}/installer.exs") -Mix.start +Mix.start() # Put mix into quiet mode so it does not print anything to standard out # especially it makes it surface git command errors such as reported in @@ -16,6 +16,7 @@ ElixirLS.Installer.install_for_launch() case System.get_env("ELS_MODE") do "language_server" -> ElixirLS.LanguageServer.CLI.main() + "debugger" -> ElixirLS.Debugger.CLI.main() end diff --git a/scripts/quiet_install.exs b/scripts/quiet_install.exs index 622ab476b..5b38b6fc9 100644 --- a/scripts/quiet_install.exs +++ b/scripts/quiet_install.exs @@ -1,7 +1,7 @@ Application.put_env(:elixir, :ansi_enabled, false) Code.eval_file("#{__DIR__}/installer.exs") -Mix.start +Mix.start() # Put mix into quiet mode so it does not print anything to standard out # especially it makes it surface git command errors such as reported in