1

elixir(1.8.1) and erlang(21.3.5) are set locally via .tool-versions(ASDF) file.

ElixirLS launched using above version of elixir but it requires higher version.

** (UndefinedFunctionError) function ElixirLS.Utils.OutputDevice.get_opts/0 is undefined (module ElixirLS.Utils.OutputDevice is not available)
    ElixirLS.Utils.OutputDevice.get_opts()
    lib/wire_protocol.ex:33: ElixirLS.Utils.WireProtocol.intercept_output/2
    lib/language_server/cli.ex:6: ElixirLS.LanguageServer.CLI.main/0
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
    (elixir) lib/code.ex:232: Code.eval_string/3
[Info  - 1:09:58 PM] Connection to server got closed. Server will restart.
** (UndefinedFunctionError) function ElixirLS.Utils.OutputDevice.get_opts/0 is undefined (module ElixirLS.Utils.OutputDevice is not available)
    ElixirLS.Utils.OutputDevice.get_opts()
    lib/wire_protocol.ex:33: ElixirLS.Utils.WireProtocol.intercept_output/2
    lib/language_server/cli.ex:6: ElixirLS.LanguageServer.CLI.main/0
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
    (elixir) lib/code.ex:232: Code.eval_string/3
[Info  - 1:09:59 PM] Connection to server got closed. Server will restart.
** (UndefinedFunctionError) function ElixirLS.Utils.OutputDevice.get_opts/0 is undefined (module ElixirLS.Utils.OutputDevice is not available)
    ElixirLS.Utils.OutputDevice.get_opts()
    lib/wire_protocol.ex:33: ElixirLS.Utils.WireProtocol.intercept_output/2
    lib/language_server/cli.ex:6: ElixirLS.LanguageServer.CLI.main/0
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
    (elixir) lib/code.ex:232: Code.eval_string/3
[Info  - 1:10:00 PM] Connection to server got closed. Server will restart.
** (UndefinedFunctionError) function ElixirLS.Utils.OutputDevice.get_opts/0 is undefined (module ElixirLS.Utils.OutputDevice is not available)
    ElixirLS.Utils.OutputDevice.get_opts()
    lib/wire_protocol.ex:33: ElixirLS.Utils.WireProtocol.intercept_output/2
    lib/language_server/cli.ex:6: ElixirLS.LanguageServer.CLI.main/0
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
    (elixir) lib/code.ex:232: Code.eval_string/3
[Info  - 1:10:02 PM] Connection to server got closed. Server will restart.
** (UndefinedFunctionError) function ElixirLS.Utils.OutputDevice.get_opts/0 is undefined (module ElixirLS.Utils.OutputDevice is not available)
    ElixirLS.Utils.OutputDevice.get_opts()
    lib/wire_protocol.ex:33: ElixirLS.Utils.WireProtocol.intercept_output/2
    lib/language_server/cli.ex:6: ElixirLS.LanguageServer.CLI.main/0
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
    (elixir) lib/code.ex:232: Code.eval_string/3
[Error - 1:10:02 PM] Connection to server got closed. Server will not be restarted.

Can I make the extension to use global version(set by ASDF) of elixir?

Flux
  • 9,805
  • 5
  • 46
  • 92
Hongseok Yoon
  • 3,148
  • 8
  • 36
  • 51

1 Answers1

1

Before running anything that requires Elixir (e.g. in your case VScode and ElixirLS), you can override the elixir version by setting a temporary shell version - asdf shell elixir <elixir version you want>. This sets a shell environment variable that the asdf shim will read when running that will override the version set in .tool-versions. Of course you'll need to have the version of Elixir you want to use already installed on your system and launch everything from the shell that has the environment variable set.

Alternatively you can try something like this to disable reading of .tool-versions files entirely - https://github.com/asdf-vm/asdf/issues/870#issuecomment-780862765

Stratus3D
  • 4,648
  • 4
  • 35
  • 67