Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 65d94e7

Browse files
committed
Fix bad sync
1 parent 733cb08 commit 65d94e7

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

code-server/run.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ fi
5555
if [ ! -f "$CODE_SERVER" ] || [ "${USE_CACHED}" != true ]; then
5656
printf "$${BOLD}Installing code-server!\n"
5757

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+
5863
ARGS=(
5964
"--method=standalone"
6065
"--prefix=${INSTALL_PREFIX}"
@@ -71,6 +76,11 @@ if [ ! -f "$CODE_SERVER" ] || [ "${USE_CACHED}" != true ]; then
7176
printf "🥳 code-server has been installed in ${INSTALL_PREFIX}\n\n"
7277
fi
7378

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+
7484
# Get the list of installed extensions...
7585
LIST_EXTENSIONS=$($CODE_SERVER --list-extensions $EXTENSION_ARG)
7686
readarray -t EXTENSIONS_ARRAY <<< "$LIST_EXTENSIONS"
@@ -117,7 +127,8 @@ if [ "${AUTO_INSTALL_EXTENSIONS}" = true ]; then
117127

118128
if [ -f "$WORKSPACE_DIR/.vscode/extensions.json" ]; then
119129
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[]')
121132
for extension in $extensions; do
122133
if extension_installed "$extension"; then
123134
continue
@@ -127,4 +138,4 @@ if [ "${AUTO_INSTALL_EXTENSIONS}" = true ]; then
127138
fi
128139
fi
129140

130-
run_code_server
141+
run_code_server

0 commit comments

Comments
 (0)