Tutorial - Setting up VS Code for AI-assisted development
Tutorial: Setting up VS Code for AI-assisted development
Learning objectives
By the end of this tutorial, you will:
- Install and configure VS Code with GitHub Copilot
- Set up multi-root workspaces for multi-repository operations
- Configure optimal Copilot Chat settings
- Understand model selection and when to use each
- Verify your setup with practical examples
Prerequisites
- Laptop or workstation (macOS, Windows, or Linux)
- GitHub account with Copilot access (individual or enterprise subscription)
- Git installed and configured
- Basic familiarity with VS Code (recommended)
Part 1: Installing VS Code and extensions
Install Visual Studio Code
Download and install VS Code for your platform:
macOS:
# Using Homebrew
brew install --cask visual-studio-code
# Or download from https://code.visualstudio.com/
Windows:
# Using winget
winget install Microsoft.VisualStudioCode
# Or download installer from https://code.visualstudio.com/
Linux (Debian/Ubuntu):
# Download and install .deb package
wget -O code.deb 'https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64'
sudo dpkg -i code.deb
sudo apt-get install -f
Verify installation:
code --version
Install GitHub Copilot extensions
Install required extensions:
- Open VS Code
- Click Extensions icon in Activity Bar (or
Cmd+Shift+X/Ctrl+Shift+X) - Search for and install:
- GitHub Copilot (ID:
GitHub.copilot) - GitHub Copilot Chat (ID:
GitHub.copilot-chat)
- GitHub Copilot (ID:
Or install via command line:
code --install-extension GitHub.copilot
code --install-extension GitHub.copilot-chat
Authenticate with GitHub
- After installing extensions, VS Code will prompt to sign in
- Click "Sign in to GitHub"
- Follow browser authentication flow
- Authorize GitHub Copilot for VS Code
Verify authentication:
- Look for Copilot icon in status bar (bottom-right)
- Icon should show checkmark when active
- Click icon to view status
Part 2: Configuring VS Code for multi-repository work
Understanding multi-root workspaces
Multi-root workspaces allow VS Code to open multiple repository folders simultaneously, enabling Copilot to access context across all repositories.
Benefits:
- Copilot can reference files across all repositories
- Unified search and navigation
- Consistent settings across related projects
- Efficient cross-repository operations
Create a multi-root workspace
Method 1: Using VS Code UI
- Open VS Code
- File → Add Folder to Workspace
- Select first repository folder
- Repeat for additional repositories
- File → Save Workspace As...
- Save as
ohemr-infrastructure.code-workspace
Method 2: Create workspace file manually
Create ~/workspaces/ohemr-infrastructure.code-workspace:
{
"folders": [
{
"path": "../ohemr-ansible-playbooks",
"name": "Ansible Playbooks"
},
{
"path": "../ohemr-epic-pro-001",
"name": "Epic Production"
},
{
"path": "../ohemr-epic-test-001",
"name": "Epic Test"
},
{
"path": "../ohemr-epic-shared-001",
"name": "Epic Shared"
},
{
"path": "../ohemr-connectivity-pro-001",
"name": "Connectivity Production"
},
{
"path": "../ohemr-citrix-shared-001",
"name": "Citrix Shared"
},
{
"path": "../ohemr-epic-npd-001",
"name": "Epic Non-Prod"
},
{
"path": "../ohemr-issue-tracker",
"name": "Issue Tracker"
}
],
"settings": {
"files.autoSave": "afterDelay",
"editor.formatOnSave": true,
"github.copilot.enable": {
"*": true,
"yaml": true,
"markdown": true,
"terraform": true,
"hcl": true
}
}
}
Open workspace:
code ~/workspaces/ohemr-infrastructure.code-workspace
Organize repositories
Best practices for multi-root workspaces:
Directory structure:
~/scm/optum-tech-compute/
├── ohemr-ansible-playbooks/
├── ohemr-epic-pro-001/
├── ohemr-epic-test-001/
├── ohemr-epic-shared-001/
├── ohemr-connectivity-pro-001/
├── ohemr-citrix-shared-001/
├── ohemr-epic-npd-001/
└── ohemr-issue-tracker/
~/workspaces/
└── ohemr-infrastructure.code-workspace
Naming conventions:
- Repository folders: Match GitHub repository names exactly
- Workspace files: Descriptive names (e.g.,
ohemr-infrastructure.code-workspace) - Workspace folder labels: Human-readable names for better navigation
Part 3: Configuring Copilot Chat
Understanding Copilot models
GitHub Copilot Chat surfaces multiple frontier models. The exact lineup rotates as GitHub adds and retires models — check the model picker in your Copilot Chat panel for the current list. As of mid-2026, the practical families are:
| Model family | Typical context window | Best for |
|---|---|---|
| Claude Sonnet (current) | ~200k–1M tokens | Multi-file refactoring, multi-repo operations |
| Claude Opus (current) | ~200k–1M tokens | Deep reasoning, large-scale planning |
| OpenAI GPT (current generation) | ~128k–200k tokens | Quick responses, single-file edits, completions |
OpenAI reasoning (o-series) | Specialized / smaller | Logic-heavy and algorithmic problem-solving |
Select the right model for your task
Decision matrix:
| Task type | Recommended family | Reason |
|---|---|---|
| Single-file edit | OpenAI GPT (current) | Fast turnaround on small changes |
| Multi-file refactoring | Claude Sonnet (current) | Strong multi-file reasoning, large context |
| Multi-repo operations | Claude Sonnet/Opus (large) | Needs the largest context window available |
| Code review | Claude Sonnet (current) | Solid analysis and explanation |
| Debugging | OpenAI GPT or Claude Sonnet | Pick whichever responds faster on the file you are editing |
| Architecture planning | Claude Opus / Sonnet large | Requires reasoning over many components at once |
| Pure logic/algorithms | OpenAI o-series | Reasoning-tuned models |
Enable Agent Mode
Agent Mode allows Copilot to:
- Execute multiple tool calls autonomously
- Chain operations together
- Make decisions without constant user input
- Handle complex multi-step workflows
When to use Agent Mode:
- ✅ Multi-repository operations
- ✅ Systematic bulk changes
- ✅ Creating comprehensive documentation
- ✅ Complex refactoring across files
- ❌ Simple queries or single edits
- ❌ When you want step-by-step control
Enable Agent Mode:
Agent Mode is a first-class control in the Copilot Chat panel — there is no hidden debug flag to flip.
- Open the Copilot Chat panel.
- Click the mode/model selector at the top of the panel.
- Choose Agent (separate from Ask / Edit).
- Pick the model you want Agent Mode to use.
Configure Copilot settings
Access Copilot settings:
- Command Palette:
Cmd+Shift+P→ "Preferences: Open Settings (UI)" - Search: "GitHub Copilot"
Recommended settings:
{
// Enable Copilot
"github.copilot.enable": {
"*": true,
"yaml": true,
"markdown": true,
"terraform": true,
"hcl": true
},
// Chat settings
"github.copilot.chat.enabled": true,
"github.copilot.chat.welcomeMessage": "concise",
// Editor integration
"github.copilot.editor.enableAutoCompletions": true,
"github.copilot.editor.enableCodeActions": true
}
Part 4: Installing supporting tools
Install GitHub CLI
Copilot can use GitHub CLI to create issues, PRs, and manage repositories.
macOS:
brew install gh
Windows:
winget install GitHub.cli
Linux:
# Debian/Ubuntu
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | \
sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] \
https://cli.github.com/packages stable main" | \
sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update && sudo apt install gh
Authenticate:
gh auth login
Follow prompts:
- Select "GitHub.com"
- Choose "HTTPS"
- Authenticate with web browser
- Paste authentication token when prompted
Verify:
gh auth status
Install additional CLI tools
Terraform (for infrastructure repositories):
# macOS
brew tap hashicorp/tap
brew install hashicorp/tap/terraform
# Windows
winget install Hashicorp.Terraform
# Verify
terraform version
Ansible (for automation repositories):
# macOS
brew install ansible
# Linux
pip install ansible
# Verify
ansible --version
jq (for JSON processing):
# macOS
brew install jq
# Linux
sudo apt install jq
# Verify
jq --version
Part 5: Verification and testing
Test Copilot completions
Create a test file to verify Copilot is working:
- Create new file:
test-copilot.py - Type comment:
# Function to calculate fibonacci sequence - Press
Enter - Copilot should suggest function implementation in gray text
- Press
Tabto accept suggestion
Test Copilot Chat
Open Copilot Chat (Cmd+Shift+I / Ctrl+Shift+I) and try:
@workspace how many terraform repositories are in this workspace?
Expected behavior:
- Copilot analyzes workspace
- Returns count of repositories with Terraform files
- Provides list of repository names
Test multi-repository context
With multi-root workspace open, ask:
#codebase find all files named terraform.tfvars and show me their paths
Expected behavior:
- Copilot searches all workspace repositories
- Lists all matching files with full paths
- Provides summary of findings
Test Agent Mode
Switch to Claude Sonnet 4.5 with Agent Mode enabled and try:
Create a summary report of all README.md files in this workspace,
including repository name, description, and primary language used
Expected behavior:
- Copilot autonomously reads all README files
- Extracts relevant information
- Compiles comprehensive summary
- Presents formatted report
Verify GitHub CLI integration
Test that Copilot can use GitHub CLI:
Show me my recent pull requests in the ohemr repositories
Expected behavior:
- Copilot executes
gh pr listcommands - Filters results to ohemr repositories
- Presents formatted list of PRs
Part 6: Optimizing your workflow
Create keyboard shortcuts
Add custom shortcuts for common Copilot actions:
- Open Keyboard Shortcuts:
Cmd+K Cmd+S(macOS) orCtrl+K Ctrl+S(Windows/Linux) - Search for Copilot commands
- Assign shortcuts:
github.copilot.generate:Cmd+Shift+G/Ctrl+Shift+Ggithub.copilot.chat.open:Cmd+Shift+I/Ctrl+Shift+Igithub.copilot.acceptCursorPanelSuggestion:Tab
Configure workspace-specific settings
Create .vscode/settings.json in workspace root:
{
"github.copilot.enable": {
"*": true
},
"files.associations": {
"*.tfvars": "terraform",
"*.hcl": "terraform"
},
"editor.defaultFormatter": "hashicorp.terraform",
"[terraform]": {
"editor.formatOnSave": true
},
"[yaml]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "redhat.vscode-yaml"
}
}
Install recommended extensions
For infrastructure work:
# Terraform
code --install-extension hashicorp.terraform
# YAML
code --install-extension redhat.vscode-yaml
# Markdown
code --install-extension yzhang.markdown-all-in-one
# Git
code --install-extension eamodio.gitlens
# Docker
code --install-extension ms-azuretools.vscode-docker
Troubleshooting
Copilot not showing suggestions
Symptoms: No gray text suggestions appearing
Solutions:
-
Check Copilot status icon (bottom-right):
- ✅ Green checkmark: Active
- ⚠️ Yellow warning: Limited functionality
- ❌ Red X: Disabled or not authenticated
-
Verify settings: open the Settings UI and confirm
GitHub Copilot → Enableistrue. -
Restart VS Code (close all windows, then reopen the workspace):
code ~/workspaces/ohemr-infrastructure.code-workspace -
Test GitHub connectivity:
curl -I https://api.github.com
Chat not responding
Symptoms: Copilot Chat shows error or doesn't respond
Solutions:
-
Check model selection:
- Some models may be unavailable
- Switch to different model
-
Clear chat history:
- Click trash icon in chat panel
- Start new conversation
-
Check output panel:
- View → Output
- Select "GitHub Copilot" from dropdown
- Review error messages
Workspace context not working
Symptoms: @workspace doesn't find files or returns incorrect results
Solutions:
-
Verify workspace is loaded:
- Check Explorer shows all folders
- Bottom-left shows workspace name
-
Reload workspace:
- File → Close Workspace
- Reopen workspace file
-
Rebuild workspace index:
- Command Palette: "Developer: Reload Window"
Authentication issues
Symptoms: Copilot asks to sign in repeatedly
Solutions:
-
Re-authenticate GitHub Copilot:
- Click Copilot icon in status bar
- Select "Sign in to GitHub"
- Complete authentication flow
-
Verify GitHub CLI authentication:
gh auth status gh auth refresh -
Check enterprise settings:
- If using GitHub Enterprise, verify organization settings
- Ensure Copilot is enabled for your organization
Next steps
Now that you have VS Code configured with Copilot:
- Try the advanced tutorial: Advanced Copilot Chat techniques
- Execute multi-repo operations: Large-scale multi-repository operations
- Learn prompt engineering: Effective prompt engineering for infrastructure
- Master workspace context: Using workspace context and codebase search
Additional resources
- VS Code Documentation
- GitHub Copilot Documentation
- Multi-root Workspaces
- VS Code Keyboard Shortcuts
- GitHub CLI Documentation
Related resources
- AI Development hub — Central hub for all AI development tools
- Claude Code CLI setup — CLI-based AI assistant setup
- AI tools decision matrix — Choosing the right AI tool