VSCode GitHub Copilot Chat 隱藏用法大公開!🚀

· 程式開發, DevOps, 數據與 RAG

1️⃣ Chat Participants (用 @ 搵專家)
@workspace:掃描成個 Project 架構,答一啲跨檔案嘅邏輯問題。
@github:唔使開 Browser 都可以問 PR、Issues 同 Repo 嘅內容。
@terminal:提供終端機指令相關協助。

2️⃣ Slash Commands (用 / 行捷徑)
/clear:【必學!】 當個對話太長、Copilot 開始「遊花園」時,用佢嚟重設對話,清空 Context 重新出發。
/explain:解釋複雜嘅 Code。
/fix:自動修復 Bug。

3️⃣ Chat Variables (用 # 加 Context)
#selection:處理你 Highlight 咗嗰段 Code。
例如:Where is #getUser used? #usages
💡 小貼士: 如果 Copilot 答得唔清唔楚,記住先用 /clear 清除舊記憶,再用 @workspace #file 俾明確目標,效果會好好多!

【主要參考資料】
https://lnkd.in/g8rjHYaD
https://lnkd.in/gSW-qFEn

【Unlock the Full Power of VSCode GitHub Copilot Chat! 🚀】

1️⃣ Chat Participants (Use @ to find the expert) Stop giving generic prompts. Direct your questions to the right “agent”:
@workspace: Scans your entire project structure to answer complex, cross-file logic questions.
@github: No need to switch to your browser! Ask about PRs, Issues, and repository-specific knowledge directly.
@terminal: Get help with terminal commands and shell-specific errors instantly.

2️⃣ Slash Commands (Use / for shortcuts) Execute complex tasks with just one word:
/clear: [Must-Know!] When a conversation gets too long and Copilot starts losing track, use this to reset the context and start fresh.
/explain: Breaks down complex code blocks into plain English.
/fix: Automatically proposes a solution for bugs in your selected code.

3️⃣ Chat Variables (Use # for Context) Give Copilot the exact data it needs to see:
#file: Reference a specific file in your workspace.
#selection: Focus Copilot’s attention strictly on the code you’ve highlighted.
Example: “Where is #getUser used? #usages”

💡 Pro Tip: If Copilot’s answers feel “off,” hit /clear to wipe the memory, then use @workspace #file to provide a sharp, specific target. It makes a world of difference!

【Reference Guide】 🔗 https://lnkd.in/g8rjHYaD 🔗 https://lnkd.in/gSW-qFEn

🔗 Manage context for AI

原文發佈於 LinkedIn →

← 網誌