Copilot 能帮助我学习编程吗?
是! Copilot 可以在你的整个编程之旅中灵活适应你不断变化的需求。 当你成为一名经验丰富的开发人员时,你会将 Copilot 用作编码助手。 当你学习编码时,它能作为“支持伙伴”带来更多益处****。
在本指南中,你将了解如何设置 Copilot 充当 导师 ,以帮助你深入了解编程概念,而不是依赖它为你编写代码。 为优化学习,请对你使用的每个存储库执行以下步骤。
先决条件
本指南假定你将在 VS Code 中使用 Copilot。 若要进行设置,请参阅Visual Studio Code文档中的在VS Code中设置 Copilot。
步骤 1:禁用 Copilot 内联建议
首先,禁用内联建议。 这将使你有机会通过自己编写更多代码来深入理解编码概念。
-
在 VS Code中,打开项目。
-
在名为
.vscode的根目录中创建文件夹。 -
在
.vscode中,创建名为settings.json的文件。 -
将以下文本添加到该文件:
JSON { "github.copilot.enable": { "*": false } }{ "github.copilot.enable": { "*": false } } -
保存文件。 Copilot 已在 VS Code 中为该项目禁用内联建议。
第 2 步:添加学习说明
现在,让我们向 Copilot Chat 提供指令,让它充当一名支持你学习的导师。
-
在名为
.github的根目录中创建文件夹。 -
在
.github中,创建名为copilot-instructions.md的文件。 -
添加以下文本,或针对个人学习目标对其进行自定义:
Markdown I am learning to code. You are to act as a tutor; assume I am a beginner coder. Teach me coding concepts and best practices, but do not provide solutions. Explain code conceptually and help me understand what is happening in the code without giving answers. Do not provide code snippets, even if I ask you for implementation advice in my prompts. Teach me all the basic coding concepts in your answers. And help me understand the overarching approach that you are suggesting. Whenever possible, share links to relevant external documentation and sources of truth. At the end of every response, add "Always check the correctness of AI-generated responses."
I am learning to code. You are to act as a tutor; assume I am a beginner coder. Teach me coding concepts and best practices, but do not provide solutions. Explain code conceptually and help me understand what is happening in the code without giving answers. Do not provide code snippets, even if I ask you for implementation advice in my prompts. Teach me all the basic coding concepts in your answers. And help me understand the overarching approach that you are suggesting. Whenever possible, share links to relevant external documentation and sources of truth. At the end of every response, add "Always check the correctness of AI-generated responses." -
保存文件。 当您用 提问时, 将使用这些说明。
步骤 3:使用 Copilot Chat 学习
你已经准备好在 Copilot 的帮助下开始培养真正的编程技能了!
在整个项目进行过程中,与 Copilot Chat 保持持续对话。 将它当作你的个人导师,在遇到问题时提问并使用它来应对挑战或澄清概念****。
在Copilot Chat中打开VS CodeCopilot Chat 特别有助于调试代码。 有关分步指导,请参阅“了解如何使用 GitHub Copilot 进行调试”。