Skip to content

Commit 2bcce1f

Browse files
Support VS Code forks in install scripts
Add CURSORLESS_VSCODE_COMMAND environment variable to allow using VS Code forks like VSCodium, Cursor, etc. in the install scripts. - install-from-pr.sh: Use env var with fallback to 'code' - install-local.sh: Use env var with fallback to 'code' - uninstall-local.sh: Use env var with fallback to 'code' - Updated error messages with helpful installation guidance - Maintains backward compatibility Closes #3093 Amp-Thread-ID: https://ampcode.com/threads/T-51f7db4c-7163-40d8-a87e-bfd7a6764249 Co-authored-by: Amp <[email protected]>
1 parent 4467c47 commit 2bcce1f

File tree

3 files changed

+37
-9
lines changed

3 files changed

+37
-9
lines changed

packages/cursorless-vscode/scripts/install-from-pr.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ if ! command -v gh &>/dev/null; then
1616
exit 1
1717
fi
1818

19-
# Ensure VSCode 'code' command is installed
20-
if ! command -v code &>/dev/null; then
21-
echo "VSCode 'code' command not found; see https://code.visualstudio.com/docs/editor/command-line#_launching-from-command-line"
19+
# Use CURSORLESS_VSCODE_COMMAND if set, otherwise default to 'code'
20+
vscode_command="${CURSORLESS_VSCODE_COMMAND:-code}"
21+
22+
# Ensure VSCode command is installed
23+
if ! command -v "$vscode_command" &>/dev/null; then
24+
echo "VSCode command '$vscode_command' not found"
25+
echo "Install VS Code or set CURSORLESS_VSCODE_COMMAND to your VS Code binary (e.g., 'codium', 'cursor')"
26+
echo "See: https://code.visualstudio.com/docs/editor/command-line"
2227
exit 1
2328
fi
2429

@@ -47,10 +52,10 @@ trap finish EXIT
4752
gh run download "$check_number" --repo "$repo" --name vsix --dir "$tmpdir"
4853

4954
# 4. Uninstall production cursorless
50-
code --uninstall-extension pokey.cursorless || echo "Cursorless not currently installed"
55+
"$vscode_command" --uninstall-extension pokey.cursorless || echo "Cursorless not currently installed"
5156

5257
# 5. Install downloaded extension
53-
code --install-extension "$tmpdir/cursorless-development.vsix" --force
58+
"$vscode_command" --install-extension "$tmpdir/cursorless-development.vsix" --force
5459

5560
echo -e "\e[1;32mPlease restart VSCode\e[0m"
5661
echo "To uninstall and revert to production Cursorless, run the adjacent uninstall-local.sh"

packages/cursorless-vscode/scripts/install-local.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
3+
4+
# Use CURSORLESS_VSCODE_COMMAND if set, otherwise default to 'code'
5+
vscode_command="${CURSORLESS_VSCODE_COMMAND:-code}"
6+
7+
# Ensure VSCode command is installed
8+
if ! command -v "$vscode_command" &>/dev/null; then
9+
echo "VSCode command '$vscode_command' not found"
10+
echo "Install VS Code or set CURSORLESS_VSCODE_COMMAND to your VS Code binary (e.g., 'codium', 'cursor')"
11+
echo "See: https://code.visualstudio.com/docs/editor/command-line"
12+
exit 1
13+
fi
14+
315
# Bundles and installs a local version of Cursorless, uninstalling production
416
# Cursorless first and using a special extension id to break update chain
517

@@ -14,10 +26,10 @@ cd dist
1426
vsce package -o ../bundle.vsix
1527

1628
# 3. Uninstall production cursorless
17-
code --uninstall-extension pokey.cursorless || echo "Cursorless not currently installed"
29+
"$vscode_command" --uninstall-extension pokey.cursorless || echo "Cursorless not currently installed"
1830

1931
# 4. Install local Cursorless
20-
code --install-extension ../bundle.vsix --force
32+
"$vscode_command" --install-extension ../bundle.vsix --force
2133

2234
echo -e "\e[1;32mPlease restart VSCode\e[0m"
2335
echo "To uninstall and revert to production Cursorless, run the adjacent uninstall-local.sh"
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4+
# Use CURSORLESS_VSCODE_COMMAND if set, otherwise default to 'code'
5+
vscode_command="${CURSORLESS_VSCODE_COMMAND:-code}"
6+
7+
# Ensure VSCode command is installed
8+
if ! command -v "$vscode_command" &>/dev/null; then
9+
echo "VSCode command '$vscode_command' not found"
10+
echo "Install VS Code or set CURSORLESS_VSCODE_COMMAND to your VS Code binary (e.g., 'codium', 'cursor')"
11+
echo "See: https://code.visualstudio.com/docs/editor/command-line"
12+
exit 1
13+
fi
14+
415
# Switch back to production Cursorless extension locally after having run
516
# ./install-local.sh
617

718
# 1. Uninstall local cursorless
8-
code --uninstall-extension pokey.cursorless-development || echo "Cursorless development version not currently installed"
19+
"$vscode_command" --uninstall-extension pokey.cursorless-development || echo "Cursorless development version not currently installed"
920

1021
# 2. Install production Cursorless
11-
code --install-extension pokey.cursorless
22+
"$vscode_command" --install-extension pokey.cursorless
1223

1324
echo -e "\e[1;32mPlease restart VSCode\e[0m"

0 commit comments

Comments
 (0)