55
55
if [ ! -f " $CODE_SERVER " ] || [ " ${USE_CACHED} " != true ]; then
56
56
printf " $$ {BOLD}Installing code-server!\n"
57
57
58
+ # Clean up from other install (in case install prefix changed).
59
+ if [ -n " $CODER_SCRIPT_BIN_DIR " ] && [ -e " $CODER_SCRIPT_BIN_DIR /code-server" ]; then
60
+ rm " $CODER_SCRIPT_BIN_DIR /code-server"
61
+ fi
62
+
58
63
ARGS=(
59
64
" --method=standalone"
60
65
" --prefix=${INSTALL_PREFIX} "
@@ -71,6 +76,11 @@ if [ ! -f "$CODE_SERVER" ] || [ "${USE_CACHED}" != true ]; then
71
76
printf " 🥳 code-server has been installed in ${INSTALL_PREFIX} \n\n"
72
77
fi
73
78
79
+ # Make the code-server available in PATH.
80
+ if [ -n " $CODER_SCRIPT_BIN_DIR " ] && [ ! -e " $CODER_SCRIPT_BIN_DIR /code-server" ]; then
81
+ ln -s " $CODE_SERVER " " $CODER_SCRIPT_BIN_DIR /code-server"
82
+ fi
83
+
74
84
# Get the list of installed extensions...
75
85
LIST_EXTENSIONS=$( $CODE_SERVER --list-extensions $EXTENSION_ARG )
76
86
readarray -t EXTENSIONS_ARRAY <<< " $LIST_EXTENSIONS"
@@ -117,7 +127,8 @@ if [ "${AUTO_INSTALL_EXTENSIONS}" = true ]; then
117
127
118
128
if [ -f " $WORKSPACE_DIR /.vscode/extensions.json" ]; then
119
129
printf " 🧩 Installing extensions from %s/.vscode/extensions.json...\n" " $WORKSPACE_DIR "
120
- extensions=$( jq -r ' .recommendations[]' " $WORKSPACE_DIR " /.vscode/extensions.json)
130
+ # Use sed to remove single-line comments before parsing with jq
131
+ extensions=$( sed ' s|//.*||g' " $WORKSPACE_DIR " /.vscode/extensions.json | jq -r ' .recommendations[]' )
121
132
for extension in $extensions ; do
122
133
if extension_installed " $extension " ; then
123
134
continue
@@ -127,4 +138,4 @@ if [ "${AUTO_INSTALL_EXTENSIONS}" = true ]; then
127
138
fi
128
139
fi
129
140
130
- run_code_server
141
+ run_code_server
0 commit comments