1diff --git c/scripts/launch.sh w/scripts/launch.sh
2index d9c33952..8bc5c382 100755
3--- c/scripts/launch.sh
4+++ w/scripts/launch.sh
5@@ -1,114 +1,4 @@
6-#!/bin/sh
7-# Actual launcher. This does the hard work of figuring out the best way
8-# to launch the language server or the debug adapter.
9-
10-# Running this script is a one-time action per project launch, so we opt for
11-# code simplicity instead of performance. Hence some potentially redundant
12-# moves here.
13-
14-
15-did_relaunch=$1
16-
17-# Get the user's preferred shell
18-preferred_shell=$(basename "$SHELL")
19-
20-# Get current dirname
21-dirname=$(dirname "$0")
22-
23-case "${did_relaunch}" in
24- "")
25- if [ "$preferred_shell" = "bash" ]; then
26- >&2 echo "Preferred shell is bash, relaunching"
27- exec "$(which bash)" "$0" relaunch
28- elif [ "$preferred_shell" = "zsh" ]; then
29- >&2 echo "Preferred shell is zsh, relaunching"
30- exec "$(which zsh)" "$0" relaunch
31- elif [ "$preferred_shell" = "fish" ]; then
32- >&2 echo "Preferred shell is fish, launching launch.fish"
33- exec "$(which fish)" "$dirname/launch.fish"
34- else
35- >&2 echo "Preferred shell $preferred_shell is not supported, continuing in POSIX shell"
36- fi
37- ;;
38- *)
39- # We have an arg2, so we got relaunched
40- ;;
41-esac
42-
43-# First order of business, see whether we can setup asdf
44-echo "Looking for asdf install" >&2
45-
46-readlink_f () {
47- cd "$(dirname "$1")" > /dev/null || exit 1
48- filename="$(basename "$1")"
49- if [ -h "$filename" ]; then
50- readlink_f "$(readlink "$filename")"
51- else
52- echo "$(pwd -P)/$filename"
53- fi
54-}
55-
56-export_stdlib_path () {
57- which_elixir_expr=$1
58- stdlib_path=$(eval "$which_elixir_expr")
59- stdlib_real_path=$(readlink_f "$stdlib_path")
60- ELX_STDLIB_PATH=$(echo "$stdlib_real_path" | sed "s/\(.*\)\/bin\/elixir/\1/")
61- export ELX_STDLIB_PATH
62-}
63-
64-# Check if we have the asdf binary for version >= 0.16.0
65-if command -v asdf >/dev/null 2>&1; then
66- asdf_version=$(asdf --version 2>/dev/null)
67- version=$(echo "$asdf_version" | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
68- major=$(echo "$version" | cut -d. -f1)
69- minor=$(echo "$version" | cut -d. -f2)
70- # If the version is less than 0.16.0 (i.e. major = 0 and minor < 16), use legacy method.
71- if [ "$major" -eq 0 ] && [ "$minor" -lt 16 ]; then
72- ASDF_DIR=${ASDF_DIR:-"${HOME}/.asdf"}
73- ASDF_SH="${ASDF_DIR}/asdf.sh"
74- if test -f "$ASDF_SH"; then
75- >&2 echo "Legacy pre v0.16.0 asdf install found at $ASDF_SH, sourcing"
76- # Source the old asdf.sh script for versions <= 0.15.0
77- . "$ASDF_SH"
78- else
79- >&2 echo "Legacy asdf not found at $ASDF_SH"
80- fi
81- else
82- >&2 echo "asdf executable found at $(command -v asdf). Using ASDF_DIR=${ASDF_DIR}, ASDF_DATA_DIR=${ASDF_DATA_DIR}."
83- fi
84- export_stdlib_path "asdf which elixir"
85-else
86- # Fallback to old method for version <= 0.15.x
87- ASDF_DIR=${ASDF_DIR:-"${HOME}/.asdf"}
88- ASDF_SH="${ASDF_DIR}/asdf.sh"
89- if test -f "$ASDF_SH"; then
90- >&2 echo "Legacy pre v0.16.0 asdf install found at $ASDF_SH, sourcing"
91- # Source the old asdf.sh script for versions <= 0.15.0
92- . "$ASDF_SH"
93- export_stdlib_path "asdf which elixir"
94- else
95- >&2 echo "asdf not found"
96- >&2 echo "Looking for mise executable"
97-
98- # Look for mise executable
99- if command -v mise >/dev/null 2>&1; then
100- >&2 echo "mise executable found at $(command -v mise), activating"
101- eval "$($(command -v mise) env -s "$preferred_shell")"
102- export_stdlib_path "mise which elixir"
103- else
104- >&2 echo "mise not found"
105- >&2 echo "Looking for vfox executable"
106-
107- if command -v vfox >/dev/null 2>&1; then
108- >&2 echo "vfox executable found at $(command -v vfox), activating"
109- eval "$( $(command -v vfox) activate "$preferred_shell" )"
110- else
111- >&2 echo "vfox not found"
112- export_stdlib_path "which elixir"
113- fi
114- fi
115- fi
116-fi
117+#!/usr/bin/env bash
118
119 # In case that people want to tweak the path, which Elixir to use, or
120 # whatever prior to launching the language server or the debug adapter, we
121@@ -127,29 +17,22 @@ fi
122 # script so we can correctly configure the Erlang library path to
123 # include the local .ez files, and then do what we were asked to do.
124
125-if [ -z "${ELS_INSTALL_PREFIX}" ]; then
126- SCRIPT=$(readlink_f "$0")
127- SCRIPTPATH=$(dirname "$SCRIPT")
128-else
129- SCRIPTPATH=${ELS_INSTALL_PREFIX}
130-fi
131+SCRIPT=$(readlink -f "$0")
132+SCRIPTPATH=$(dirname "$SCRIPT")/../scripts
133
134 export MIX_ENV=prod
135 # Mix.install prints to stdout and reads from stdin
136 # we need to make sure it doesn't interfere with LSP/DAP
137-echo "" | elixir "$SCRIPTPATH/quiet_install.exs" >/dev/null || exit 1
138+echo "" | @elixir@/bin/elixir "$SCRIPTPATH/quiet_install.exs" >/dev/null || exit 1
139
140 default_erl_opts="-kernel standard_io_encoding latin1 +sbwt none +sbwtdcpu none +sbwtdio none"
141
142-if [ "$preferred_shell" = "bash" ]; then
143- . "$dirname/exec.bash"
144-elif [ "$preferred_shell" = "zsh" ]; then
145- . "$dirname/exec.zsh"
146-else
147- if [ -z "$ELS_ELIXIR_OPTS" ]
148- then
149- # in posix shell does not support arrays
150- >&2 echo "ELS_ELIXIR_OPTS is not supported in current shell"
151- fi
152- exec elixir --erl "$default_erl_opts $ELS_ERL_OPTS" "$SCRIPTPATH/launch.exs"
153-fi
154+# ensure elixir stdlib can be found
155+ELX_STDLIB_PATH=${ELX_STDLIB_PATH:-@elixir@/lib/elixir}
156+export ELX_STDLIB_PATH
157+
158+# ensure our elixir is in the path
159+PATH="@elixir@/bin:$PATH"
160+export PATH
161+
162+source "$SCRIPTPATH/exec.bash"