KEMBAR78
Vs Code GitHub Copilot Cheat Sheet - A3 Format | PDF | Command Line Interface | Software Development
0% found this document useful (0 votes)
59 views8 pages

Vs Code GitHub Copilot Cheat Sheet - A3 Format

Uploaded by

logeshkannanengr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views8 pages

Vs Code GitHub Copilot Cheat Sheet - A3 Format

Uploaded by

logeshkannanengr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

VS Code GitHub Copilot

Complete Workshop Reference & Command Guide

⌨️ Essential Shortcuts
Action Win/Linux Mac

Open Chat Ctrl+Alt+I ⌃⌘I

Inline Chat Ctrl+I ⌘I

Quick Chat Ctrl+Shift+Alt+L ⇧⌥⌘L

Agent Mode Ctrl+Shift+I ⇧⌘I

Accept Suggestion Tab Tab

Voice Chat Ctrl+I (hold) ⌘I (hold)

New Session Ctrl+N ⌘N

Dismiss Escape Escape

💬 Chat Modes & Models


▶ Ask Mode: Questions & explanations
▶ Edit Mode: Code modifications
▶ Agent Mode: Autonomous tasks
▶ Custom Modes: Specialized workflows

Model Selection
Fast Coding: GPT-4o, Claude Sonnet
Reasoning: o1-preview, Claude Opus
Math Support: KaTeX rendering enabled

Chat Navigation:
Use ↑/↓ arrows to navigate chat history
Edit previous prompts and revert changes
Clear session with /clear
🔧 Context & Variables
#codebase Auto-search workspace

#selection Current editor selection

#changes Git changes list

#problems Workspace errors/warnings

#fetch Web page content

#githubRepo GitHub repo search

#terminalLastCommand Last terminal output


#searchResults Search view results
#testFailure Failed test information

⚡ Slash Commands
/explain Explain code/concepts

/fix Fix errors & issues

/tests Generate test cases

/setupTests Setup test framework

/docs Documentation comments

/new Scaffold projects

/newNotebook Create Jupyter notebook

/search Generate search query

/startDebugging Debug configuration

/clear New chat session

/help Usage help


👥 Chat Participants
@github GitHub integration

@terminal Shell & terminal help

@vscode VS Code features

@workspace Workspace questions

GitHub Examples:
@github What PRs are assigned to me?
@github Show recent merged PRs
@github List issues by milestone

Terminal Examples:
@terminal list largest files
@terminal /explain top command
@terminal how to compress files?

🎯 Customization Setup
Instructions Files:
1 Run: Chat: New Instructions File

2 Choose workspace or user scope

3 Store in .github/instructions/

4 Add applyTo glob patterns

--- applyTo: "**/*.ts,**/*.tsx" description: "TypeScript standards" --- # Project Guidelines - Use interfaces for data structures - Prefer functional components - Always define
TypeScript types

Prompt Files:
1 Run: Chat: New Prompt File

2 Store in .github/prompts/

3 Execute with /prompt-name

4 Share with team via Git


🏆 Best Practices & Prompting Tips
▶ Start General: Begin broad, then add specific requirements
▶ Provide Examples: Show expected input/output formats
▶ Break Down Tasks: Complex requests → smaller sub-tasks
▶ Use Context: Reference files with #filename syntax
▶ Iterate & Refine: Build on previous responses
▶ Be Specific: Include language, framework, version details
▶ Add Constraints: Mention libraries to avoid/prefer
▶ Include Examples: Paste relevant code snippets

Good Prompting Examples:


Instead of: "Create a form"
Try: "Generate a React form component with validation using react-hook-form and yup. Include fields for name, email, phone. TypeScript types required."

Instead of: "Fix this error"


Try: "Fix this TypeScript error in my Express route handler: [paste error]. Using Node.js 18, Express 4.x."

Context Strategy
Use #codebase for automatic discovery • Drag & drop files • Include terminal output • Reference symbols with #SymbolName

🚀 Agent Mode Deep Dive


▶ Autonomous Planning: Breaks down complex tasks
▶ Multi-step Execution: Chains tools and operations
▶ Progress Monitoring: Tracks and iterates on results
▶ Tool Integration: File editing, terminal, search
▶ Error Recovery: Adapts when operations fail
▶ Context Awareness: Maintains task context

Available Tools:
editFiles Create/modify files runCommands Terminal execution

search File/code search runTests Test execution

runTasks VS Code tasks openSimpleBrowser Preview apps

Agent Mode Tips


Configure auto-approval for terminal commands • Use custom chat modes for specialized workflows • Enable MCP servers for extended capabilities
⚙️ Advanced Configuration
Key Settings:
Instructions:
github.copilot.chat.codeGeneration.useInstructionFiles
chat.instructionsFilesLocations

Prompt Files:
chat.promptFiles
chat.promptFilesLocations

Agent Mode:
chat.tools.terminal.autoApprove
workbench.settings.showAISearchToggle

"chat.instructionsFilesLocations": { "src/frontend/instructions": true, "src/backend/instructions": false } "chat.promptFilesLocations": { ".github/prompts": true,


"setup/**/prompts": true }

🔍 Debugging & Testing


▶ Debug Config: Auto-generate launch.json
▶ Test Generation: Unit & integration tests
▶ Error Analysis: Fix compilation errors
▶ Code Review: Automated suggestions
▶ Performance: Optimization recommendations

Terminal Commands:
copilot-debug python app.py
copilot-debug node server.js
copilot-debug --help

Test Coverage:
Use /tests on function selections
Generate tests for uncovered code
Set up frameworks with /setupTests
🔗 Workspace Integration
▶ Remote Indexing: GitHub-based search
▶ Local Indexing: Machine-stored cache
▶ Semantic Search: AI-powered file search
▶ Git Integration: Commit messages & PR descriptions
▶ Extension Support: Third-party tool integration

Source Control:
Auto-generate commit messages
Create PR titles and descriptions
Review uncommitted changes
Add commits as chat context

Performance Tip
Enable workspace indexing for faster, more accurate code search in large repositories

📋 Workshop Hands-on Activities


1 Setup: Install Copilot extension and sign in

2 Shortcuts: Practice Ctrl+Alt+I , Ctrl+I commands

3 Instructions: Create workspace instructions file

4 Prompting: Try different prompting techniques


5 Context: Use #codebase, #selection variables
6 Participants: Test @github, @terminal, @workspace
7 Agent Mode: Enable and configure tools
8 Customization: Create reusable prompt files
9 Integration: Enable workspace indexing
10 Testing: Generate tests with /tests command
🎓 Common Use Cases & Examples
Code Generation:
"Create a REST API endpoint for user authentication using Express.js and JWT. Include validation middleware and error handling."

Refactoring:
"Refactor this class-based React component to use hooks. Maintain the same functionality but improve performance."

Documentation:
"Generate comprehensive JSDoc comments for this TypeScript interface including parameter descriptions and examples."

Testing:
"Create unit tests for this utility function using Jest. Include edge cases and error scenarios."

Debugging:
"This async function is causing memory leaks. Help identify the issue and suggest fixes."
📚 Quick Reference Commands & Resources
File Management
▶ Chat: New Instructions File
▶ Chat: New Prompt File
▶ Chat: Configure Instructions
▶ Chat: Configure Prompt Files
▶ Chat: Attach Instructions
▶ Chat: Run Prompt

Navigation & Control


▶ Switch between chat modes
▶ Configure available tools
▶ Edit previous chat prompts
▶ Clear chat session
▶ Export chat history
▶ Sync settings across devices

Documentation Links
▶ Main: code.visualstudio.com/docs/copilot
▶ Support: support.anthropic.com
▶ GitHub: docs.github.com/copilot
▶ Prompting: docs.anthropic.com/prompt-engineering
▶ API: docs.anthropic.com
▶ Community: github.com/github/copilot-docs

VS Code GitHub Copilot Workshop Reference • A3 Format • 2025 Edition


Print this page as PDF using Ctrl+P → Save as PDF → A3 Landscape → Scale 85%

You might also like