vscode

Control VS Code from the terminal. Open files, run commands, manage extensions, use the integrated terminal, interact with Copilot, and automate editor tasks. Use when a user asks FRIDAY to work with

SKILL.md

GitHub

VS Code Control Skill

Control Visual Studio Code from the command line. Open files, run commands, manage extensions, and automate editor tasks.

Open Files and Folders

Open a file

code /path/to/file.txt
code ~/project/src/main.py

Open file at specific line

code --goto /path/to/file.txt:42
code -g /path/to/file.txt:42:10  # line 42, column 10

Open folder/workspace

code /path/to/project
code .  # Current directory

Open in new window

code -n /path/to/project
code --new-window /path/to/file.txt

Open in existing window (reuse)

code -r /path/to/file.txt
code --reuse-window /path/to/project

Open multiple files

code file1.py file2.py file3.py

Compare/diff two files

code --diff file1.txt file2.txt
code -d original.py modified.py

Create and Edit Files

Create new untitled file

code --new-file

Create file with content (using stdin)

echo "print('Hello World')" | code -

Create file then open it

touch ~/project/newfile.py && code ~/project/newfile.py

Create file with content and open

cat > /tmp/script.py << 'EOF'
#!/usr/bin/env python3
def main():
    print("Hello from Friday!")

if __name__ == "__main__":
    main()
EOF
code /tmp/script.py

Quick edit with sed then open

sed -i 's/old_text/new_text/g' file.txt && code file.txt

Run VS Code Commands

Run any VS Code command

code --command "workbench.action.toggleSidebarVisibility"
code --command "editor.action.formatDocument"
code --command "workbench.action.files.save"

Common commands

# File operations
code --command "workbench.action.files.save"
code --command "workbench.action.files.saveAll"
code --command "workbench.action.closeActiveEditor"
code --command "workbench.action.closeAllEditors"

# Editor actions
code --command "editor.action.formatDocument"
code --command "editor.action.commentLine"
code --command "editor.action.selectAll"

# View/UI
code --command "workbench.action.toggleSidebarVisibility"
code --command "workbench.action.togglePanel"
code --command "workbench.action.toggleZenMode"
code --command "workbench.action.toggleFullScreen"

# Search
code --command "workbench.action.findInFiles"
code --command "editor.action.startFindReplaceAction"

# Git
code --command "git.commit"
code --command "git.push"
code --command "git.pull"
code --command "git.sync"

Integrated Terminal

Open VS Code terminal

code --command "workbench.action.terminal.new"

Run command in VS Code terminal

First open VS Code, then use xdotool to type in terminal:

code /path/to/project
sleep 2
# Open terminal
xdotool key ctrl+grave
sleep 0.5
# Type command
xdotool type "npm install"
xdotool key Return

Run task

code --command "workbench.action.tasks.runTask"

Extensions Management

List installed extensions

code --list-extensions

List with versions

code --list-extensions --show-versions

Install extension

code --install-extension ms-python.python
code --install-extension esbenp.prettier-vscode
code --install-extension GitHub.copilot

Install multiple extensions

code --install-extension ms-python.python \
     --install-extension ms-toolsai.jupyter \
     --install-extension GitHub.copilot

Uninstall extension

code --uninstall-extension extension.id

Disable all extensions (for troubleshooting)

code --disable-extensions

Install extension from VSIX

code --install-extension /path/to/extension.vsix

GitHub Copilot Integration

Ensure Copilot is installed

code --list-extensions | grep -i copilot
# If not installed:
code --install-extension GitHub.copilot
code --install-extension GitHub.copilot-chat

Open Copilot Chat

code --command "workbench.action.chat.open"

Trigger inline suggestion

code --command "editor.action.inlineSuggest.trigger"

Accept Copilot suggestion

code --command "editor.action.inlineSuggest.commit"

Open Copilot panel/chat via keyboard simulation

# Open VS Code first, then:
xdotool key ctrl+shift+i  # Open Copilot Chat (may vary)

Workspace and Settings

Open settings

code --command "workbench.action.openSettings"

Open settings JSON

code ~/.config/Code/User/settings.json

Open keybindings

code ~/.config/Code/User/keybindings.json

Export extensions list (for backup/sharing)

code --list-extensions > ~/vscode-extensions.txt

Install extensions from list

cat ~/vscode-extensions.txt | xargs -L 1 code --install-extension

Open workspace file

code project.code-workspace

Search and Navigation

Search in files (opens search panel)

code --command "workbench.action.findInFiles"

Go to file (quick open)

code --command "workbench.action.quickOpen"

Go to symbol

code --command "workbench.action.gotoSymbol"

Go to line

code --command "workbench.action.gotoLine"

Search with ripgrep from terminal, then open result

# Find and open first match
FILE=$(rg -l "search_term" | head -1) && code "$FILE"

# Find line number and open at that line
RESULT=$(rg -n "search_term" | head -1)
FILE=$(echo "$RESULT" | cut -d: -f1)
LINE=$(echo "$RESULT" | cut -d: -f2)
code -g "$FILE:$LINE"

Debugging

Start debugging

code --command "workbench.action.debug.start"

Stop debugging

code --command "workbench.action.debug.stop"

Toggle breakpoint

code --command "editor.debug.action.toggleBreakpoint"

Step over/into/out

code --command "workbench.action.debug.stepOver"
code --command "workbench.action.debug.stepInto"
code --command "workbench.action.debug.stepOut"

Git Integration

Open source control view

code --command "workbench.view.scm"

Stage all changes

code --command "git.stageAll"

Commit

code --command "git.commit"

Push/Pull/Sync

code --command "git.push"
code --command "git.pull"
code --command "git.sync"

View git log

code --command "git.viewHistory"

Advanced Automation

Focus VS Code window

wmctrl -a "Visual Studio Code"

Screenshot VS Code window

wmctrl -a "Visual Studio Code" && sleep 0.3 && scrot -u ~/Pictures/vscode-$(date +%Y%m%d-%H%M%S).png

Type in VS Code (after focusing)

wmctrl -a "Visual Studio Code"
sleep 0.3
xdotool type "// This is a comment"

Save current file via keyboard

wmctrl -a "Visual Studio Code"
xdotool key ctrl+s

Open command palette

wmctrl -a "Visual Studio Code"
xdotool key ctrl+shift+p
sleep 0.3
xdotool type "Format Document"
xdotool key Return

Create new file in project

PROJECT=~/myproject
mkdir -p "$PROJECT/src"
cat > "$PROJECT/src/utils.py" << 'EOF'
def helper():
    pass
EOF
code "$PROJECT/src/utils.py"

Useful Workflows

Open project and install deps

code ~/project && cd ~/project && npm install

Create Python project structure

PROJECT=~/new-python-project
mkdir -p "$PROJECT"/{src,tests,docs}
touch "$PROJECT/src/__init__.py"
touch "$PROJECT/tests/__init__.py"
echo "# My Project" > "$PROJECT/README.md"
code "$PROJECT"

Open project with terminal ready

code ~/project
sleep 2
code --command "workbench.action.terminal.new"

Quick file from clipboard

xclip -selection clipboard -o > /tmp/from-clipboard.txt && code /tmp/from-clipboard.txt

VS Code Server (Remote)

Check if code-server is running

pgrep -f "code-server" && echo "Running" || echo "Not running"

Status

code --status

Version info

code --version

Verbose logging (for debugging)

code --verbose --log debug