GitHub Copilot revolutionizes how you write code in VS Code. This tutorial walks you through building a task management web app while using Copilot's most powerful features:
🤖 Step 2: Use Agent Mode to Autogenerate Full Features
Agent mode is like your personal developer assistant.
- 
Press Ctrl+Alt+Ior click the Copilot icon to open the Chat View.
- 
In the mode dropdown, select Agent.
- 
Enter this prompt: 
- 
Copilot will: - 
Update index.html
- 
Create style.css
- 
Create script.js
 
- 
✅ Preview your app in browser or use the Live Preview extension.
➕ Add a Feature
In Chat view:
Agent mode handles multi-file changes based on your prompt.
✍️ Step 3: Precise Edits with Inline Chat
Inline chat is perfect for targeted code edits.
- 
Open script.js
- 
Select the function where tasks are added. 
- 
Press Ctrl+Ito open Inline Chat.
- 
Enter: 
✅ Accept the changes if they look good.
Great for:
- 
Bug fixes 
- 
Refactoring 
- 
Adding validation or comments 
🎨 Step 4: Personalize Copilot for Your Project
📄 Custom Instructions
- 
Create a .githubfolder in the root of your project.
- 
Add a file named copilot-instructions.md.
- 
Paste the following: 
🎛️ Test Custom Instructions
In Agent mode:
Copilot will follow your new coding standards automatically.
🧠 Create a Custom Chat Mode: Code Reviewer
- 
Open Command Palette → Chat: New Mode File 
- 
Save it in .github/chatmodes/Code Reviewer.md
- 
Replace content with: 
✅ In Chat View, select Code Reviewer and prompt:
⚡ Step 5: Use Smart Actions (e.g., AI-Powered Commit Messages)
- 
Open the Source Control panel ( Ctrl+Shift+G)
- 
Stage your changes 
- 
Click the ✨ icon to generate a commit message 
- 
AI will generate a conventional commit message based on your changes 
✅ Use this for consistent commit history and less manual writing.
🏁 What You’ve Built
You now have a fully functional AI-powered web development workflow:
- 
✅ AI code completions 
- 
✅ Feature generation with Agent mode 
- 
✅ Precise editing via Inline Chat 
- 
✅ Smart commit message generation 
- 
✅ Personalized chat modes and coding standards 
0 件のコメント:
コメントを投稿