-
Notifications
You must be signed in to change notification settings - Fork 0
feat: VS Code/Cursor を対話式で選択可能に #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
striderkein
wants to merge
1
commit into
master
Choose a base branch
from
feat/26
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,58 @@ | ||
| #!/bin/sh | ||
|
|
||
| SCRIPT_DIR=$(cd $(dirname $0) && pwd) | ||
| VSCODE_SETTING_DIR=~/Library/Application\ Support/Code/User | ||
|
|
||
| rm "$VSCODE_SETTING_DIR/settings.json" | ||
| ln -s "$SCRIPT_DIR/settings.json" "${VSCODE_SETTING_DIR}/settings.json" | ||
| # エディタ選択 | ||
| echo "セットアップするエディタを選択してください:" | ||
| echo " 1) VS Code" | ||
| echo " 2) Cursor" | ||
| printf "選択 [1/2]: " | ||
| read choice | ||
|
|
||
| rm "$VSCODE_SETTING_DIR/keybindings.json" | ||
| ln -s "$SCRIPT_DIR/keybindings.json" "${VSCODE_SETTING_DIR}/keybindings.json" | ||
| case "$choice" in | ||
| 1) | ||
| EDITOR_NAME="VS Code" | ||
| SETTING_DIR=~/Library/Application\ Support/Code/User | ||
| EDITOR_CMD="code" | ||
| ;; | ||
| 2) | ||
| EDITOR_NAME="Cursor" | ||
| SETTING_DIR=~/Library/Application\ Support/Cursor/User | ||
| EDITOR_CMD="cursor" | ||
| ;; | ||
| *) | ||
| echo "Error: 無効な選択です。1 または 2 を入力してください。" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| # install extention | ||
| # code コマンドが見つからない場合は、インストール方法を案内して終了 | ||
| if ! command -v code &> /dev/null; then | ||
| echo "Error: 'code' command not found." | ||
| echo "${EDITOR_NAME} のセットアップを開始します..." | ||
|
|
||
| # シンボリックリンクを作成 | ||
| rm "$SETTING_DIR/settings.json" 2>/dev/null | ||
| ln -s "$SCRIPT_DIR/settings.json" "${SETTING_DIR}/settings.json" | ||
| echo " settings.json をリンクしました" | ||
|
|
||
| rm "$SETTING_DIR/keybindings.json" 2>/dev/null | ||
| ln -s "$SCRIPT_DIR/keybindings.json" "${SETTING_DIR}/keybindings.json" | ||
| echo " keybindings.json をリンクしました" | ||
|
|
||
| # install extension | ||
| # CLI コマンドが見つからない場合は、インストール方法を案内して終了 | ||
| if ! command -v "$EDITOR_CMD" &> /dev/null; then | ||
| echo "Error: '${EDITOR_CMD}' command not found." | ||
| echo "Please install it by:" | ||
| echo " 1. Open VS Code" | ||
| echo " 1. Open ${EDITOR_NAME}" | ||
| echo " 2. Press Cmd+Shift+P" | ||
| echo " 3. Run 'Shell Command: Install 'code' command in PATH'" | ||
| echo " 3. Run 'Shell Command: Install '${EDITOR_CMD}' command in PATH'" | ||
| exit 1 | ||
| fi | ||
|
|
||
| cat "$SCRIPT_DIR/extensions" | while read line | ||
| do | ||
| code --install-extension $line | ||
| "$EDITOR_CMD" --install-extension $line | ||
| done | ||
|
|
||
| code --list-extensions > "$SCRIPT_DIR/extensions" | ||
| "$EDITOR_CMD" --list-extensions > "$SCRIPT_DIR/extensions" | ||
|
|
||
| echo "${EDITOR_NAME} のセットアップが完了しました!" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shared extensions file causes cross-editor contamination
Medium Severity
The script reads from and writes to a single shared
extensionsfile for both VS Code and Cursor. When a user runs the script for one editor, it overwrites theextensionsfile with that editor's installed extensions. Running the script later for the other editor will use the wrong extension list and then overwrite it again. This causes unintended cross-contamination between the two editors' extension configurations.Additional Locations (1)
vscode-dotfiles/vscode_install.sh#L50-L54