Navigation
Getting StartedUpdated July 3, 2026

Tutorial - Setting up VS Code for AI-assisted development

tutorialvscodecopilotsetupai-toolsgetting-started

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:

  1. Open VS Code
  2. Click Extensions icon in Activity Bar (or Cmd+Shift+X / Ctrl+Shift+X)
  3. Search for and install:
    • GitHub Copilot (ID: GitHub.copilot)
    • GitHub Copilot Chat (ID: GitHub.copilot-chat)

Or install via command line:

code --install-extension GitHub.copilot
code --install-extension GitHub.copilot-chat

Authenticate with GitHub

  1. After installing extensions, VS Code will prompt to sign in
  2. Click "Sign in to GitHub"
  3. Follow browser authentication flow
  4. 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

  1. Open VS Code
  2. File → Add Folder to Workspace
  3. Select first repository folder
  4. Repeat for additional repositories
  5. File → Save Workspace As...
  6. 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 familyTypical context windowBest for
Claude Sonnet (current)~200k–1M tokensMulti-file refactoring, multi-repo operations
Claude Opus (current)~200k–1M tokensDeep reasoning, large-scale planning
OpenAI GPT (current generation)~128k–200k tokensQuick responses, single-file edits, completions
OpenAI reasoning (o-series)Specialized / smallerLogic-heavy and algorithmic problem-solving

Select the right model for your task

Decision matrix:

Task typeRecommended familyReason
Single-file editOpenAI GPT (current)Fast turnaround on small changes
Multi-file refactoringClaude Sonnet (current)Strong multi-file reasoning, large context
Multi-repo operationsClaude Sonnet/Opus (large)Needs the largest context window available
Code reviewClaude Sonnet (current)Solid analysis and explanation
DebuggingOpenAI GPT or Claude SonnetPick whichever responds faster on the file you are editing
Architecture planningClaude Opus / Sonnet largeRequires reasoning over many components at once
Pure logic/algorithmsOpenAI o-seriesReasoning-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.

  1. Open the Copilot Chat panel.
  2. Click the mode/model selector at the top of the panel.
  3. Choose Agent (separate from Ask / Edit).
  4. 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:

  1. Select "GitHub.com"
  2. Choose "HTTPS"
  3. Authenticate with web browser
  4. 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:

  1. Create new file: test-copilot.py
  2. Type comment: # Function to calculate fibonacci sequence
  3. Press Enter
  4. Copilot should suggest function implementation in gray text
  5. Press Tab to 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 list commands
  • 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:

  1. Open Keyboard Shortcuts: Cmd+K Cmd+S (macOS) or Ctrl+K Ctrl+S (Windows/Linux)
  2. Search for Copilot commands
  3. Assign shortcuts:
    • github.copilot.generate: Cmd+Shift+G / Ctrl+Shift+G
    • github.copilot.chat.open: Cmd+Shift+I / Ctrl+Shift+I
    • github.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:

  1. Check Copilot status icon (bottom-right):

    • ✅ Green checkmark: Active
    • ⚠️ Yellow warning: Limited functionality
    • ❌ Red X: Disabled or not authenticated
  2. Verify settings: open the Settings UI and confirm GitHub Copilot → Enable is true.

  3. Restart VS Code (close all windows, then reopen the workspace):

    code ~/workspaces/ohemr-infrastructure.code-workspace
    
  4. Test GitHub connectivity:

    curl -I https://api.github.com
    

Chat not responding

Symptoms: Copilot Chat shows error or doesn't respond

Solutions:

  1. Check model selection:

    • Some models may be unavailable
    • Switch to different model
  2. Clear chat history:

    • Click trash icon in chat panel
    • Start new conversation
  3. 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:

  1. Verify workspace is loaded:

    • Check Explorer shows all folders
    • Bottom-left shows workspace name
  2. Reload workspace:

    • File → Close Workspace
    • Reopen workspace file
  3. Rebuild workspace index:

    • Command Palette: "Developer: Reload Window"

Authentication issues

Symptoms: Copilot asks to sign in repeatedly

Solutions:

  1. Re-authenticate GitHub Copilot:

    • Click Copilot icon in status bar
    • Select "Sign in to GitHub"
    • Complete authentication flow
  2. Verify GitHub CLI authentication:

    gh auth status
    gh auth refresh
    
  3. 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:

  1. Try the advanced tutorial: Advanced Copilot Chat techniques
  2. Execute multi-repo operations: Large-scale multi-repository operations
  3. Learn prompt engineering: Effective prompt engineering for infrastructure
  4. Master workspace context: Using workspace context and codebase search

Additional resources

Related resources